diff --git a/.gitignore b/.gitignore index b844b143..97ef7367 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ Gemfile.lock +.bundle/ +vendor/ diff --git a/.travis.yml b/.travis.yml index 943c1b12..83880550 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,8 @@ before_install: - sudo apt-get install libicu-dev -y - gem update --system 2.1.11 rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 - - ree + - 2.1.1 notifications: disabled: true diff --git a/Gemfile b/Gemfile index 3df9dcfc..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,2 @@ source 'https://rubygems.org' gemspec - -if RUBY_VERSION < "1.9.3" - # escape_utils 1.0.0 requires 1.9.3 and above - gem "escape_utils", "0.3.2" -end diff --git a/README.md b/README.md index 1ff2ed8f..660ac00c 100644 --- a/README.md +++ b/README.md @@ -106,8 +106,50 @@ To update the `samples.json` after adding new files to [`samples/`](https://gith bundle exec rake samples +### A note on language extensions + +Linguist has a number of methods available to it for identifying the language of a particular file. The initial lookup is based upon the extension of the file, possible file extensions are defined in an array called `extensions`. Take a look at this example for example for `Perl`: + +``` +Perl: + type: programming + ace_mode: perl + color: "#0298c3" + extensions: + - .pl + - .PL + - .perl + - .ph + - .plx + - .pm + - .pod + - .psgi + interpreters: + - perl +``` +Any of the extensions defined are valid but the first in this array should be the most popular. + ### Testing Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. Here's our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) + +### Releasing + +If you are the current maintainer of this gem: + + 0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx` + 0. Make sure your local dependencies are up to date: `bundle install` + 0. Ensure that samples are updated: `bundle exec rake samples` + 0. Ensure that tests are green: `bundle exec rake test` + 0. Bump gem version in `lib/linguist/version.rb`. For example, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985). + 0. Make a PR to github/linguist. For example, [#1238](https://github.com/github/linguist/pull/1238). + 0. Build a local gem: `gem build github-linguist.gemspec` + 0. Testing: + 0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem + 0. Install the new gem locally + 0. Test behavior locally, branch deploy, whatever needs to happen + 0. Merge github/linguist PR + 0. Tag and push: `git tag vx.xx.xx; git push --tags` + 0. Push to rubygems.org -- `gem push github-linguist-2.10.12.gem` diff --git a/github-linguist.gemspec b/github-linguist.gemspec index f10f8d1f..d4c2337a 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -1,6 +1,8 @@ +require File.expand_path('../lib/linguist/version', __FILE__) + Gem::Specification.new do |s| s.name = 'github-linguist' - s.version = '2.10.11' + s.version = Linguist::VERSION s.summary = "GitHub Language detection" s.description = 'We use this library at GitHub to detect blob languages, highlight code, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.' @@ -11,10 +13,10 @@ Gem::Specification.new do |s| s.files = Dir['lib/**/*'] s.executables << 'linguist' - s.add_dependency 'charlock_holmes', '~> 0.6.6' - s.add_dependency 'escape_utils', '>= 0.3.1' + s.add_dependency 'charlock_holmes', '~> 0.7.3' + s.add_dependency 'escape_utils', '~> 1.0.1' s.add_dependency 'mime-types', '~> 1.19' - s.add_dependency 'pygments.rb', '~> 0.5.4' + s.add_dependency 'pygments.rb', '~> 0.6.0' s.add_development_dependency 'json' s.add_development_dependency 'mocha' diff --git a/lib/linguist.rb b/lib/linguist.rb index ad8337c8..3714b5a0 100644 --- a/lib/linguist.rb +++ b/lib/linguist.rb @@ -4,3 +4,4 @@ require 'linguist/heuristics' require 'linguist/language' require 'linguist/repository' require 'linguist/samples' +require 'linguist/version' diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index 37793a36..15ab2d9f 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -112,6 +112,12 @@ module Linguist end end + def ruby_encoding + if hash = detect_encoding + hash[:ruby_encoding] + end + end + # Try to guess the encoding # # Returns: a Hash, with :encoding, :confidence, :type @@ -241,7 +247,31 @@ module Linguist def lines @lines ||= if viewable? && data - data.split(/\r\n|\r|\n/, -1) + # `data` is usually encoded as ASCII-8BIT even when the content has + # been detected as a different encoding. However, we are not allowed + # to change the encoding of `data` because we've made the implicit + # guarantee that each entry in `lines` is encoded the same way as + # `data`. + # + # Instead, we re-encode each possible newline sequence as the + # detected encoding, then force them back to the encoding of `data` + # (usually a binary encoding like ASCII-8BIT). This means that the + # byte sequence will match how newlines are likely encoded in the + # file, but we don't have to change the encoding of `data` as far as + # Ruby is concerned. This allows us to correctly parse out each line + # without changing the encoding of `data`, and + # also--importantly--without having to duplicate many (potentially + # large) strings. + begin + encoded_newlines = ["\r\n", "\r", "\n"]. + map { |nl| nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data.encoding) } + + data.split(Regexp.union(encoded_newlines), -1) + rescue Encoding::ConverterNotFoundError + # The data is not splittable in the detected encoding. Assume it's + # one big line. + [data] + end else [] end diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 5c3de141..761288f0 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -63,7 +63,8 @@ module Linguist generated_jni_header? || composer_lock? || node_modules? || - vcr_cassette? + vcr_cassette? || + generated_by_zephir? end # Internal: Is the blob an XCode project file? @@ -237,6 +238,13 @@ module Linguist !!name.match(/composer.lock/) end + # Internal: Is the blob a generated by Zephir + # + # Returns true or false. + def generated_by_zephir? + !!name.match(/.\.zep\.(?:c|h|php)$/) + end + # Is the blob a VCR Cassette file? # # Returns true or false diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index a3de46e9..c1116780 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -28,6 +28,9 @@ module Linguist if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) } disambiguate_cl(data, languages) end + if languages.all? { |l| ["Rebol", "R"].include?(l) } + disambiguate_r(data, languages) + end end end @@ -73,6 +76,13 @@ module Linguist matches end + def self.disambiguate_r(data, languages) + matches = [] + matches << Language["Rebol"] if /\bRebol\b/i.match(data) + matches << Language["R"] if data.include?("<-") + matches + end + def self.active? !!ACTIVE end diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index bb91d126..a8e7a33c 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -24,7 +24,6 @@ module Linguist @extension_index = Hash.new { |h,k| h[k] = [] } @interpreter_index = Hash.new { |h,k| h[k] = [] } @filename_index = Hash.new { |h,k| h[k] = [] } - @primary_extension_index = {} # Valid Languages types TYPES = [:data, :markup, :programming, :prose] @@ -80,12 +79,6 @@ module Linguist @extension_index[extension] << language end - if @primary_extension_index.key?(language.primary_extension) - raise ArgumentError, "Duplicate primary extension: #{language.primary_extension}" - end - - @primary_extension_index[language.primary_extension] = language - language.interpreters.each do |interpreter| @interpreter_index[interpreter] << language end @@ -191,8 +184,7 @@ module Linguist # Returns all matching Languages or [] if none were found. def self.find_by_filename(filename) basename, extname = File.basename(filename), File.extname(filename) - langs = [@primary_extension_index[extname]] + - @filename_index[basename] + + langs = @filename_index[basename] + @extension_index[extname] langs.compact.uniq end @@ -299,15 +291,6 @@ module Linguist @interpreters = attributes[:interpreters] || [] @filenames = attributes[:filenames] || [] - unless @primary_extension = attributes[:primary_extension] - raise ArgumentError, "#{@name} is missing primary extension" - end - - # Prepend primary extension unless its already included - if primary_extension && !extensions.include?(primary_extension) - @extensions = [primary_extension] + extensions - end - # Set popular, and searchable flags @popular = attributes.key?(:popular) ? attributes[:popular] : false @searchable = attributes.key?(:searchable) ? attributes[:searchable] : true @@ -395,20 +378,6 @@ module Linguist # Returns the extensions Array attr_reader :extensions - # Deprecated: Get primary extension - # - # Defaults to the first extension but can be overridden - # in the languages.yml. - # - # The primary extension can not be nil. Tests should verify this. - # - # This attribute is only used by app/helpers/gists_helper.rb for - # creating the language dropdown. It really should be using `name` - # instead. Would like to drop primary extension. - # - # Returns the extension String. - attr_reader :primary_extension - # Public: Get interpreters # # Examples @@ -426,6 +395,27 @@ module Linguist # # Returns the extensions Array attr_reader :filenames + + # Public: Return all possible extensions for language + def all_extensions + (extensions + [primary_extension]).uniq + end + + # Deprecated: Get primary extension + # + # Defaults to the first extension but can be overridden + # in the languages.yml. + # + # The primary extension can not be nil. Tests should verify this. + # + # This method is only used by app/helpers/gists_helper.rb for creating + # the language dropdown. It really should be using `name` instead. + # Would like to drop primary extension. + # + # Returns the extension String. + def primary_extension + extensions.first + end # Public: Get URL escaped name. # @@ -485,7 +475,7 @@ module Linguist # # Returns html String def colorize(text, options = {}) - lexer.highlight(text, options = {}) + lexer.highlight(text, options) end # Public: Return name as String representation @@ -568,9 +558,8 @@ module Linguist :group_name => options['group'], :searchable => options.key?('searchable') ? options['searchable'] : true, :search_term => options['search_term'], - :extensions => options['extensions'].sort, + :extensions => [options['extensions'].first] + options['extensions'][1..-1].sort, :interpreters => options['interpreters'].sort, - :primary_extension => options['primary_extension'], :filenames => options['filenames'], :popular => popular.include?(name) ) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 6eb2a378..ccb79b96 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3,18 +3,15 @@ # All languages have an associated lexer for syntax highlighting. It # defaults to name.downcase, which covers most cases. # -# type - Either data, programming, markup, or nil +# type - Either data, programming, markup, prose, or nil # lexer - An explicit lexer String (defaults to name) # aliases - An Array of additional aliases (implicitly # includes name.downcase) # ace_mode - A String name of Ace Mode (if available) # wrap - Boolean wrap to enable line wrapping (default: false) -# extension - An Array of associated extensions -# interpreter - An Array of associated interpreters -# primary_extension - A String for the main extension associated with -# the language. Must be unique. Used when a Language is picked -# from a dropdown and we need to automatically choose an -# extension. +# extensions - An Array of associated extensions (the first one is +# considered the primary extension) +# interpreters - An Array of associated interpreters # searchable - Boolean flag to enable searching (defaults to true) # search_term - Deprecated: Some languages maybe indexed under a # different alias. Avoid defining new exceptions. @@ -28,13 +25,15 @@ ABAP: type: programming lexer: ABAP - primary_extension: .abap + extensions: + - .abap ANTLR: type: programming color: "#9DC3FF" lexer: ANTLR - primary_extension: .g4 + extensions: + - .g4 ASP: type: programming @@ -44,8 +43,8 @@ ASP: aliases: - aspx - aspx-vb - primary_extension: .asp extensions: + - .asp - .asax - .ascx - .ashx @@ -56,11 +55,11 @@ ASP: ATS: type: programming color: "#1ac620" - primary_extension: .dats lexer: OCaml aliases: - ats2 extensions: + - .dats - .atxt - .hats - .sats @@ -72,37 +71,48 @@ ActionScript: search_term: as3 aliases: - as3 - primary_extension: .as + extensions: + - .as Ada: type: programming color: "#02f88c" - primary_extension: .adb extensions: + - .adb - .ads Agda: type: programming color: "#467C91" - primary_extension: .agda + extensions: + - .agda + +Alloy: + type: programming # 'modeling' would be more appropiate + lexer: Text only + color: "#cc5c24" + extensions: + - .als ApacheConf: type: markup aliases: - apache - primary_extension: .apacheconf + extensions: + - .apacheconf Apex: type: programming lexer: Text only - primary_extension: .cls + extensions: + - .cls AppleScript: type: programming aliases: - osascript - primary_extension: .applescript extensions: + - .applescript - .scpt interpreters: - osascript @@ -111,24 +121,33 @@ Arc: type: programming color: "#ca2afe" lexer: Text only - primary_extension: .arc + extensions: + - .arc Arduino: type: programming color: "#bd79d1" lexer: C++ - primary_extension: .ino + extensions: + - .ino AsciiDoc: type: prose lexer: Text only ace_mode: asciidoc wrap: true - primary_extension: .asciidoc extensions: + - .asciidoc - .adoc - .asc +AspectJ: + type: programming + lexer: AspectJ + color: "#1957b0" + extensions: + - .aj + Assembly: type: programming lexer: NASM @@ -136,11 +155,14 @@ Assembly: search_term: nasm aliases: - nasm - primary_extension: .asm + extensions: + - .asm + - .inc Augeas: type: programming - primary_extension: .aug + extensions: + - .aug AutoHotkey: type: programming @@ -148,7 +170,8 @@ AutoHotkey: color: "#6594b9" aliases: - ahk - primary_extension: .ahk + extensions: + - .ahk AutoIt: type: programming @@ -157,13 +180,14 @@ AutoIt: - au3 - AutoIt3 - AutoItScript - primary_extension: .au3 + extensions: + - .au3 Awk: type: programming lexer: Awk - primary_extension: .awk extensions: + - .awk - .auk - .gawk - .mawk @@ -180,54 +204,60 @@ Batchfile: search_term: bat aliases: - bat - primary_extension: .bat extensions: + - .bat - .cmd Befunge: - primary_extension: .befunge + extensions: + - .befunge BlitzBasic: type: programming aliases: - blitzplus - blitz3d - primary_extension: .bb extensions: + - .bb - .decls BlitzMax: - primary_extension: .bmx + extensions: + - .bmx Bluespec: type: programming lexer: verilog - primary_extension: .bsv + extensions: + - .bsv Boo: type: programming color: "#d4bec1" - primary_extension: .boo + extensions: + - .boo Brainfuck: - primary_extension: .b extensions: + - .b - .bf Brightscript: type: programming lexer: Text only - primary_extension: .brs + extensions: + - .brs Bro: type: programming - primary_extension: .bro + extensions: + - .bro C: type: programming color: "#555" - primary_extension: .c extensions: + - .c - .cats - .w @@ -238,8 +268,8 @@ C#: color: "#5a25a2" aliases: - csharp - primary_extension: .cs extensions: + - .cs - .cshtml - .csx @@ -250,8 +280,8 @@ C++: color: "#f34b7d" aliases: - cpp - primary_extension: .cpp extensions: + - .cpp - .C - .c++ - .cc @@ -261,13 +291,16 @@ C++: - .hh - .hpp - .hxx + - .inl - .tcc - .tpp + - .ipp C-ObjDump: type: data lexer: c-objdump - primary_extension: .c-objdump + extensions: + - .c-objdump C2hs Haskell: type: programming @@ -275,24 +308,26 @@ C2hs Haskell: group: Haskell aliases: - c2hs - primary_extension: .chs + extensions: + - .chs CLIPS: type: programming lexer: Text only - primary_extension: .clp + extensions: + - .clp CMake: - primary_extension: .cmake extensions: + - .cmake - .cmake.in filenames: - CMakeLists.txt COBOL: type: programming - primary_extension: .cob extensions: + - .cob - .cbl - .ccp - .cobol @@ -300,42 +335,44 @@ COBOL: CSS: ace_mode: css - color: "#1f085e" - primary_extension: .css + color: "#563d7c" + extensions: + - .css Ceylon: type: programming lexer: Ceylon - primary_extension: .ceylon + extensions: + - .ceylon ChucK: lexer: Java - primary_extension: .ck + extensions: + - .ck Cirru: type: programming color: "#aaaaff" - primary_extension: .cirru # ace_mode: cirru # lexer: Cirru lexer: Text only extensions: - - .cr + - .cirru Clean: type: programming color: "#3a81ad" lexer: Text only - primary_extension: .icl extensions: + - .icl - .dcl Clojure: type: programming ace_mode: clojure color: "#db5855" - primary_extension: .clj extensions: + - .clj - .cl2 - .cljc - .cljs @@ -353,8 +390,8 @@ CoffeeScript: aliases: - coffee - coffee-script - primary_extension: .coffee extensions: + - .coffee - ._coffee - .cson - .iced @@ -371,8 +408,8 @@ ColdFusion: search_term: cfm aliases: - cfm - primary_extension: .cfm extensions: + - .cfm - .cfc Common Lisp: @@ -380,8 +417,8 @@ Common Lisp: color: "#3fb68b" aliases: - lisp - primary_extension: .lisp extensions: + - .lisp - .asd - .cl - .lsp @@ -394,15 +431,24 @@ Common Lisp: - clisp - ecl +Component Pascal: + type: programming + lexer: Delphi + color: "#b0ce4e" + extensions: + - .cp + - .cps + Coq: type: programming - primary_extension: .coq + extensions: + - .coq Cpp-ObjDump: type: data lexer: cpp-objdump - primary_extension: .cppobjdump extensions: + - .cppobjdump - .c++objdump - .cxx-objdump @@ -410,123 +456,156 @@ Creole: type: prose lexer: Text only wrap: true - primary_extension: .creole + extensions: + - .creole Crystal: type: programming lexer: Ruby - primary_extension: .cr + extensions: + - .cr ace_mode: ruby Cucumber: lexer: Gherkin - primary_extension: .feature + extensions: + - .feature Cuda: + type: programming lexer: CUDA - primary_extension: .cu extensions: + - .cu - .cuh Cython: type: programming group: Python - primary_extension: .pyx extensions: + - .pyx - .pxd - .pxi D: type: programming color: "#fcd46d" - primary_extension: .d extensions: + - .d - .di D-ObjDump: type: data lexer: d-objdump - primary_extension: .d-objdump + extensions: + - .d-objdump DM: type: programming color: "#075ff1" lexer: C++ - primary_extension: .dm + extensions: + - .dm aliases: - byond DOT: - type: programming + type: data lexer: Text only - primary_extension: .dot extensions: + - .dot - .gv Darcs Patch: search_term: dpatch aliases: - dpatch - primary_extension: .darcspatch extensions: + - .darcspatch - .dpatch Dart: type: programming color: "#98BAD6" - primary_extension: .dart + extensions: + - .dart DCPU-16 ASM: type: programming lexer: dasm16 - primary_extension: .dasm16 extensions: + - .dasm16 - .dasm aliases: - dasm16 Diff: - primary_extension: .diff + extensions: + - .diff + +Dogescript: + type: programming + lexer: Text only + color: "#cca760" + extensions: + - .djs Dylan: type: programming color: "#3ebc27" - primary_extension: .dylan extensions: + - .dylan - .intr - .lid +E: + type: programming + color: "#ccce35" + lexer: Text only + extensions: + - .E + Ecere Projects: type: data group: JavaScript lexer: JSON - primary_extension: .epj + extensions: + - .epj ECL: type: programming color: "#8a1267" - primary_extension: .ecl lexer: ECL extensions: + - .ecl - .eclxml +Eagle: + type: markup + color: "#3994bc" + lexer: XML + extensions: + - .sch + - .brd + Eiffel: type: programming lexer: Text only color: "#946d57" - primary_extension: .e + extensions: + - .e Elixir: type: programming color: "#6e4a7e" - primary_extension: .ex extensions: + - .ex - .exs Elm: type: programming lexer: Haskell - primary_extension: .elm + extensions: + - .elm Emacs Lisp: type: programming @@ -535,17 +614,17 @@ Emacs Lisp: aliases: - elisp - emacs - primary_extension: .el filenames: - .emacs extensions: + - .el - .emacs Erlang: type: programming color: "#0faf8d" - primary_extension: .erl extensions: + - .erl - .hrl F#: @@ -555,25 +634,25 @@ F#: search_term: fsharp aliases: - fsharp - primary_extension: .fs extensions: + - .fs - .fsi - .fsx FLUX: type: programming color: "#33CCFF" - primary_extension: .fx lexer: Text only extensions: + - .fx - .flux FORTRAN: type: programming lexer: Fortran color: "#4d41b1" - primary_extension: .f90 extensions: + - .f90 - .F - .F03 - .F08 @@ -593,7 +672,8 @@ FORTRAN: Factor: type: programming color: "#636746" - primary_extension: .factor + extensions: + - .factor filenames: - .factor-rc - .factor-boot-rc @@ -601,85 +681,146 @@ Factor: Fancy: type: programming color: "#7b9db4" - primary_extension: .fy extensions: + - .fy - .fancypack filenames: - Fakefile - + Fantom: type: programming color: "#dbded5" - primary_extension: .fan + extensions: + - .fan Forth: type: programming - primary_extension: .fth color: "#341708" lexer: Text only extensions: + - .fth - .4th +Frege: + type: programming + color: "#00cafe" + lexer: Haskell + extensions: + - .fr + +Game Maker Language: + type: programming + color: "#8ad353" + lexer: JavaScript + extensions: + - .gml + +GAMS: + type: programming + lexer: Text only + extensions: + - .gms + +GAP: + type: programming + lexer: Text only + extensions: + - .g + - .gap + - .gd + - .gi + GAS: type: programming group: Assembly - primary_extension: .s extensions: + - .s - .S GLSL: group: C type: programming - primary_extension: .glsl extensions: + - .glsl - .fp - .frag + - .fshader - .geom - .glslv + - .gshader - .shader - .vert + - .vshader Genshi: - primary_extension: .kid + extensions: + - .kid Gentoo Ebuild: group: Shell lexer: Bash - primary_extension: .ebuild + extensions: + - .ebuild Gentoo Eclass: group: Shell lexer: Bash - primary_extension: .eclass + extensions: + - .eclass Gettext Catalog: search_term: pot searchable: false aliases: - pot - primary_extension: .po extensions: + - .po - .pot Glyph: type: programming color: "#e4cc98" lexer: Tcl - primary_extension: .glf + extensions: + - .glf + +Gnuplot: + type: programming + color: "#f0a9f0" + lexer: Gnuplot + extensions: + - .gp + - .gnu + - .gnuplot + - .plot + - .plt Go: type: programming - color: "#a89b4d" - primary_extension: .go + color: "#375eab" + extensions: + - .go Gosu: type: programming color: "#82937f" - primary_extension: .gs + extensions: + - .gs + +Grammatical Framework: + type: programming + lexer: Haskell + aliases: + - gf + wrap: false + extensions: + - .gf + searchable: true + color: "#ff0000" Groff: - primary_extension: .man extensions: + - .man - '.1' - '.2' - '.3' @@ -692,7 +833,11 @@ Groovy: type: programming ace_mode: groovy color: "#e69f56" - primary_extension: .groovy + extensions: + - .groovy + - .grt + - .gtpl + - .gvy interpreters: - groovy @@ -701,27 +846,28 @@ Groovy Server Pages: lexer: Java Server Page aliases: - gsp - primary_extension: .gsp + extensions: + - .gsp HTML: type: markup ace_mode: html aliases: - xhtml - primary_extension: .html extensions: + - .html - .htm - - .xhtml - .html.hl + - .st + - .xhtml HTML+Django: type: markup group: HTML lexer: HTML+Django/Jinja - primary_extension: .mustache # TODO: This is incorrect extensions: - - .jinja - .mustache + - .jinja HTML+ERB: type: markup @@ -729,8 +875,8 @@ HTML+ERB: lexer: RHTML aliases: - erb - primary_extension: .erb extensions: + - .erb - .erb.deface - .html.erb - .html.erb.deface @@ -738,25 +884,27 @@ HTML+ERB: HTML+PHP: type: markup group: HTML - primary_extension: .phtml + extensions: + - .phtml HTTP: type: data - primary_extension: .http + extensions: + - .http Haml: group: HTML type: markup - primary_extension: .haml extensions: + - .haml - .haml.deface - .html.haml.deface Handlebars: type: markup lexer: Text only - primary_extension: .handlebars extensions: + - .handlebars - .hbs - .html.handlebars - .html.hbs @@ -765,21 +913,22 @@ Harbour: type: programming lexer: Text only color: "#0e60e3" - primary_extension: .hb + extensions: + - .hb Haskell: type: programming color: "#29b544" - primary_extension: .hs extensions: + - .hs - .hsc Haxe: type: programming ace_mode: haxe - color: "#346d51" - primary_extension: .hx + color: "#f7941e" extensions: + - .hx - .hxsl Hy: @@ -787,13 +936,15 @@ Hy: lexer: Clojure ace_mode: clojure color: "#7891b1" - primary_extension: .hy + extensions: + - .hy IDL: type: programming lexer: Text only color: "#e3592c" - primary_extension: .pro + extensions: + - .pro INI: type: data @@ -801,17 +952,30 @@ INI: - .ini - .prefs - .properties - primary_extension: .ini + +Inno Setup: + extensions: + - .iss + lexer: Text only Idris: type: programming lexer: Text only - primary_extension: .idr extensions: + - .idr - .lidr +Inform 7: + type: programming + lexer: Text only + wrap: true + extensions: + - .ni + - .i7x + Inno Setup: - primary_extension: .iss + extensions: + - .iss lexer: Text only IRC log: @@ -819,39 +983,49 @@ IRC log: search_term: irc aliases: - irc - primary_extension: .irclog extensions: + - .irclog - .weechatlog Io: type: programming color: "#a9188d" - primary_extension: .io + extensions: + - .io Ioke: type: programming color: "#078193" - primary_extension: .ik + extensions: + - .ik + +Isabelle: + type: programming + lexer: Text only + color: "#fdcd00" + extensions: + - .thy J: type: programming lexer: Text only - primary_extension: .ijs + extensions: + - .ijs JSON: type: data group: JavaScript ace_mode: json searchable: false - primary_extension: .json extensions: + - .json - .sublime-keymap - - .sublime_metrics - .sublime-mousemap - .sublime-project - - .sublime_session - .sublime-settings - .sublime-workspace + - .sublime_metrics + - .sublime_session filenames: - .jshintrc - composer.lock @@ -859,25 +1033,36 @@ JSON: JSON5: type: data lexer: JavaScript - primary_extension: .json5 + extensions: + - .json5 JSONLD: type: data group: JavaScript ace_mode: json lexer: JavaScript - primary_extension: .jsonld + extensions: + - .jsonld + +JSONiq: + type: programming + ace_mode: jsoniq + lexer: XQuery + extensions: + - .jq Jade: group: HTML type: markup - primary_extension: .jade + extensions: + - .jade Java: type: programming ace_mode: java color: "#b07219" - primary_extension: .java + extensions: + - .java Java Server Pages: group: Java @@ -885,20 +1070,22 @@ Java Server Pages: search_term: jsp aliases: - jsp - primary_extension: .jsp + extensions: + - .jsp JavaScript: type: programming ace_mode: javascript - color: "#f15501" + color: "#f1e05a" aliases: - js - node - primary_extension: .js extensions: + - .js - ._js - .bones - .es6 + - .frag - .jake - .jsfl - .jsm @@ -910,59 +1097,87 @@ JavaScript: - .ssjs filenames: - Jakefile + interpreters: + - node Julia: type: programming - primary_extension: .jl + extensions: + - .jl color: "#a270ba" KRL: lexer: Text only type: programming color: "#f5c800" - primary_extension: .krl + extensions: + - .krl + +Kit: + type: markup + lexer: HTML + ace_mode: html + extensions: + - .kit Kotlin: type: programming - primary_extension: .kt extensions: + - .kt - .ktm - .kts LFE: type: programming - primary_extension: .lfe + extensions: + - .lfe color: "#004200" lexer: Common Lisp group: Erlang LLVM: - primary_extension: .ll + extensions: + - .ll Lasso: type: programming lexer: Lasso color: "#2584c3" - primary_extension: .lasso + extensions: + - .lasso + +Latte: + type: markup + color: "#A8FF97" + group: HTML + lexer: Smarty + extensions: + - .latte Less: type: markup group: CSS lexer: CSS - primary_extension: .less + extensions: + - .less LilyPond: lexer: Text only - primary_extension: .ly extensions: + - .ly - .ily +Liquid: + type: markup + lexer: Text only + extensions: + - .liquid + Literate Agda: type: programming group: Agda - primary_extension: .lagda extensions: - - .lagda + - .lagda Literate CoffeeScript: type: programming @@ -973,7 +1188,8 @@ Literate CoffeeScript: search_term: litcoffee aliases: - litcoffee - primary_extension: .litcoffee + extensions: + - .litcoffee Literate Haskell: type: programming @@ -981,7 +1197,8 @@ Literate Haskell: search_term: lhs aliases: - lhs - primary_extension: .lhs + extensions: + - .lhs LiveScript: type: programming @@ -989,28 +1206,29 @@ LiveScript: color: "#499886" aliases: - ls - primary_extension: .ls extensions: + - .ls - ._ls filenames: - Slakefile Logos: type: programming - primary_extension: .xm + extensions: + - .xm Logtalk: type: programming - primary_extension: .lgt extensions: + - .lgt - .logtalk Lua: type: programming ace_mode: lua color: "#fa1fa1" - primary_extension: .lua extensions: + - .lua - .nse - .rbxs interpreters: @@ -1021,17 +1239,23 @@ M: lexer: Common Lisp aliases: - mumps - primary_extension: .mumps extensions: + - .mumps - .m +MTML: + type: markup + lexer: HTML + color: "#0095d9" + extensions: + - .mtml + Makefile: aliases: - make extensions: - .mak - .mk - primary_extension: .mak filenames: - makefile - Makefile @@ -1040,8 +1264,8 @@ Makefile: - make Mako: - primary_extension: .mako extensions: + - .mako - .mao Markdown: @@ -1049,10 +1273,11 @@ Markdown: lexer: Text only ace_mode: markdown wrap: true - primary_extension: .md extensions: + - .md - .markdown - .mkd + - .mkdn - .mkdown - .ron @@ -1061,12 +1286,21 @@ Mask: lexer: SCSS color: "#f97732" ace_mode: scss - primary_extension: .mask + extensions: + - .mask + +Mathematica: + type: programming + extensions: + - .mathematica + lexer: Text only Matlab: type: programming color: "#bb92ac" - primary_extension: .matlab + extensions: + - .matlab + - .m Max: type: programming @@ -1076,8 +1310,8 @@ Max: - max/msp - maxmsp search_term: max/msp - primary_extension: .maxpat extensions: + - .maxpat - .maxhelp - .maxproj - .mxt @@ -1087,19 +1321,30 @@ MediaWiki: type: prose lexer: Text only wrap: true - primary_extension: .mediawiki + extensions: + - .mediawiki + +Mercury: + type: programming + color: "#abcdef" + lexer: Prolog + ace_mode: prolog + extensions: + - .m + - .moo MiniD: # Legacy searchable: false - primary_extension: .minid # Dummy extension + extensions: + - .minid # Dummy extension Mirah: type: programming lexer: Ruby search_term: ruby color: "#c7a938" - primary_extension: .druby extensions: + - .druby - .duby - .mir - .mirah @@ -1107,43 +1352,52 @@ Mirah: Monkey: type: programming lexer: Monkey - primary_extension: .monkey + extensions: + - .monkey Moocode: + type: programming lexer: MOOCode - primary_extension: .moo + extensions: + - .moo MoonScript: type: programming - primary_extension: .moon + extensions: + - .moon Myghty: - primary_extension: .myt + extensions: + - .myt NSIS: - primary_extension: .nsi + extensions: + - .nsi Nemerle: type: programming color: "#0d3c6e" - primary_extension: .n + extensions: + - .n NetLogo: type: programming lexer: Common Lisp color: "#ff2b2b" - primary_extension: .nlogo + extensions: + - .nlogo Nginx: type: markup lexer: Nginx configuration file - primary_extension: .nginxconf + extensions: + - .nginxconf Nimrod: type: programming color: "#37775b" - primary_extension: .nim extensions: + - .nim - .nimrod Nu: @@ -1152,14 +1406,15 @@ Nu: color: "#c9df40" aliases: - nush - primary_extension: .nu + extensions: + - .nu filenames: - Nukefile NumPy: group: Python - primary_extension: .numpy extensions: + - .numpy - .numpyw - .numsc @@ -1167,8 +1422,8 @@ OCaml: type: programming ace_mode: ocaml color: "#3be133" - primary_extension: .ml extensions: + - .ml - .eliomi - .ml4 - .mli @@ -1178,7 +1433,8 @@ OCaml: ObjDump: type: data lexer: objdump - primary_extension: .objdump + extensions: + - .objdump Objective-C: type: programming @@ -1186,7 +1442,15 @@ Objective-C: aliases: - obj-c - objc - primary_extension: .m + extensions: + - .m + +Objective-C++: + type: programming + color: "#4886FC" + aliases: + - obj-c++ + - objc++ extensions: - .mm @@ -1195,26 +1459,28 @@ Objective-J: color: "#ff0c5a" aliases: - obj-j - primary_extension: .j extensions: + - .j - .sj Omgrofl: type: programming - primary_extension: .omgrofl + extensions: + - .omgrofl color: "#cabbff" lexer: Text only Opa: type: programming - primary_extension: .opa + extensions: + - .opa OpenCL: type: programming group: C lexer: C - primary_extension: .cl extensions: + - .cl - .opencl OpenEdge ABL: @@ -1223,32 +1489,44 @@ OpenEdge ABL: - progress - openedge - abl - primary_extension: .p + extensions: + - .p Org: type: prose lexer: Text only wrap: true - primary_extension: .org + extensions: + - .org + +Ox: + type: programming + lexer: Text only + extensions: + - .ox + - .oxh + - .oxo Oxygene: type: programming lexer: Text only color: "#5a63a3" - primary_extension: .oxygene + extensions: + - .oxygene PAWN: type: programming lexer: C++ color: "#dbb284" - primary_extension: .pwn + extensions: + - .pwn PHP: type: programming ace_mode: php - color: "#6e03c1" - primary_extension: .php + color: "#4F5D95" extensions: + - .php - .aw - .ctp - .php3 @@ -1258,11 +1536,19 @@ PHP: filenames: - Phakefile +Pan: + type: programming + lexer: Text only + color: '#cc0000' + extensions: + - .pan + Parrot: type: programming color: "#f3ca0a" lexer: Text only - primary_extension: .parrot # Dummy extension + extensions: + - .parrot # Dummy extension Parrot Internal Representation: group: Parrot @@ -1270,7 +1556,8 @@ Parrot Internal Representation: lexer: Text only aliases: - pir - primary_extension: .pir + extensions: + - .pir Parrot Assembly: group: Parrot @@ -1278,14 +1565,15 @@ Parrot Assembly: lexer: Text only aliases: - pasm - primary_extension: .pasm + extensions: + - .pasm Pascal: type: programming lexer: Delphi color: "#b0ce4e" - primary_extension: .pas extensions: + - .pas - .dfm - .lpr @@ -1293,8 +1581,8 @@ Perl: type: programming ace_mode: perl color: "#0298c3" - primary_extension: .pl extensions: + - .pl - .PL - .perl - .ph @@ -1308,8 +1596,8 @@ Perl: Perl6: type: programming color: "#0298c3" - primary_extension: .p6 extensions: + - .p6 - .6pl - .6pm - .nqp @@ -1322,8 +1610,8 @@ Pike: type: programming color: "#066ab2" lexer: C - primary_extension: .pike extensions: + - .pike - .pmod Pod: @@ -1331,18 +1619,20 @@ Pod: lexer: Text only ace_mode: perl wrap: true - primary_extension: .pod + extensions: + - .pod PogoScript: type: programming color: "#d80074" lexer: Text only - primary_extension: .pogo + extensions: + - .pogo PostScript: type: markup - primary_extension: .ps extensions: + - .ps - .eps PowerShell: @@ -1350,8 +1640,8 @@ PowerShell: ace_mode: powershell aliases: - posh - primary_extension: .ps1 extensions: + - .ps1 - .psd1 - .psm1 @@ -1359,27 +1649,35 @@ Processing: type: programming lexer: Java color: "#2779ab" - primary_extension: .pde + extensions: + - .pde Prolog: type: programming color: "#74283c" - primary_extension: .prolog extensions: + - .prolog - .ecl - .pl +Propeller Spin: + type: programming + lexer: Text only + color: "#2b446d" + extensions: + - .spin + Protocol Buffer: type: markup aliases: - protobuf - Protocol Buffers - primary_extension: .proto + extensions: + - .proto Puppet: type: programming color: "#cc5555" - primary_extension: .pp extensions: - .pp filenames: @@ -1389,16 +1687,26 @@ Pure Data: type: programming color: "#91de79" lexer: Text only - primary_extension: .pd + extensions: + - .pd + +PureScript: + type: programming + color: "#bcdc53" + lexer: Haskell + extensions: + - .purs Python: type: programming ace_mode: python color: "#3581ba" - primary_extension: .py extensions: + - .py - .gyp - .lmi + - .pyde + - .pyp - .pyt - .pyw - .wsgi @@ -1415,12 +1723,14 @@ Python traceback: group: Python lexer: Python Traceback searchable: false - primary_extension: .pytb + extensions: + - .pytb QML: type: markup color: "#44a51c" - primary_extension: .qml + extensions: + - .qml R: type: programming @@ -1428,9 +1738,12 @@ R: lexer: S aliases: - R - primary_extension: .r + - Rscript extensions: + - .r - .R + - .Rd + - .rd - .rsx filenames: - .Rprofile @@ -1442,13 +1755,14 @@ RDoc: lexer: Text only ace_mode: rdoc wrap: true - primary_extension: .rdoc + extensions: + - .rdoc REALbasic: type: programming lexer: VB.net - primary_extension: .rbbas extensions: + - .rbbas - .rbfrm - .rbmnu - .rbres @@ -1458,23 +1772,24 @@ REALbasic: RHTML: type: markup group: HTML - primary_extension: .rhtml + extensions: + - .rhtml RMarkdown: type: prose lexer: Text only wrap: true ace_mode: markdown - primary_extension: .rmd extensions: + - .rmd - .Rmd Racket: type: programming lexer: Racket color: "#ae17ff" - primary_extension: .rkt extensions: + - .rkt - .rktd - .rktl @@ -1482,30 +1797,43 @@ Ragel in Ruby Host: type: programming lexer: Ragel in Ruby Host color: "#ff9c2e" - primary_extension: .rl + extensions: + - .rl Raw token data: search_term: raw aliases: - raw - primary_extension: .raw + extensions: + - .raw Rebol: type: programming lexer: REBOL color: "#358a5b" - primary_extension: .rebol extensions: + - .reb + - .r - .r2 - .r3 + - .rebol + +Red: + type: programming + lexer: Text only + color: "#ee0000" + extensions: + - .red + - .reds Redcode: - primary_extension: .cw + extensions: + - .cw RobotFramework: type: programming - primary_extension: .robot - # extensions: + extensions: + - .robot # - .txt Rouge: @@ -1513,7 +1841,8 @@ Rouge: lexer: Clojure ace_mode: clojure color: "#cc0088" - primary_extension: .rg + extensions: + - .rg Ruby: type: programming @@ -1525,8 +1854,8 @@ Ruby: - rake - rb - rbx - primary_extension: .rb extensions: + - .rb - .builder - .gemspec - .god @@ -1544,59 +1873,84 @@ Ruby: filenames: - Appraisals - Berksfile + - Buildfile - Gemfile - Gemfile.lock - Guardfile - Podfile - Thorfile - Vagrantfile + - buildfile Rust: type: programming color: "#dea584" - primary_extension: .rs + extensions: + - .rs + +SAS: + type: programming + color: "#1E90FF" + lexer: Text only + extensions: + - .sas SCSS: type: markup group: CSS ace_mode: scss - primary_extension: .scss + extensions: + - .scss SQL: type: data ace_mode: sql - searchable: false - primary_extension: .sql + extensions: + - .sql + - .prc + - .tab + - .udf + - .viw + +STON: + type: data + group: Smalltalk + lexer: JSON + extensions: + - .ston Sage: type: programming lexer: Python group: Python - primary_extension: .sage + extensions: + - .sage Sass: type: markup group: CSS - primary_extension: .sass + extensions: + - .sass Scala: type: programming ace_mode: scala color: "#7dd3b0" - primary_extension: .scala extensions: + - .scala - .sc Scaml: group: HTML type: markup - primary_extension: .scaml + extensions: + - .scaml Scheme: type: programming color: "#1e4aec" - primary_extension: .scm extensions: + - .scm - .sld - .sls - .ss @@ -1608,13 +1962,15 @@ Scheme: Scilab: type: programming - primary_extension: .sci + extensions: + - .sci Self: type: programming color: "#0579aa" lexer: Text only - primary_extension: .self + extensions: + - .self Shell: type: programming @@ -1625,8 +1981,8 @@ Shell: - sh - bash - zsh - primary_extension: .sh extensions: + - .sh - .bats - .tmux interpreters: @@ -1636,72 +1992,133 @@ Shell: filenames: - Dockerfile +ShellSession: + type: programming + lexer: Bash Session + extensions: + - .sh-session + Shen: type: programming color: "#120F14" lexer: Text only - primary_extension: .shen + extensions: + - .shen Slash: type: programming color: "#007eff" - primary_extension: .sl + extensions: + - .sl + +Slim: + group: HTML + type: markup + lexer: Slim + color: "#ff8877" + extensions: + - .slim Smalltalk: type: programming color: "#596706" - primary_extension: .st + extensions: + - .st Smarty: - primary_extension: .tpl + extensions: + - .tpl + +SourcePawn: + type: programming + color: "#f69e1d" + aliases: + - sourcemod + extensions: + - .sp Squirrel: type: programming lexer: C++ - primary_extension: .nut + extensions: + - .nut Standard ML: type: programming color: "#dc566d" aliases: - sml - primary_extension: .sml extensions: + - .ML - .fun + - .sml + +Stata: + type: programming + lexer: Text only + extensions: + - .do + - .ado + - .doh + - .ihlp + - .mata + - .matah + - .sthlp Stylus: type: markup group: CSS lexer: Text only - primary_extension: .styl + extensions: + - .styl SuperCollider: type: programming color: "#46390b" lexer: Text only - primary_extension: .scd + extensions: + - .scd + +Swift: + type: programming + lexer: Swift + color: "#ffac45" + extensions: + - .swift + +SystemVerilog: + type: programming + color: "#343761" + lexer: systemverilog + extensions: + - .sv + - .svh + - .vh TOML: type: data - primary_extension: .toml + extensions: + - .toml TXL: type: programming lexer: Text only - primary_extension: .txl + extensions: + - .txl Tcl: type: programming color: "#e4cc98" - primary_extension: .tcl extensions: + - .tcl - .adp + - .tm Tcsh: type: programming group: Shell - primary_extension: .tcsh extensions: + - .tcsh - .csh TeX: @@ -1711,8 +2128,8 @@ TeX: wrap: true aliases: - latex - primary_extension: .tex extensions: + - .tex - .aux - .bib - .cls @@ -1727,35 +2144,39 @@ TeX: Tea: type: markup - primary_extension: .tea + extensions: + - .tea Textile: type: prose lexer: Text only ace_mode: textile wrap: true - primary_extension: .textile + extensions: + - .textile Turing: type: programming color: "#45f715" lexer: Text only - primary_extension: .t extensions: + - .t - .tu Twig: type: markup group: PHP lexer: HTML+Django/Jinja - primary_extension: .twig + extensions: + - .twig TypeScript: type: programming color: "#31859c" aliases: - ts - primary_extension: .ts + extensions: + - .ts Unified Parallel C: type: programming @@ -1763,20 +2184,30 @@ Unified Parallel C: lexer: C ace_mode: c_cpp color: "#755223" - primary_extension: .upc + extensions: + - .upc UnrealScript: type: programming color: "#a54c4d" lexer: Java - primary_extension: .uc + extensions: + - .uc + +VCL: + type: programming + lexer: Perl + ace_mode: perl + color: "#0298c3" + extensions: + - .vcl VHDL: type: programming lexer: vhdl color: "#543978" - primary_extension: .vhdl extensions: + - .vhdl - .vhd - .vhf - .vhi @@ -1788,16 +2219,16 @@ VHDL: Vala: type: programming color: "#ee7d06" - primary_extension: .vala extensions: + - .vala - .vapi Verilog: type: programming lexer: verilog color: "#848bf3" - primary_extension: .v extensions: + - .v - .veo VimL: @@ -1806,7 +2237,8 @@ VimL: search_term: vim aliases: - vim - primary_extension: .vim + extensions: + - .vim filenames: - .vimrc - vimrc @@ -1816,8 +2248,8 @@ Visual Basic: type: programming lexer: VB.net color: "#945db7" - primary_extension: .vb extensions: + - .vb - .bas - .frm - .frx @@ -1829,12 +2261,14 @@ Volt: type: programming lexer: D color: "#0098db" - primary_extension: .volt + extensions: + - .volt XC: type: programming lexer: C - primary_extension: .xc + extensions: + - .xc XML: type: markup @@ -1843,21 +2277,28 @@ XML: - rss - xsd - wsdl - primary_extension: .xml extensions: + - .xml - .axml - .ccxml - .clixml - .cproject + - .csproj + - .ct - .dita - .ditamap - .ditaval + - .filters + - .fsproj - .glade - .grxml - .jelly - .kml - .launch - .mxml + - .nproj + - .nuspec + - .osm - .plist - .pluginspec - .ps1xml @@ -1868,6 +2309,7 @@ XML: - .scxml - .srdf - .svg + - .targets - .tmCommand - .tmLanguage - .tmPreferences @@ -1876,6 +2318,8 @@ XML: - .tml - .ui - .urdf + - .vbproj + - .vcxproj - .vxml - .wsdl - .wxi @@ -1898,15 +2342,15 @@ XML: XProc: type: programming lexer: XML - primary_extension: .xpl extensions: + - .xpl - .xproc XQuery: type: programming color: "#2700e2" - primary_extension: .xquery extensions: + - .xquery - .xq - .xql - .xqm @@ -1914,35 +2358,63 @@ XQuery: XS: lexer: C - primary_extension: .xs + extensions: + - .xs XSLT: type: programming aliases: - xsl - primary_extension: .xslt extensions: - - .xsl + - .xslt + - .xsl + +Xojo: + type: programming + lexer: VB.net + extensions: + - .xojo_code + - .xojo_menu + - .xojo_report + - .xojo_script + - .xojo_toolbar + - .xojo_window Xtend: type: programming - primary_extension: .xtend + extensions: + - .xtend YAML: type: data aliases: - yml - primary_extension: .yml extensions: + - .yml - .reek - .rviz - .yaml +Zephir: + type: programming + lexer: PHP + color: "#118f9e" + extensions: + - .zep + +Zimpl: + type: programming + lexer: Text only + extensions: + - .zimpl + - .zmpl + - .zpl + eC: type: programming search_term: ec - primary_extension: .ec extensions: + - .ec - .eh edn: @@ -1950,28 +2422,34 @@ edn: lexer: Clojure ace_mode: clojure color: "#db5855" - primary_extension: .edn + extensions: + - .edn fish: type: programming group: Shell lexer: Text only - primary_extension: .fish + extensions: + - .fish mupad: lexer: MuPAD - primary_extension: .mu + extensions: + - .mu nesC: type: programming color: "#ffce3b" - primary_extension: .nc + lexer: nesC + extensions: + - .nc ooc: type: programming lexer: Ooc color: "#b0b77e" - primary_extension: .ooc + extensions: + - .ooc reStructuredText: type: prose @@ -1979,8 +2457,8 @@ reStructuredText: search_term: rst aliases: - rst - primary_extension: .rst extensions: + - .rst - .rest wisp: @@ -1988,10 +2466,12 @@ wisp: lexer: Clojure ace_mode: clojure color: "#7582D1" - primary_extension: .wisp + extensions: + - .wisp xBase: type: programming lexer: Text only color: "#3a4040" - primary_extension: .prg + extensions: + - .prg diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 6d26388a..c5569e09 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -6,6 +6,9 @@ "Agda": [ ".agda" ], + "Alloy": [ + ".als" + ], "Apex": [ ".cls" ], @@ -20,6 +23,13 @@ ".asc", ".asciidoc" ], + "AspectJ": [ + ".aj" + ], + "Assembly": [ + ".asm", + ".inc" + ], "ATS": [ ".atxt", ".dats", @@ -54,7 +64,9 @@ ".cc", ".cpp", ".h", - ".hpp" + ".hpp", + ".inl", + ".ipp" ], "Ceylon": [ ".ceylon" @@ -81,14 +93,22 @@ ".coffee" ], "Common Lisp": [ + ".cl", ".lisp" ], + "Component Pascal": [ + ".cp", + ".cps" + ], "Coq": [ ".v" ], "Creole": [ ".creole" ], + "Crystal": [ + ".cr" + ], "CSS": [ ".css" ], @@ -105,6 +125,16 @@ "DM": [ ".dm" ], + "Dogescript": [ + ".djs" + ], + "E": [ + ".E" + ], + "Eagle": [ + ".brd", + ".sch" + ], "ECL": [ ".ecl" ], @@ -129,21 +159,46 @@ ".forth", ".fth" ], + "Frege": [ + ".fr" + ], + "Game Maker Language": [ + ".gml" + ], + "GAMS": [ + ".gms" + ], + "GAP": [ + ".g", + ".gd", + ".gi" + ], "GAS": [ ".s" ], "GLSL": [ ".fp", + ".frag", ".glsl" ], + "Gnuplot": [ + ".gnu", + ".gp" + ], "Gosu": [ ".gs", ".gst", ".gsx", ".vark" ], + "Grammatical Framework": [ + ".gf" + ], "Groovy": [ ".gradle", + ".grt", + ".gtpl", + ".gvy", ".script!" ], "Groovy Server Pages": [ @@ -156,6 +211,13 @@ ".handlebars", ".hbs" ], + "Haskell": [ + ".hs" + ], + "HTML": [ + ".html", + ".st" + ], "Hy": [ ".hy" ], @@ -166,9 +228,16 @@ "Idris": [ ".idr" ], + "Inform 7": [ + ".i7x", + ".ni" + ], "Ioke": [ ".ik" ], + "Isabelle": [ + ".thy" + ], "Jade": [ ".jade" ], @@ -176,6 +245,7 @@ ".java" ], "JavaScript": [ + ".frag", ".js", ".script!" ], @@ -186,12 +256,18 @@ "JSON5": [ ".json5" ], + "JSONiq": [ + ".jq" + ], "JSONLD": [ ".jsonld" ], "Julia": [ ".jl" ], + "Kit": [ + ".kit" + ], "Kotlin": [ ".kt" ], @@ -204,12 +280,18 @@ ".lasso9", ".ldml" ], + "Latte": [ + ".latte" + ], "Less": [ ".less" ], "LFE": [ ".lfe" ], + "Liquid": [ + ".liquid" + ], "Literate Agda": [ ".lagda" ], @@ -237,6 +319,12 @@ "Markdown": [ ".md" ], + "Mask": [ + ".mask" + ], + "Mathematica": [ + ".m" + ], "Matlab": [ ".m" ], @@ -248,12 +336,22 @@ "MediaWiki": [ ".mediawiki" ], + "Mercury": [ + ".m", + ".moo" + ], "Monkey": [ ".monkey" ], + "Moocode": [ + ".moo" + ], "MoonScript": [ ".moon" ], + "MTML": [ + ".mtml" + ], "Nemerle": [ ".n" ], @@ -275,6 +373,9 @@ ".h", ".m" ], + "Objective-C++": [ + ".mm" + ], "OCaml": [ ".eliom", ".ml" @@ -295,9 +396,17 @@ "Org": [ ".org" ], + "Ox": [ + ".ox", + ".oxh", + ".oxo" + ], "Oxygene": [ ".oxygene" ], + "Pan": [ + ".pan" + ], "Parrot Assembly": [ ".pasm" ], @@ -314,6 +423,7 @@ ".fcgi", ".pl", ".pm", + ".pod", ".script!", ".t" ], @@ -347,15 +457,25 @@ ".pl", ".prolog" ], + "Propeller Spin": [ + ".spin" + ], "Protocol Buffer": [ ".proto" ], + "PureScript": [ + ".purs" + ], "Python": [ ".py", + ".pyde", + ".pyp", ".script!" ], "R": [ ".R", + ".Rd", + ".r", ".rsx", ".script!" ], @@ -369,7 +489,15 @@ ".rdoc" ], "Rebol": [ - ".r" + ".r", + ".r2", + ".r3", + ".reb", + ".rebol" + ], + "Red": [ + ".red", + ".reds" ], "RMarkdown": [ ".rmd" @@ -387,6 +515,9 @@ "Rust": [ ".rs" ], + "SAS": [ + ".sas" + ], "Sass": [ ".sass", ".scss" @@ -417,23 +548,69 @@ ".sh", ".zsh" ], + "ShellSession": [ + ".sh-session" + ], + "Shen": [ + ".shen" + ], "Slash": [ ".sl" ], + "Slim": [ + ".slim" + ], + "Smalltalk": [ + ".st" + ], + "SourcePawn": [ + ".sp" + ], + "SQL": [ + ".prc", + ".sql", + ".tab", + ".udf", + ".viw" + ], "Squirrel": [ ".nut" ], "Standard ML": [ + ".ML", ".fun", ".sig", ".sml" ], + "Stata": [ + ".ado", + ".do", + ".doh", + ".ihlp", + ".mata", + ".matah", + ".sthlp" + ], + "STON": [ + ".ston" + ], "Stylus": [ ".styl" ], "SuperCollider": [ ".scd" ], + "Swift": [ + ".swift" + ], + "SystemVerilog": [ + ".sv", + ".svh", + ".vh" + ], + "Tcl": [ + ".tm" + ], "Tea": [ ".tea" ], @@ -452,6 +629,9 @@ "UnrealScript": [ ".uc" ], + "VCL": [ + ".vcl" + ], "Verilog": [ ".v" ], @@ -474,9 +654,26 @@ ], "XML": [ ".ant", + ".csproj", + ".filters", + ".fsproj", ".ivy", + ".nproj", + ".nuspec", + ".pluginspec", + ".targets", + ".vbproj", + ".vcxproj", ".xml" ], + "Xojo": [ + ".xojo_code", + ".xojo_menu", + ".xojo_report", + ".xojo_script", + ".xojo_toolbar", + ".xojo_window" + ], "XProc": [ ".xpl" ], @@ -488,6 +685,15 @@ ], "Xtend": [ ".xtend" + ], + "YAML": [ + ".yml" + ], + "Zephir": [ + ".zep" + ], + "Zimpl": [ + ".zmpl" ] }, "interpreters": { @@ -512,6 +718,9 @@ "Perl": [ "ack" ], + "R": [ + "expr-dist" + ], "Ruby": [ "Appraisals", "Capfile", @@ -549,10 +758,15 @@ ], "YAML": [ ".gemrc" + ], + "Zephir": [ + "exception.zep.c", + "exception.zep.h", + "exception.zep.php" ] }, - "tokens_total": 450556, - "languages_total": 548, + "tokens_total": 637830, + "languages_total": 828, "tokens": { "ABAP": { "*/**": 1, @@ -871,6 +1085,241 @@ "zero": 1, "Nat": 1 }, + "Alloy": { + "module": 3, + "examples/systems/file_system": 1, + "abstract": 2, + "sig": 20, + "Object": 10, + "{": 54, + "}": 60, + "Name": 2, + "File": 1, + "extends": 10, + "some": 3, + "d": 3, + "Dir": 8, + "|": 19, + "this": 14, + "in": 19, + "d.entries.contents": 1, + "entries": 3, + "set": 10, + "DirEntry": 2, + "parent": 3, + "lone": 6, + "this.": 4, + "@contents.": 1, + "@entries": 1, + "all": 16, + "e1": 2, + "e2": 2, + "e1.name": 1, + "e2.name": 1, + "@parent": 2, + "Root": 5, + "one": 8, + "no": 8, + "Cur": 1, + "name": 1, + "contents": 2, + "pred": 16, + "OneParent_buggyVersion": 2, + "-": 41, + "d.parent": 2, + "OneParent_correctVersion": 2, + "(": 12, + "&&": 2, + "contents.d": 1, + ")": 9, + "NoDirAliases": 3, + "o": 1, + "o.": 1, + "check": 6, + "for": 7, + "expect": 6, + "examples/systems/marksweepgc": 1, + "Node": 10, + "HeapState": 5, + "left": 3, + "right": 1, + "marked": 1, + "freeList": 1, + "clearMarks": 1, + "[": 82, + "hs": 16, + ".marked": 3, + ".right": 4, + "hs.right": 3, + "fun": 1, + "reachable": 1, + "n": 5, + "]": 80, + "+": 14, + "n.": 1, + "hs.left": 2, + "mark": 1, + "from": 2, + "hs.reachable": 1, + "setFreeList": 1, + ".freeList.*": 3, + ".left": 5, + "hs.marked": 1, + "GC": 1, + "root": 5, + "assert": 3, + "Soundness1": 2, + "h": 9, + "live": 3, + "h.reachable": 1, + "h.right": 1, + "Soundness2": 2, + ".reachable": 2, + "h.GC": 1, + ".freeList": 1, + "Completeness": 1, + "examples/systems/views": 1, + "open": 2, + "util/ordering": 1, + "State": 16, + "as": 2, + "so": 1, + "util/relation": 1, + "rel": 1, + "Ref": 19, + "t": 16, + "b": 13, + "v": 25, + "views": 2, + "when": 1, + "is": 1, + "view": 2, + "of": 3, + "type": 1, + "backing": 1, + "dirty": 3, + "contains": 1, + "refs": 7, + "that": 1, + "have": 1, + "been": 1, + "invalidated": 1, + "obj": 1, + "ViewType": 8, + "anyviews": 2, + "visualization": 1, + "ViewType.views": 1, + "Map": 2, + "keys": 3, + "map": 2, + "s": 6, + "Ref.map": 1, + "s.refs": 3, + "MapRef": 4, + "fact": 4, + "State.obj": 3, + "Iterator": 2, + "done": 3, + "lastRef": 2, + "IteratorRef": 5, + "Set": 2, + "elts": 2, + "SetRef": 5, + "KeySetView": 6, + "State.views": 1, + "IteratorView": 3, + "s.views": 2, + "handle": 1, + "possibility": 1, + "modifying": 1, + "an": 1, + "object": 1, + "and": 1, + "its": 1, + "at": 1, + "once": 1, + "*": 1, + "should": 1, + "we": 1, + "limit": 1, + "frame": 1, + "conds": 1, + "to": 1, + "non": 1, + "*/": 1, + "modifies": 5, + "pre": 15, + "post": 14, + "rs": 4, + "let": 5, + "vr": 1, + "pre.views": 8, + "mods": 3, + "rs.*vr": 1, + "r": 3, + "pre.refs": 6, + "pre.obj": 10, + "post.obj": 7, + "viewFrame": 4, + "post.dirty": 1, + "pre.dirty": 1, + "allocates": 5, + "&": 3, + "post.refs": 1, + ".map": 3, + ".elts": 3, + "dom": 1, + "<:>": 1, + "setRefs": 1, + "MapRef.put": 1, + "k": 5, + "none": 4, + "post.views": 4, + "SetRef.iterator": 1, + "iterRef": 4, + "i": 7, + "i.left": 3, + "i.done": 1, + "i.lastRef": 1, + "IteratorRef.remove": 1, + ".lastRef": 2, + "IteratorRef.next": 1, + "ref": 3, + "IteratorRef.hasNext": 1, + "s.obj": 1, + "zippishOK": 2, + "ks": 6, + "vs": 6, + "m": 4, + "ki": 2, + "vi": 2, + "s0": 4, + "so/first": 1, + "s1": 4, + "so/next": 7, + "s2": 6, + "s3": 4, + "s4": 4, + "s5": 4, + "s6": 4, + "s7": 2, + "precondition": 2, + "s0.dirty": 1, + "ks.iterator": 1, + "vs.iterator": 1, + "ki.hasNext": 1, + "vi.hasNext": 1, + "ki.this/next": 1, + "vi.this/next": 1, + "m.put": 1, + "ki.remove": 1, + "vi.remove": 1, + "State.dirty": 1, + "ViewType.pre.views": 2, + "but": 1, + "#s.obj": 1, + "<": 1 + }, "ApacheConf": { "ServerSignature": 1, "Off": 1, @@ -2048,6 +2497,1407 @@ ".Section": 1, "list": 1 }, + "AspectJ": { + "package": 2, + "com.blogspot.miguelinlas3.aspectj.cache": 1, + ";": 29, + "import": 5, + "java.util.Map": 2, + "java.util.WeakHashMap": 1, + "org.aspectj.lang.JoinPoint": 1, + "com.blogspot.miguelinlas3.aspectj.cache.marker.Cachable": 1, + "public": 6, + "aspect": 2, + "CacheAspect": 1, + "{": 11, + "pointcut": 3, + "cache": 3, + "(": 46, + "Cachable": 2, + "cachable": 5, + ")": 46, + "execution": 1, + "@Cachable": 2, + "*": 2, + "..": 1, + "&&": 2, + "@annotation": 1, + "Object": 15, + "around": 2, + "String": 3, + "evaluatedKey": 6, + "this.evaluateKey": 1, + "cachable.scriptKey": 1, + "thisJoinPoint": 1, + "if": 2, + "cache.containsKey": 1, + "System.out.println": 5, + "+": 7, + "return": 5, + "this.cache.get": 1, + "}": 11, + "value": 3, + "proceed": 2, + "cache.put": 1, + "protected": 2, + "evaluateKey": 1, + "key": 2, + "JoinPoint": 1, + "joinPoint": 1, + "//": 1, + "TODO": 1, + "add": 1, + "some": 1, + "smart": 1, + "staff": 1, + "to": 1, + "allow": 1, + "simple": 1, + "scripting": 1, + "in": 1, + "annotation": 1, + "Map": 3, + "": 2, + "new": 1, + "WeakHashMap": 1, + "aspects.caching": 1, + "abstract": 3, + "OptimizeRecursionCache": 2, + "@SuppressWarnings": 3, + "private": 1, + "_cache": 2, + "getCache": 2, + "operation": 4, + "o": 16, + "topLevelOperation": 4, + "cflowbelow": 1, + "before": 1, + "cachedValue": 4, + "_cache.get": 1, + "null": 1, + "after": 2, + "returning": 2, + "result": 3, + "_cache.put": 1, + "_cache.size": 1 + }, + "Assembly": { + ";": 20, + "flat": 4, + "assembler": 6, + "core": 2, + "Copyright": 4, + "(": 13, + "c": 4, + ")": 6, + "-": 87, + "Tomasz": 4, + "Grysztar.": 4, + "All": 4, + "rights": 4, + "reserved.": 4, + "xor": 52, + "eax": 510, + "mov": 1253, + "[": 2026, + "stub_size": 1, + "]": 2026, + "current_pass": 16, + "ax": 87, + "resolver_flags": 1, + "number_of_sections": 1, + "actual_fixups_size": 1, + "assembler_loop": 2, + "labels_list": 3, + "tagged_blocks": 23, + "additional_memory": 6, + "free_additional_memory": 2, + "additional_memory_end": 9, + "structures_buffer": 9, + "esi": 619, + "source_start": 1, + "edi": 250, + "code_start": 2, + "dword": 87, + "adjustment": 4, + "+": 232, + "addressing_space": 17, + "error_line": 16, + "counter": 13, + "format_flags": 2, + "number_of_relocations": 1, + "undefined_data_end": 4, + "file_extension": 1, + "next_pass_needed": 16, + "al": 1174, + "output_format": 3, + "adjustment_sign": 2, + "code_type": 106, + "call": 845, + "init_addressing_space": 6, + "pass_loop": 2, + "assemble_line": 3, + "jnc": 11, + "cmp": 1088, + "je": 485, + "pass_done": 2, + "sub": 64, + "h": 376, + "current_line": 24, + "jmp": 450, + "missing_end_directive": 7, + "close_pass": 1, + "check_symbols": 2, + "memory_end": 7, + "jae": 34, + "symbols_checked": 2, + "test": 95, + "byte": 549, + "jz": 107, + "symbol_defined_ok": 5, + "cx": 42, + "jne": 485, + "and": 50, + "not": 42, + "or": 194, + "use_prediction_ok": 5, + "jnz": 125, + "check_use_prediction": 2, + "use_misprediction": 3, + "check_next_symbol": 5, + "define_misprediction": 4, + "check_define_prediction": 2, + "add": 76, + "LABEL_STRUCTURE_SIZE": 1, + "next_pass": 3, + "assemble_ok": 2, + "error": 7, + "undefined_symbol": 2, + "error_confirmed": 3, + "error_info": 2, + "error_handler": 3, + "esp": 14, + "ret": 70, + "inc": 87, + "passes_limit": 3, + "code_cannot_be_generated": 1, + "create_addressing_space": 1, + "ebx": 336, + "Ah": 25, + "illegal_instruction": 48, + "Ch": 11, + "jbe": 11, + "out_of_memory": 19, + "ja": 28, + "lods": 366, + "assemble_instruction": 2, + "jb": 34, + "source_end": 2, + "define_label": 2, + "define_constant": 2, + "label_addressing_space": 2, + "Fh": 73, + "new_line": 2, + "code_type_setting": 2, + "segment_prefix": 2, + "instruction_assembled": 138, + "prefixed_instruction": 11, + "symbols_file": 4, + "continue_line": 8, + "line_assembled": 3, + "invalid_use_of_symbol": 17, + "reserved_word_used_as_symbol": 6, + "label_size": 5, + "make_label": 3, + "edx": 219, + "cl": 42, + "ebp": 49, + "ds": 21, + "sbb": 9, + "jp": 2, + "label_value_ok": 2, + "recoverable_overflow": 4, + "address_sign": 4, + "make_virtual_label": 2, + "xchg": 31, + "ch": 55, + "shr": 30, + "neg": 4, + "setnz": 5, + "ah": 229, + "finish_label": 2, + "setne": 14, + "finish_label_symbol": 2, + "b": 30, + "label_symbol_ok": 2, + "new_label": 2, + "symbol_already_defined": 3, + "btr": 2, + "jc": 28, + "requalified_label": 2, + "label_made": 4, + "push": 150, + "get_constant_value": 4, + "dl": 58, + "size_override": 7, + "get_value": 2, + "pop": 99, + "bl": 124, + "ecx": 153, + "constant_referencing_mode_ok": 2, + "value_type": 42, + "make_constant": 2, + "value_sign": 3, + "constant_symbol_ok": 2, + "symbol_identifier": 4, + "new_constant": 2, + "redeclare_constant": 2, + "requalified_constant": 2, + "make_addressing_space_label": 3, + "dx": 27, + "operand_size": 121, + "operand_prefix": 9, + "opcode_prefix": 30, + "rex_prefix": 9, + "vex_required": 2, + "vex_register": 1, + "immediate_size": 9, + "instruction_handler": 32, + "movzx": 13, + "word": 79, + "extra_characters_on_line": 8, + "clc": 11, + "dec": 30, + "stc": 9, + "org_directive": 1, + "invalid_argument": 28, + "invalid_value": 21, + "get_qword_value": 5, + "in_virtual": 2, + "org_space_ok": 2, + "close_virtual_addressing_space": 3, + "org_value_ok": 2, + "bts": 1, + "label_directive": 1, + "get_label_size": 2, + "label_size_ok": 2, + "get_free_label_value": 2, + "get_address_value": 3, + "bh": 34, + "bp": 2, + "shl": 17, + "bx": 8, + "make_free_label": 1, + "address_symbol": 2, + "load_directive": 1, + "load_size_ok": 2, + "value": 38, + "get_data_point": 3, + "value_loaded": 2, + "rep": 7, + "movs": 8, + "get_data_address": 5, + "addressing_space_unavailable": 3, + "symbol_out_of_scope": 1, + "get_addressing_space": 3, + "store_label_reference": 1, + "calculate_relative_offset": 2, + "data_address_type_ok": 2, + "adc": 9, + "bad_data_address": 3, + "store_directive": 1, + "sized_store": 2, + "get_byte_value": 23, + "store_value_ok": 2, + "undefined_data_start": 3, + "display_directive": 2, + "display_byte": 2, + "stos": 107, + "display_next": 2, + "show_display_buffer": 2, + "display_done": 3, + "display_messages": 2, + "skip_block": 2, + "display_block": 4, + "times_directive": 1, + "get_count_value": 6, + "zero_times": 3, + "times_argument_ok": 2, + "counter_limit": 7, + "times_loop": 2, + "stack_overflow": 2, + "stack_limit": 2, + "times_done": 2, + "skip_symbol": 5, + "virtual_directive": 3, + "virtual_at_current": 2, + "set_virtual": 2, + "allocate_structure_data": 5, + "find_structure_data": 6, + "scan_structures": 2, + "no_such_structure": 2, + "structure_data_found": 2, + "end_virtual": 2, + "unexpected_instruction": 18, + "remove_structure_data": 7, + "lea": 8, + "std": 2, + "cld": 2, + "addressing_space_closed": 2, + "virtual_byte_ok": 2, + "virtual_word_ok": 2, + "repeat_directive": 7, + "zero_repeat": 2, + "end_repeat": 2, + "continue_repeating": 2, + "stop_repeat": 2, + "find_end_repeat": 4, + "find_structure_end": 5, + "while_directive": 7, + "do_while": 2, + "calculate_logical_expression": 3, + "while_true": 2, + "stop_while": 2, + "find_end_while": 3, + "end_while": 2, + "too_many_repeats": 1, + "if_directive": 13, + "if_true": 2, + "find_else": 4, + "else_true": 3, + "make_if_structure": 2, + "else_directive": 3, + "found_else": 2, + "skip_else": 3, + "find_end_if": 3, + "end_if": 2, + "else_found": 2, + "find_end_directive": 10, + "no_end_directive": 2, + "skip_labels": 2, + "labels_ok": 2, + "prefix_instruction": 2, + "skip_repeat": 2, + "skip_while": 2, + "skip_if": 2, + "structure_end": 4, + "end_directive": 2, + "skip_if_block": 4, + "if_block_skipped": 2, + "skip_after_else": 3, + "data_directive": 1, + "end_data": 1, + "break_directive": 1, + "find_breakable_structure": 4, + "break_repeat": 2, + "break_while": 2, + "break_if": 2, + "data_bytes": 1, + "define_data": 8, + "get_byte": 2, + "undefined_data": 7, + "get_string": 2, + "mark_undefined_data": 2, + "undefined_data_ok": 2, + "simple_data_value": 3, + "skip_expression": 1, + "duplicate_zero_times": 2, + "duplicate_single_data_value": 3, + "duplicate_data": 2, + "duplicated_values": 2, + "near": 3, + "data_defined": 5, + "skip_single_data_value": 2, + "skip_data_value": 2, + "data_unicode": 1, + "base_code": 195, + "define_words": 2, + "data_words": 1, + "get_word": 2, + "scas": 10, + "word_data_value": 2, + "word_string": 2, + "get_word_value": 19, + "mark_relocation": 26, + "jecxz": 1, + "word_string_ok": 2, + "ecx*2": 1, + "copy_word_string": 2, + "loop": 2, + "data_dwords": 1, + "get_dword": 2, + "get_dword_value": 13, + "complex_dword": 2, + "invalid_operand": 239, + "data_pwords": 1, + "get_pword": 2, + "get_pword_value": 1, + "complex_pword": 2, + "data_qwords": 1, + "get_qword": 2, + "data_twords": 1, + "get_tword": 2, + "complex_tword": 2, + "fp_zero_tword": 2, + "FFFh": 3, + "jo": 2, + "value_out_of_range": 10, + "jge": 5, + "jg": 1, + "tword_exp_ok": 3, + "large_shift": 2, + "shrd": 1, + "tword_mantissa_shift_done": 2, + "store_shifted_mantissa": 2, + "data_file": 2, + "open_binary_file": 2, + "lseek": 5, + "position_ok": 2, + "size_ok": 2, + "read": 3, + "error_reading_file": 1, + "close": 3, + "find_current_source_path": 2, + "get_current_path": 3, + "lodsb": 12, + "stosb": 6, + "cut_current_path": 1, + "current_path_ok": 1, + "/": 1, + ".": 7, + "invalid_align_value": 3, + "section_not_aligned_enough": 4, + "make_alignment": 3, + "pe_alignment": 2, + "nops": 2, + "reserved_data": 2, + "nops_stosb_ok": 2, + "nops_stosw_ok": 2, + "err_directive": 1, + "invoked_error": 2, + "assert_directive": 1, + "assertion_failed": 1, + "interface": 2, + "for": 2, + "Win32": 2, + "format": 1, + "PE": 1, + "console": 1, + "section": 4, + "code": 1, + "readable": 4, + "executable": 1, + "start": 1, + "con_handle": 8, + "STD_OUTPUT_HANDLE": 2, + "_logo": 2, + "display_string": 19, + "get_params": 2, + "information": 2, + "init_memory": 2, + "_memory_prefix": 2, + "memory_start": 4, + "display_number": 8, + "_memory_suffix": 2, + "GetTickCount": 3, + "start_time": 3, + "preprocessor": 1, + "parser": 1, + "formatter": 1, + "display_user_messages": 3, + "_passes_suffix": 2, + "div": 8, + "display_bytes_count": 2, + "display_character": 6, + "_seconds_suffix": 2, + "written_size": 1, + "_bytes_suffix": 2, + "exit_program": 5, + "_usage": 2, + "input_file": 4, + "output_file": 3, + "memory_setting": 4, + "GetCommandLine": 2, + "params": 2, + "find_command_start": 2, + "skip_quoted_name": 3, + "skip_name": 2, + "find_param": 7, + "all_params": 5, + "option_param": 2, + "Dh": 19, + "get_output_file": 2, + "process_param": 3, + "bad_params": 11, + "string_param": 3, + "copy_param": 2, + "param_end": 6, + "string_param_end": 2, + "memory_option": 4, + "passes_option": 4, + "symbols_option": 3, + "get_option_value": 3, + "get_option_digit": 2, + "option_value_ok": 4, + "invalid_option_value": 5, + "imul": 1, + "find_symbols_file_name": 2, + "include": 15, + "data": 3, + "writeable": 2, + "_copyright": 1, + "db": 35, + "VERSION_STRING": 1, + "align": 1, + "dd": 22, + "bytes_count": 8, + "displayed_count": 4, + "character": 3, + "last_displayed": 5, + "rb": 4, + "options": 1, + "buffer": 14, + "stack": 1, + "import": 1, + "rva": 16, + "kernel_name": 2, + "kernel_table": 2, + "ExitProcess": 2, + "_ExitProcess": 2, + "CreateFile": 3, + "_CreateFileA": 2, + "ReadFile": 2, + "_ReadFile": 2, + "WriteFile": 6, + "_WriteFile": 2, + "CloseHandle": 2, + "_CloseHandle": 2, + "SetFilePointer": 2, + "_SetFilePointer": 2, + "_GetCommandLineA": 2, + "GetEnvironmentVariable": 2, + "_GetEnvironmentVariable": 2, + "GetStdHandle": 5, + "_GetStdHandle": 2, + "VirtualAlloc": 2, + "_VirtualAlloc": 2, + "VirtualFree": 2, + "_VirtualFree": 2, + "_GetTickCount": 2, + "GetSystemTime": 2, + "_GetSystemTime": 2, + "GlobalMemoryStatus": 2, + "_GlobalMemoryStatus": 2, + "dw": 14, + "fixups": 1, + "discardable": 1, + "CREATE_NEW": 1, + "CREATE_ALWAYS": 2, + "OPEN_EXISTING": 2, + "OPEN_ALWAYS": 1, + "TRUNCATE_EXISTING": 1, + "FILE_SHARE_READ": 3, + "FILE_SHARE_WRITE": 1, + "FILE_SHARE_DELETE": 1, + "GENERIC_READ": 2, + "GENERIC_WRITE": 2, + "STD_INPUT_HANDLE": 1, + "FFFFFFF6h": 1, + "FFFFFFF5h": 1, + "STD_ERROR_HANDLE": 3, + "FFFFFFF4h": 1, + "MEM_COMMIT": 2, + "MEM_RESERVE": 1, + "MEM_DECOMMIT": 1, + "MEM_RELEASE": 2, + "MEM_FREE": 1, + "MEM_PRIVATE": 1, + "MEM_MAPPED": 1, + "MEM_RESET": 1, + "MEM_TOP_DOWN": 1, + "PAGE_NOACCESS": 1, + "PAGE_READONLY": 1, + "PAGE_READWRITE": 2, + "PAGE_WRITECOPY": 1, + "PAGE_EXECUTE": 1, + "PAGE_EXECUTE_READ": 1, + "PAGE_EXECUTE_READWRITE": 1, + "PAGE_EXECUTE_WRITECOPY": 1, + "PAGE_GUARD": 1, + "PAGE_NOCACHE": 1, + "allocate_memory": 4, + "jl": 13, + "large_memory": 3, + "not_enough_memory": 2, + "do_exit": 2, + "get_environment_variable": 1, + "buffer_for_variable_ok": 2, + "open": 2, + "file_error": 6, + "create": 1, + "write": 1, + "repne": 1, + "scasb": 1, + "display_loop": 2, + "display_digit": 3, + "digit_ok": 2, + "line_break_ok": 4, + "make_line_break": 2, + "A0Dh": 2, + "D0Ah": 1, + "take_last_two_characters": 2, + "block_displayed": 2, + "block_ok": 2, + "fatal_error": 1, + "error_prefix": 3, + "error_suffix": 3, + "FFh": 4, + "assembler_error": 1, + "get_error_lines": 2, + "get_next_error_line": 2, + "display_error_line": 3, + "find_definition_origin": 2, + "line_number_start": 3, + "FFFFFFFh": 2, + "line_number_ok": 2, + "line_data_start": 2, + "line_data_displayed": 2, + "get_line_data": 2, + "display_line_data": 5, + "cr_lf": 2, + "make_timestamp": 1, + "mul": 5, + "months_correction": 2, + "day_correction_ok": 4, + "day_correction": 2, + "simple_instruction_except64": 1, + "simple_instruction": 6, + "simple_instruction_only64": 1, + "simple_instruction_16bit_except64": 1, + "simple_instruction_16bit": 2, + "size_prefix": 3, + "simple_instruction_32bit_except64": 1, + "simple_instruction_32bit": 6, + "iret_instruction": 1, + "simple_instruction_64bit": 2, + "simple_extended_instruction_64bit": 1, + "simple_extended_instruction": 1, + "segment_register": 7, + "store_segment_prefix": 1, + "int_instruction": 1, + "get_size_operator": 137, + "invalid_operand_size": 131, + "jns": 1, + "int_imm_ok": 2, + "CDh": 1, + "aa_instruction": 1, + "aa_store": 2, + "basic_instruction": 1, + "basic_reg": 2, + "basic_mem": 1, + "get_address": 62, + "basic_mem_imm": 2, + "basic_mem_reg": 1, + "convert_register": 60, + "postbyte_register": 137, + "instruction_ready": 72, + "operand_autodetect": 47, + "store_instruction": 3, + "basic_mem_imm_nosize": 2, + "basic_mem_imm_8bit": 2, + "basic_mem_imm_16bit": 2, + "basic_mem_imm_32bit": 2, + "basic_mem_imm_64bit": 1, + "size_declared": 17, + "long_immediate_not_encodable": 14, + "operand_64bit": 18, + "get_simm32": 10, + "basic_mem_imm_32bit_ok": 2, + "recoverable_unknown_size": 19, + "store_instruction_with_imm8": 11, + "operand_16bit": 25, + "basic_mem_imm_16bit_store": 3, + "basic_mem_simm_8bit": 5, + "store_instruction_with_imm16": 4, + "operand_32bit": 27, + "basic_mem_imm_32bit_store": 3, + "store_instruction_with_imm32": 4, + "cdq": 11, + "get_simm32_ok": 2, + "basic_reg_reg": 2, + "basic_reg_imm": 2, + "basic_reg_mem": 1, + "basic_reg_mem_8bit": 2, + "nomem_instruction_ready": 53, + "store_nomem_instruction": 19, + "basic_reg_imm_8bit": 2, + "basic_reg_imm_16bit": 2, + "basic_reg_imm_32bit": 2, + "basic_reg_imm_64bit": 1, + "basic_reg_imm_32bit_ok": 2, + "basic_al_imm": 2, + "basic_reg_imm_16bit_store": 3, + "basic_reg_simm_8bit": 5, + "basic_ax_imm": 2, + "basic_store_imm_16bit": 2, + "store_instruction_code": 26, + "basic_reg_imm_32bit_store": 3, + "basic_eax_imm": 2, + "basic_store_imm_32bit": 2, + "ignore_unknown_size": 2, + "operand_size_not_specified": 1, + "single_operand_instruction": 1, + "F6h": 4, + "single_reg": 2, + "single_mem": 1, + "single_mem_8bit": 2, + "single_mem_nosize": 2, + "single_reg_8bit": 2, + "mov_instruction": 1, + "mov_reg": 2, + "mov_mem": 1, + "mov_mem_imm": 2, + "mov_mem_reg": 1, + "mov_mem_general_reg": 2, + "mov_mem_sreg": 2, + "mov_mem_reg_8bit": 2, + "mov_mem_ax": 2, + "mov_mem_al": 1, + "mov_mem_address16_al": 3, + "mov_mem_address32_al": 3, + "mov_mem_address64_al": 3, + "invalid_address_size": 18, + "store_segment_prefix_if_necessary": 17, + "address_32bit_prefix": 11, + "A2h": 3, + "store_mov_address32": 4, + "store_address_32bit_value": 1, + "address_16bit_prefix": 11, + "store_mov_address16": 4, + "invalid_address": 32, + "store_mov_address64": 4, + "store_address_64bit_value": 1, + "mov_mem_address16_ax": 3, + "mov_mem_address32_ax": 3, + "mov_mem_address64_ax": 3, + "A3h": 3, + "mov_mem_sreg_store": 2, + "mov_mem_imm_nosize": 2, + "mov_mem_imm_8bit": 2, + "mov_mem_imm_16bit": 2, + "mov_mem_imm_32bit": 2, + "mov_mem_imm_64bit": 1, + "mov_mem_imm_32bit_store": 2, + "C6h": 1, + "C7h": 4, + "F0h": 7, + "mov_sreg": 2, + "mov_reg_mem": 2, + "mov_reg_imm": 2, + "mov_reg_reg": 1, + "mov_reg_sreg": 2, + "mov_reg_reg_8bit": 2, + "mov_reg_creg": 2, + "mov_reg_dreg": 2, + "mov_reg_treg": 2, + "mov_reg_sreg64": 2, + "mov_reg_sreg32": 2, + "mov_reg_sreg_store": 3, + "extended_code": 73, + "mov_reg_xrx": 3, + "mov_reg_xrx_64bit": 2, + "mov_reg_xrx_store": 3, + "mov_reg_mem_8bit": 2, + "mov_ax_mem": 2, + "mov_al_mem": 2, + "mov_al_mem_address16": 3, + "mov_al_mem_address32": 3, + "mov_al_mem_address64": 3, + "A0h": 4, + "mov_ax_mem_address16": 3, + "mov_ax_mem_address32": 3, + "mov_ax_mem_address64": 3, + "A1h": 4, + "mov_reg_imm_8bit": 2, + "mov_reg_imm_16bit": 2, + "mov_reg_imm_32bit": 2, + "mov_reg_imm_64bit": 1, + "mov_reg_imm_64bit_store": 3, + "mov_reg_64bit_imm_32bit": 2, + "B8h": 3, + "store_mov_reg_imm_code": 5, + "B0h": 5, + "mov_store_imm_32bit": 2, + "mov_reg_imm_prefix_ok": 2, + "mov_creg": 2, + "mov_dreg": 2, + "mov_treg": 2, + "mov_sreg_mem": 2, + "mov_sreg_reg": 1, + "mov_sreg_reg_size_ok": 2, + "Eh": 8, + "mov_sreg_mem_size_ok": 2, + "mov_xrx": 3, + "mov_xrx_64bit": 2, + "mov_xrx_store": 4, + "test_instruction": 1, + "test_reg": 2, + "test_mem": 1, + "test_mem_imm": 2, + "test_mem_reg": 2, + "test_mem_reg_8bit": 2, + "test_mem_imm_nosize": 2, + "test_mem_imm_8bit": 2, + "test_mem_imm_16bit": 2, + "test_mem_imm_32bit": 2, + "test_mem_imm_64bit": 1, + "test_mem_imm_32bit_store": 2, + "F7h": 5, + "test_reg_mem": 3, + "test_reg_imm": 2, + "test_reg_reg": 1, + "test_reg_reg_8bit": 2, + "test_reg_imm_8bit": 2, + "test_reg_imm_16bit": 2, + "test_reg_imm_32bit": 2, + "test_reg_imm_64bit": 1, + "test_reg_imm_32bit_store": 2, + "test_al_imm": 2, + "A8h": 1, + "test_ax_imm": 2, + "A9h": 2, + "test_eax_imm": 2, + "test_reg_mem_8bit": 2, + "xchg_instruction": 1, + "xchg_reg": 2, + "xchg_mem": 1, + "xchg_reg_reg": 1, + "xchg_reg_reg_8bit": 2, + "xchg_ax_reg": 2, + "xchg_reg_reg_store": 3, + "xchg_ax_reg_ok": 3, + "xchg_ax_reg_store": 2, + "push_instruction": 1, + "push_size": 9, + "push_next": 2, + "push_reg": 2, + "push_imm": 2, + "push_mem": 1, + "push_mem_16bit": 3, + "push_mem_32bit": 3, + "push_mem_64bit": 3, + "push_mem_store": 4, + "push_done": 5, + "push_sreg": 2, + "push_reg_ok": 2, + "push_reg_16bit": 2, + "push_reg_32bit": 2, + "push_reg_64bit": 1, + "push_reg_store": 5, + "dh": 37, + "push_sreg16": 3, + "push_sreg32": 3, + "push_sreg64": 3, + "push_sreg_store": 4, + "push_sreg_386": 2, + "push_imm_size_ok": 3, + "push_imm_16bit": 2, + "push_imm_32bit": 2, + "push_imm_64bit": 2, + "push_imm_optimized_16bit": 3, + "push_imm_optimized_32bit": 3, + "push_imm_optimized_64bit": 2, + "push_imm_32bit_store": 8, + "push_imm_8bit": 3, + "push_imm_16bit_store": 4, + "pop_instruction": 1, + "pop_next": 2, + "pop_reg": 2, + "pop_mem": 1, + "pop_mem_16bit": 3, + "pop_mem_32bit": 3, + "pop_mem_64bit": 3, + "pop_mem_store": 4, + "pop_done": 3, + "pop_sreg": 2, + "pop_reg_ok": 2, + "pop_reg_16bit": 2, + "pop_reg_32bit": 2, + "pop_reg_64bit": 2, + "pop_reg_store": 5, + "pop_cs": 2, + "pop_sreg16": 3, + "pop_sreg32": 3, + "pop_sreg64": 3, + "pop_sreg_store": 4, + "pop_sreg_386": 2, + "pop_cs_store": 3, + "inc_instruction": 1, + "inc_reg": 2, + "inc_mem": 2, + "inc_mem_8bit": 2, + "inc_mem_nosize": 2, + "FEh": 2, + "inc_reg_8bit": 2, + "inc_reg_long_form": 2, + "set_instruction": 1, + "set_reg": 2, + "set_mem": 1, + "arpl_instruction": 1, + "arpl_reg": 2, + "bound_instruction": 1, + "bound_store": 2, + "enter_instruction": 1, + "enter_imm16_size_ok": 2, + "enter_imm16_ok": 2, + "js": 3, + "enter_imm8_size_ok": 2, + "enter_imm8_ok": 2, + "C8h": 2, + "ret_instruction_only64": 1, + "ret_instruction": 5, + "ret_instruction_32bit_except64": 1, + "ret_instruction_32bit": 1, + "ret_instruction_16bit": 1, + "retf_instruction": 1, + "ret_instruction_64bit": 1, + "simple_ret": 4, + "ret_imm": 3, + "ret_imm_ok": 2, + "ret_imm_store": 2, + "lea_instruction": 1, + "ls_instruction": 1, + "les_instruction": 2, + "lds_instruction": 2, + "ls_code_ok": 2, + "C4h": 1, + "ls_short_code": 2, + "C5h": 2, + "ls_16bit": 2, + "ls_32bit": 2, + "ls_64bit": 2, + "sh_instruction": 1, + "sh_reg": 2, + "sh_mem": 1, + "sh_mem_imm": 2, + "sh_mem_reg": 1, + "sh_mem_cl_8bit": 2, + "sh_mem_cl_nosize": 2, + "D3h": 2, + "D2h": 2, + "sh_mem_imm_size_ok": 2, + "sh_mem_imm_8bit": 2, + "sh_mem_imm_nosize": 2, + "sh_mem_1": 2, + "C1h": 2, + "D1h": 2, + "sh_mem_1_8bit": 2, + "C0h": 2, + "D0h": 2, + "sh_reg_imm": 2, + "sh_reg_reg": 1, + "sh_reg_cl_8bit": 2, + "sh_reg_imm_size_ok": 2, + "sh_reg_imm_8bit": 2, + "sh_reg_1": 2, + "sh_reg_1_8bit": 2, + "shd_instruction": 1, + "shd_reg": 2, + "shd_mem": 1, + "shd_mem_reg_imm": 2, + "shd_mem_reg_imm_size_ok": 2, + "shd_reg_reg_imm": 2, + "shd_reg_reg_imm_size_ok": 2, + "movx_instruction": 1, + "movx_reg": 2, + "movx_unknown_size": 2, + "movx_mem_store": 3, + "movx_reg_8bit": 2, + "movx_reg_16bit": 2, + "movsxd_instruction": 1, + "movsxd_reg": 2, + "movsxd_mem_store": 2, + "bt_instruction": 1, + "bt_reg": 2, + "bt_mem_imm": 3, + "bt_mem_reg": 2, + "bt_mem_imm_size_ok": 2, + "bt_mem_imm_nosize": 2, + "bt_mem_imm_store": 2, + "BAh": 2, + "bt_reg_imm": 3, + "bt_reg_reg": 2, + "bt_reg_imm_size_ok": 2, + "bt_reg_imm_store": 1, + "bs_instruction": 1, + "get_reg_mem": 2, + "bs_reg_reg": 2, + "get_reg_reg": 2, + "imul_instruction": 1, + "imul_reg": 2, + "imul_mem": 1, + "imul_mem_8bit": 2, + "imul_mem_nosize": 2, + "imul_reg_": 2, + "imul_reg_8bit": 2, + "imul_reg_imm": 3, + "imul_reg_noimm": 2, + "imul_reg_reg": 2, + "imul_reg_mem": 1, + "imul_reg_mem_imm": 2, + "AFh": 2, + "imul_reg_mem_imm_16bit": 2, + "imul_reg_mem_imm_32bit": 2, + "imul_reg_mem_imm_64bit": 1, + "imul_reg_mem_imm_32bit_ok": 2, + "imul_reg_mem_imm_16bit_store": 4, + "imul_reg_mem_imm_8bit_store": 3, + "imul_reg_mem_imm_32bit_store": 4, + "Bh": 11, + "imul_reg_reg_imm": 3, + "imul_reg_reg_imm_16bit": 2, + "imul_reg_reg_imm_32bit": 2, + "imul_reg_reg_imm_64bit": 1, + "imul_reg_reg_imm_32bit_ok": 2, + "imul_reg_reg_imm_16bit_store": 4, + "imul_reg_reg_imm_8bit_store": 3, + "imul_reg_reg_imm_32bit_store": 4, + "in_instruction": 1, + "in_imm": 2, + "in_reg": 2, + "in_al_dx": 2, + "in_ax_dx": 2, + "EDh": 1, + "ECh": 1, + "in_imm_size_ok": 2, + "in_al_imm": 2, + "in_ax_imm": 2, + "E5h": 1, + "E4h": 1, + "out_instruction": 1, + "out_imm": 2, + "out_dx_al": 2, + "out_dx_ax": 2, + "EFh": 1, + "EEh": 1, + "out_imm_size_ok": 2, + "out_imm_al": 2, + "out_imm_ax": 2, + "E7h": 1, + "E6h": 1, + "call_instruction": 1, + "E8h": 3, + "process_jmp": 2, + "jmp_instruction": 1, + "E9h": 1, + "EAh": 1, + "get_jump_operator": 3, + "jmp_imm": 2, + "jmp_reg": 2, + "jmp_mem": 1, + "jump_type": 14, + "jmp_mem_size_not_specified": 2, + "jmp_mem_16bit": 3, + "jmp_mem_32bit": 2, + "jmp_mem_48bit": 2, + "jmp_mem_64bit": 2, + "jmp_mem_80bit": 2, + "jmp_mem_far": 2, + "jmp_mem_near": 2, + "jmp_mem_near_32bit": 3, + "jmp_mem_far_32bit": 4, + "jmp_mem_far_store": 3, + "jmp_reg_16bit": 2, + "jmp_reg_32bit": 2, + "jmp_reg_64bit": 1, + "jmp_far": 2, + "jmp_near": 1, + "jmp_imm_16bit": 3, + "jmp_imm_32bit": 2, + "jmp_imm_64bit": 3, + "get_address_dword_value": 3, + "jmp_imm_32bit_prefix_ok": 2, + "calculate_jump_offset": 10, + "check_for_short_jump": 8, + "jmp_short": 3, + "jmp_imm_32bit_store": 2, + "jno": 2, + "jmp_imm_32bit_ok": 2, + "relative_jump_out_of_range": 6, + "get_address_qword_value": 3, + "EBh": 1, + "get_address_word_value": 3, + "jmp_imm_16bit_prefix_ok": 2, + "cwde": 3, + "forced_short": 2, + "no_short_jump": 4, + "short_jump": 4, + "jmp_short_value_type_ok": 2, + "jump_out_of_range": 3, + "jmp_far_16bit": 2, + "jmp_far_32bit": 3, + "jmp_far_segment": 2, + "conditional_jump": 1, + "conditional_jump_16bit": 3, + "conditional_jump_32bit": 2, + "conditional_jump_64bit": 3, + "conditional_jump_32bit_prefix_ok": 2, + "conditional_jump_short": 4, + "conditional_jump_32bit_store": 2, + "conditional_jump_32bit_range_ok": 2, + "conditional_jump_16bit_prefix_ok": 2, + "loop_instruction_16bit": 1, + "loop_instruction": 5, + "loop_instruction_32bit": 1, + "loop_instruction_64bit": 1, + "loop_jump_16bit": 3, + "loop_jump_32bit": 2, + "loop_jump_64bit": 3, + "loop_jump_32bit_prefix_ok": 2, + "loop_counter_size": 4, + "make_loop_jump": 3, + "loop_counter_size_ok": 2, + "loop_jump_16bit_prefix_ok": 2, + "movs_instruction": 1, + "address_sizes_do_not_agree": 2, + "movs_address_16bit": 2, + "movs_address_32bit": 2, + "movs_store": 3, + "A4h": 1, + "movs_check_size": 5, + "lods_instruction": 1, + "lods_address_16bit": 2, + "lods_address_32bit": 2, + "lods_store": 3, + "ACh": 1, + "stos_instruction": 1, + "stos_address_16bit": 2, + "stos_address_32bit": 2, + "stos_store": 3, + "cmps_instruction": 1, + "cmps_address_16bit": 2, + "cmps_address_32bit": 2, + "cmps_store": 3, + "A6h": 1, + "ins_instruction": 1, + "ins_address_16bit": 2, + "ins_address_32bit": 2, + "ins_store": 3, + "ins_check_size": 2, + "outs_instruction": 1, + "outs_address_16bit": 2, + "outs_address_32bit": 2, + "outs_store": 3, + "xlat_instruction": 1, + "xlat_address_16bit": 2, + "xlat_address_32bit": 2, + "xlat_store": 3, + "D7h": 1, + "pm_word_instruction": 1, + "pm_reg": 2, + "pm_mem": 2, + "pm_mem_store": 2, + "pm_store_word_instruction": 1, + "lgdt_instruction": 1, + "lgdt_mem_48bit": 2, + "lgdt_mem_80bit": 2, + "lgdt_mem_store": 4, + "lar_instruction": 1, + "lar_reg_reg": 2, + "lar_reg_mem": 2, + "invlpg_instruction": 1, + "swapgs_instruction": 1, + "rdtscp_instruction": 1, + "basic_486_instruction": 1, + "basic_486_reg": 2, + "basic_486_mem_reg_8bit": 2, + "basic_486_reg_reg_8bit": 2, + "bswap_instruction": 1, + "bswap_reg_code_ok": 2, + "bswap_reg64": 2, + "cmpxchgx_instruction": 1, + "cmpxchgx_size_ok": 2, + "cmpxchgx_store": 2, + "nop_instruction": 1, + "extended_nop": 4, + "extended_nop_reg": 2, + "extended_nop_store": 2, + "basic_fpu_instruction": 1, + "D8h": 2, + "basic_fpu_streg": 2, + "basic_fpu_mem": 2, + "basic_fpu_mem_32bit": 2, + "basic_fpu_mem_64bit": 2, + "DCh": 2, + "convert_fpu_register": 9, + "basic_fpu_single_streg": 3, + "basic_fpu_st0": 2, + "basic_fpu_streg_st0": 2, + "simple_fpu_instruction": 1, + "D9h": 6, + "fi_instruction": 1, + "fi_mem_16bit": 2, + "fi_mem_32bit": 2, + "DAh": 2, + "DEh": 2, + "fld_instruction": 1, + "fld_streg": 2, + "fld_mem_32bit": 2, + "fld_mem_64bit": 2, + "fld_mem_80bit": 2, + "DDh": 6, + "fld_mem_80bit_store": 3, + "DBh": 4, + "fst_streg": 2, + "fild_instruction": 1, + "fild_mem_16bit": 2, + "fild_mem_32bit": 2, + "fild_mem_64bit": 2, + "DFh": 5, + "fisttp_64bit_store": 2, + "fild_mem_64bit_store": 3, + "fbld_instruction": 1, + "fbld_mem_80bit": 3, + "faddp_instruction": 1, + "faddp_streg": 2, + "fcompp_instruction": 1, + "D9DEh": 1, + "fucompp_instruction": 1, + "E9DAh": 1, + "fxch_instruction": 1, + "fpu_single_operand": 3, + "ffreep_instruction": 1, + "ffree_instruction": 1, + "fpu_streg": 2, + "fstenv_instruction": 1, + "fldenv_instruction": 3, + "fpu_mem": 2, + "fstenv_instruction_16bit": 1, + "fldenv_instruction_16bit": 1, + "fstenv_instruction_32bit": 1, + "fldenv_instruction_32bit": 1, + "fsave_instruction_32bit": 1, + "fnsave_instruction_32bit": 1, + "fnsave_instruction": 3, + "fsave_instruction_16bit": 1, + "fnsave_instruction_16bit": 1, + "fsave_instruction": 1, + "fstcw_instruction": 1, + "fldcw_instruction": 1, + "fldcw_mem_16bit": 3, + "fstsw_instruction": 1, + "fnstsw_instruction": 1, + "fstsw_reg": 2, + "fstsw_mem_16bit": 3, + "E0DFh": 1, + "finit_instruction": 1, + "fninit_instruction": 1, + "fcmov_instruction": 1, + "fcomi_streg": 3, + "fcomi_instruction": 1, + "fcomip_instruction": 1, + "fcomi_st0_streg": 2, + "basic_mmx_instruction": 1, + "mmx_instruction": 1, + "convert_mmx_register": 18, + "make_mmx_prefix": 9, + "mmx_mmreg_mmreg": 3, + "mmx_mmreg_mem": 2, + "mmx_bit_shift_instruction": 1, + "mmx_ps_mmreg_imm8": 2, + "pmovmskb_instruction": 1, + "pmovmskb_reg_size_ok": 2, + "mmx_nomem_imm8": 7, + "mmx_imm8": 6, + "append_imm8": 2, + "pinsrw_instruction": 1, + "pinsrw_mmreg_reg": 2, + "pshufw_instruction": 1, + "mmx_size": 30, + "pshuf_instruction": 2, + "pshufd_instruction": 1, + "pshuf_mmreg_mmreg": 2, + "movd_instruction": 1, + "movd_reg": 2, + "movd_mmreg": 2, + "movd_mmreg_reg": 2, + "mmx_prefix_for_vex": 2, + "no_mmx_prefix": 2, + "movq_instruction": 1, + "movq_reg": 2, + "movq_mem_xmmreg": 2, + "D6h": 2, + "movq_mmreg": 2, + "movq_mmreg_": 2, + "F3h": 7, + "movq_mmreg_reg": 2, + "movq_mmreg_mmreg": 2, + "movq_mmreg_reg_store": 2, + "movdq_instruction": 1, + "movdq_mmreg": 2, + "convert_xmm_register": 12, + "movdq_mmreg_mmreg": 2, + "lddqu_instruction": 1, + "F2h": 6, + "movdq2q_instruction": 1, + "movq2dq_": 2, + "movq2dq_instruction": 1, + "sse_ps_instruction_imm8": 1, + "sse_ps_instruction": 1, + "sse_instruction": 11, + "sse_pd_instruction_imm8": 1, + "sse_pd_instruction": 1, + "sse_ss_instruction": 1, + "sse_sd_instruction": 1, + "cmp_pd_instruction": 1, + "cmp_ps_instruction": 1, + "C2h": 4, + "cmp_ss_instruction": 1, + "cmp_sx_instruction": 2, + "cmpsd_instruction": 1, + "A7h": 1, + "cmp_sd_instruction": 1, + "comiss_instruction": 1, + "comisd_instruction": 1, + "cvtdq2pd_instruction": 1, + "cvtps2pd_instruction": 1, + "cvtpd2dq_instruction": 1, + "movshdup_instruction": 1, + "sse_xmmreg": 2, + "sse_reg": 1, + "sse_xmmreg_xmmreg": 2, + "sse_reg_mem": 2, + "sse_mem_size_ok": 2, + "supplemental_code": 2, + "sse_cmp_mem_ok": 3, + "sse_ok": 2, + "take_additional_xmm0": 3, + "sse_xmmreg_xmmreg_ok": 4, + "sse_cmp_nomem_ok": 3, + "sse_nomem_ok": 2, + "additional_xmm0_ok": 2, + "pslldq_instruction": 1, + "movpd_instruction": 1, + "movps_instruction": 1, + "sse_mov_instruction": 3, + "movss_instruction": 1, + "sse_movs": 2, + "movsd_instruction": 1, + "A5h": 1, + "sse_mem": 2, + "sse_mem_xmmreg": 2, + "movlpd_instruction": 1, + "movlps_instruction": 1, + "movhlps_instruction": 1, + "maskmovq_instruction": 1, + "maskmov_instruction": 2, + "maskmovdqu_instruction": 1, + "movmskpd_instruction": 1, + "movmskps_instruction": 1, + "movmskps_reg_ok": 2, + "cvtpi2pd_instruction": 1, + "cvtpi2ps_instruction": 1 + }, "ATS": { "//": 211, "#include": 16, @@ -9383,23 +11233,23 @@ "C++": { "class": 40, "Bar": 2, - "{": 581, + "{": 726, "protected": 4, "char": 127, "*name": 6, - ";": 2471, + ";": 2783, "public": 33, - "void": 225, + "void": 241, "hello": 2, - "(": 2729, - ")": 2731, - "}": 581, - "//": 278, + "(": 3102, + ")": 3105, + "}": 726, + "//": 315, "///": 843, "mainpage": 1, "C": 6, "library": 14, - "for": 98, + "for": 105, "Broadcom": 3, "BCM": 14, "as": 28, @@ -9407,22 +11257,22 @@ "in": 165, "Raspberry": 6, "Pi": 5, - "This": 18, - "is": 100, - "a": 156, + "This": 19, + "is": 102, + "a": 157, "RPi": 17, ".": 16, "It": 7, "provides": 3, "access": 17, - "to": 253, + "to": 254, "GPIO": 87, "and": 118, "other": 17, "IO": 2, "functions": 19, "on": 55, - "the": 537, + "the": 541, "chip": 9, "allowing": 3, "pins": 40, @@ -9435,7 +11285,7 @@ "can": 21, "control": 17, "interface": 9, - "with": 32, + "with": 33, "various": 4, "external": 3, "devices.": 1, @@ -9448,7 +11298,7 @@ "SPI": 44, "I2C": 29, "accessing": 2, - "system": 9, + "system": 13, "timers.": 1, "Pin": 65, "event": 3, @@ -9458,14 +11308,14 @@ "polling": 1, "interrupts": 1, "are": 36, - "not": 26, - "+": 60, + "not": 29, + "+": 80, "compatible": 1, "installs": 1, "header": 7, "file": 31, "non": 2, - "-": 349, + "-": 438, "shared": 2, "any": 23, "Linux": 2, @@ -9474,16 +11324,16 @@ "but": 5, "clearly": 1, "no": 7, - "use": 34, + "use": 37, "except": 2, "or": 44, "another": 1, "The": 50, "version": 38, - "of": 211, + "of": 215, "package": 1, - "that": 33, - "this": 52, + "that": 36, + "this": 57, "documentation": 3, "refers": 1, "be": 35, @@ -9557,7 +11407,7 @@ "determined": 1, "suspect": 1, "an": 23, - "interrupt": 1, + "interrupt": 3, "handler": 1, "hitting": 1, "hard": 1, @@ -9568,7 +11418,7 @@ "must": 6, "friends": 2, "make": 6, - "sure": 3, + "sure": 6, "disable": 2, "bcm2835_gpio_cler_len": 1, "after": 18, @@ -9596,14 +11446,14 @@ "xx": 2, "./configure": 1, "sudo": 2, - "check": 3, + "check": 4, "endcode": 2, "Physical": 21, "Addresses": 6, "bcm2835_peri_read": 3, "bcm2835_peri_write": 3, "bcm2835_peri_set_bits": 2, - "low": 2, + "low": 5, "level": 10, "peripheral": 14, "register": 17, @@ -9635,7 +11485,7 @@ "Ennnnnn": 1, "available": 6, "nnnnnn.": 1, - "base": 4, + "base": 8, "registers": 12, "following": 2, "externals": 1, @@ -9707,7 +11557,7 @@ "SPI.": 1, "While": 1, "able": 2, - "state": 22, + "state": 33, "through": 4, "bcm2835_spi_gpio_write": 1, "bcm2835_spi_end": 4, @@ -9728,7 +11578,7 @@ "referred": 1, "I": 4, "//en.wikipedia.org/wiki/I": 1, - "%": 6, + "%": 7, "C2": 1, "B2C": 1, "V2": 2, @@ -9741,7 +11591,7 @@ "user": 3, "i.e.": 1, "they": 2, - "run": 1, + "run": 2, "Such": 1, "part": 1, "kernel": 4, @@ -9749,7 +11599,7 @@ "subject": 1, "paging": 1, "swapping": 2, - "while": 12, + "while": 17, "does": 4, "things": 1, "besides": 1, @@ -9769,7 +11619,7 @@ "guarantee": 1, "bcm2835_delay": 5, "bcm2835_delayMicroseconds": 6, - "return": 164, + "return": 240, "exactly": 2, "requested.": 1, "fact": 2, @@ -9782,7 +11632,7 @@ "longer": 1, "delay": 9, "times": 2, - "than": 5, + "than": 6, "one": 73, "asked": 1, "for.": 1, @@ -9794,11 +11644,11 @@ "reports": 1, "prevent": 4, "fragment": 2, - "struct": 12, + "struct": 13, "sched_param": 1, "sp": 4, "memset": 3, - "&": 149, + "&": 203, "sizeof": 15, "sp.sched_priority": 1, "sched_get_priority_max": 1, @@ -9806,7 +11656,7 @@ "sched_setscheduler": 1, "mlockall": 1, "MCL_CURRENT": 1, - "|": 14, + "|": 40, "MCL_FUTURE": 1, "Open": 2, "Source": 2, @@ -9814,7 +11664,7 @@ "GPL": 2, "appropriate": 7, "option": 1, - "if": 306, + "if": 359, "want": 5, "share": 2, "source": 12, @@ -9868,7 +11718,7 @@ "sar": 1, "Ortiz": 1, "Document": 1, - "testing": 1, + "testing": 2, "Functions": 1, "bcm2835_gpio_ren": 3, "bcm2835_gpio_fen": 3, @@ -9917,15 +11767,15 @@ "mallocs": 1, "frees": 1, "found": 1, - "calling": 8, + "calling": 9, "nanosleep": 7, "takes": 1, "least": 2, "us.": 1, - "need": 3, + "need": 6, "link": 3, "version.": 1, - "s": 18, + "s": 26, "doc": 1, "Also": 1, "added": 2, @@ -9959,7 +11809,7 @@ "compiles": 1, "even": 2, "CLOCK_MONOTONIC_RAW": 1, - "CLOCK_MONOTONIC": 1, + "CLOCK_MONOTONIC": 3, "instead.": 1, "errors": 1, "divider": 15, @@ -9984,7 +11834,7 @@ "Changes": 1, "timer": 2, "counter": 1, - "instead": 1, + "instead": 4, "clock_gettime": 1, "improved": 1, "accuracy.": 1, @@ -10007,7 +11857,7 @@ "olly.": 1, "Patch": 2, "Dootson": 2, - "close": 3, + "close": 7, "/dev/mem": 4, "granted.": 1, "susceptible": 1, @@ -10034,11 +11884,11 @@ "completing.": 1, "Patched": 1, "p": 6, - "[": 274, + "[": 293, "atched": 1, "his": 1, "submitted": 1, - "high": 1, + "high": 5, "load": 1, "processes.": 1, "Updated": 1, @@ -10063,10 +11913,10 @@ "DIRECTLY": 1, "USE": 1, "LISTS": 1, - "#ifndef": 27, + "#ifndef": 29, "BCM2835_H": 3, - "#define": 341, - "#include": 121, + "#define": 343, + "#include": 129, "": 2, "defgroup": 7, "constants": 1, @@ -10076,16 +11926,16 @@ "here": 1, "@": 14, "HIGH": 12, - "true": 41, + "true": 49, "volts": 2, "pin.": 21, - "false": 45, + "false": 48, "Speed": 1, "core": 1, "clock": 21, "core_clk": 1, "BCM2835_CORE_CLK_HZ": 1, - "<": 247, + "<": 255, "Base": 17, "Address": 10, "BCM2835_PERI_BASE": 9, @@ -10110,7 +11960,7 @@ "bcm2835_init": 11, "extern": 72, "volatile": 13, - "uint32_t": 37, + "uint32_t": 39, "*bcm2835_st": 1, "*bcm2835_gpio": 1, "*bcm2835_pwm": 1, @@ -10124,7 +11974,7 @@ "page": 5, "BCM2835_PAGE_SIZE": 1, "*1024": 2, - "block": 4, + "block": 7, "BCM2835_BLOCK_SIZE": 1, "offsets": 2, "BCM2835_GPIO_BASE.": 1, @@ -10140,7 +11990,7 @@ "BCM2835_GPFSEL1": 1, "BCM2835_GPFSEL2": 1, "BCM2835_GPFSEL3": 1, - "c": 62, + "c": 72, "BCM2835_GPFSEL4": 1, "BCM2835_GPFSEL5": 1, "BCM2835_GPSET0": 1, @@ -10185,7 +12035,7 @@ "brief": 12, "bcm2835PortFunction": 1, "Port": 1, - "function": 18, + "function": 19, "select": 9, "modes": 1, "bcm2835_gpio_fsel": 2, @@ -10261,7 +12111,7 @@ "BCM2835_PAD_GROUP_GPIO_46_53": 1, "Numbers": 1, "Here": 1, - "we": 4, + "we": 10, "terms": 4, "numbers.": 1, "These": 6, @@ -10363,7 +12213,7 @@ "Full": 1, "BCM2835_SPI0_CS_RXR": 1, "RXR": 3, - "needs": 3, + "needs": 4, "Reading": 1, "full": 9, "BCM2835_SPI0_CS_TXD": 1, @@ -10499,10 +12349,10 @@ "BCM2835_BSC_C_READ": 1, "BCM2835_BSC_S_CLKT": 1, "stretch": 1, - "timeout": 1, + "timeout": 5, "BCM2835_BSC_S_ERR": 1, "ACK": 1, - "error": 2, + "error": 8, "BCM2835_BSC_S_RXF": 1, "BCM2835_BSC_S_TXE": 1, "TXE": 1, @@ -10533,7 +12383,7 @@ "BCM2835_I2C_REASON_ERROR_CLKT": 1, "BCM2835_I2C_REASON_ERROR_DATA": 1, "sent": 1, - "/": 14, + "/": 16, "BCM2835_ST_CS": 1, "Control/Status": 1, "BCM2835_ST_CLO": 1, @@ -10573,8 +12423,8 @@ "BCM2835_PWM0_REPEATFF": 1, "BCM2835_PWM0_SERIAL": 1, "BCM2835_PWM0_ENABLE": 1, - "x": 48, - "#endif": 89, + "x": 86, + "#endif": 110, "#ifdef": 19, "__cplusplus": 12, "init": 2, @@ -10592,7 +12442,7 @@ "bcm2835_set_debug": 2, "fails": 1, "returning": 1, - "result": 2, + "result": 8, "crashes": 1, "failures.": 1, "Prints": 1, @@ -10601,12 +12451,12 @@ "case": 34, "errors.": 1, "successful": 2, - "else": 48, - "int": 161, + "else": 58, + "int": 218, "Close": 1, "deallocating": 1, "allocated": 2, - "closing": 1, + "closing": 3, "Sets": 24, "debug": 6, "prevents": 1, @@ -10615,14 +12465,14 @@ "out": 5, "what": 2, "would": 2, - "do": 9, + "do": 13, "rather": 2, "causes": 1, "normal": 1, "operation.": 2, "Call": 2, "param": 72, - "]": 273, + "]": 292, "level.": 3, "uint8_t": 43, "lowlevel": 2, @@ -10696,7 +12546,7 @@ "Tests": 1, "detected": 7, "requested": 1, - "flag": 1, + "flag": 3, "bcm2835_gpio_set_eds": 2, "status": 1, "th": 1, @@ -10798,7 +12648,7 @@ "Forces": 2, "ALT0": 2, "funcitons": 1, - "complete": 2, + "complete": 3, "End": 2, "returned": 5, "INPUT": 2, @@ -10850,7 +12700,7 @@ "placed": 1, "rbuf.": 1, "rbuf": 3, - "long": 11, + "long": 15, "tbuf": 4, "Buffer": 10, "send.": 5, @@ -10894,8 +12744,8 @@ "course": 2, "nothing": 1, "driver": 1, - "const": 170, - "*": 161, + "const": 172, + "*": 183, "receive.": 2, "received.": 2, "Allows": 2, @@ -10941,8 +12791,8 @@ "": 4, "": 4, "": 2, - "namespace": 31, - "std": 52, + "namespace": 38, + "std": 53, "DEFAULT_DELIMITER": 1, "CsvStreamer": 5, "private": 16, @@ -10990,12 +12840,12 @@ "leading/trailing": 1, "spaces": 3, "trimmed": 1, - "bool": 104, + "bool": 111, "Like": 1, "specify": 1, "trim": 2, "keep": 1, - "float": 8, + "float": 74, "double": 25, "writeln": 1, "Flushes": 1, @@ -11007,7 +12857,7 @@ "": 1, "": 1, "": 2, - "static": 262, + "static": 263, "Env": 13, "*env_instance": 1, "NULL": 109, @@ -11039,6 +12889,202 @@ "": 1, "Q_OBJECT": 1, "*instance": 1, + "BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP": 3, + "#if": 63, + "defined": 49, + "_MSC_VER": 7, + "&&": 29, + "": 1, + "BOOST_ASIO_HAS_EPOLL": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "BOOST_ASIO_HAS_TIMERFD": 19, + "": 1, + "boost": 18, + "asio": 14, + "detail": 5, + "epoll_reactor": 40, + "io_service": 6, + "service_base": 1, + "": 1, + "io_service_": 1, + "use_service": 1, + "": 1, + "mutex_": 13, + "interrupter_": 5, + "epoll_fd_": 20, + "do_epoll_create": 3, + "timer_fd_": 21, + "do_timerfd_create": 3, + "shutdown_": 10, + "epoll_event": 10, + "ev": 21, + "ev.events": 13, + "EPOLLIN": 8, + "EPOLLERR": 8, + "EPOLLET": 5, + "ev.data.ptr": 10, + "epoll_ctl": 12, + "EPOLL_CTL_ADD": 7, + "interrupter_.read_descriptor": 3, + "interrupter_.interrupt": 2, + "shutdown_service": 1, + "mutex": 16, + "scoped_lock": 16, + "lock": 5, + "lock.unlock": 1, + "op_queue": 6, + "": 6, + "ops": 10, + "descriptor_state*": 6, + "registered_descriptors_.first": 2, + "i": 106, + "max_ops": 6, + "ops.push": 5, + "op_queue_": 12, + "registered_descriptors_.free": 2, + "timer_queues_.get_all_timers": 1, + "io_service_.abandon_operations": 1, + "fork_service": 1, + "fork_event": 1, + "fork_ev": 2, + "fork_child": 1, + "interrupter_.recreate": 1, + "update_timeout": 2, + "descriptors_lock": 3, + "registered_descriptors_mutex_": 3, + "next_": 3, + "registered_events_": 8, + "descriptor_": 5, + "error_code": 4, + "ec": 6, + "errno": 10, + "get_system_category": 3, + "throw_error": 2, + "init_task": 1, + "io_service_.init_task": 1, + "register_descriptor": 1, + "socket_type": 7, + "descriptor": 15, + "per_descriptor_data": 8, + "descriptor_data": 60, + "allocate_descriptor_state": 3, + "descriptor_lock": 7, + "reactor_": 7, + "EPOLLHUP": 3, + "EPOLLPRI": 3, + "register_internal_descriptor": 1, + "op_type": 8, + "reactor_op*": 5, + "op": 28, + ".push": 2, + "move_descriptor": 1, + "target_descriptor_data": 2, + "source_descriptor_data": 3, + "start_op": 1, + "is_continuation": 5, + "allow_speculative": 2, + "ec_": 4, + "bad_descriptor": 1, + "post_immediate_completion": 2, + ".empty": 5, + "read_op": 1, + "||": 19, + "except_op": 1, + "perform": 2, + "descriptor_lock.unlock": 4, + "io_service_.post_immediate_completion": 2, + "write_op": 2, + "EPOLLOUT": 4, + "EPOLL_CTL_MOD": 3, + "io_service_.work_started": 2, + "cancel_ops": 1, + ".front": 3, + "operation_aborted": 2, + ".pop": 3, + "io_service_.post_deferred_completions": 3, + "deregister_descriptor": 1, + "EPOLL_CTL_DEL": 2, + "free_descriptor_state": 3, + "deregister_internal_descriptor": 1, + "get_timeout": 5, + "events": 8, + "num_events": 2, + "epoll_wait": 1, + "check_timers": 6, + "#else": 35, + "void*": 2, + "ptr": 6, + ".data.ptr": 1, + "static_cast": 14, + "": 2, + "set_ready_events": 1, + ".events": 1, + "common_lock": 1, + "timer_queues_.get_ready_timers": 1, + "itimerspec": 5, + "new_timeout": 6, + "old_timeout": 4, + "flags": 4, + "timerfd_settime": 2, + "EPOLL_CLOEXEC": 4, + "fd": 15, + "epoll_create1": 1, + "EINVAL": 4, + "ENOSYS": 1, + "epoll_create": 1, + "epoll_size": 1, + "fcntl": 2, + "F_SETFD": 2, + "FD_CLOEXEC": 2, + "timerfd_create": 2, + "TFD_CLOEXEC": 1, + "registered_descriptors_.alloc": 1, + "do_add_timer_queue": 1, + "timer_queue_base": 2, + "queue": 4, + "timer_queues_.insert": 1, + "do_remove_timer_queue": 1, + "timer_queues_.erase": 1, + "timer_queues_.wait_duration_msec": 1, + "ts": 1, + "ts.it_interval.tv_sec": 1, + "ts.it_interval.tv_nsec": 1, + "usec": 5, + "timer_queues_.wait_duration_usec": 1, + "ts.it_value.tv_sec": 1, + "ts.it_value.tv_nsec": 1, + "TFD_TIMER_ABSTIME": 1, + "perform_io_cleanup_on_block_exit": 4, + "explicit": 5, + "epoll_reactor*": 2, + "r": 38, + "first_op_": 3, + "ops_.empty": 1, + "ops_": 2, + "operation*": 4, + "descriptor_state": 5, + "operation": 2, + "do_complete": 2, + "perform_io": 2, + "mutex_.lock": 1, + "io_cleanup": 1, + "adopt_lock": 1, + "j": 10, + "io_cleanup.ops_.push": 1, + "break": 35, + "io_cleanup.first_op_": 2, + "io_cleanup.ops_.front": 1, + "io_cleanup.ops_.pop": 1, + "io_service_impl*": 1, + "owner": 3, + "size_t": 6, + "bytes_transferred": 2, + "": 1, + "": 1, "Field": 2, "Free": 1, "Black": 1, @@ -11152,7 +13198,6 @@ "*rr": 1, "*zero": 1, "n": 28, - "i": 47, "BN_CTX_start": 1, "BN_CTX_get": 8, "EC_GROUP_get_order": 1, @@ -11160,7 +13205,6 @@ "BN_mul_word": 1, "BN_add": 1, "ecsig": 3, - "r": 36, "EC_GROUP_get_curve_GFp": 1, "BN_cmp": 1, "R": 6, @@ -11218,13 +13262,11 @@ "nBitsR": 3, "BN_num_bits": 2, "nBitsS": 3, - "&&": 23, "nRecId": 4, "<4;>": 1, "keyRec": 5, - "1": 2, + "1": 4, "GetPubKey": 5, - "break": 34, "BN_bn2bin": 2, "/8": 2, "ECDSA_SIG_free": 2, @@ -11252,7 +13294,6 @@ "": 1, "": 1, "runtime_error": 2, - "explicit": 4, "str": 2, "CKeyID": 5, "uint160": 8, @@ -11271,7 +13312,6 @@ "vchPubKey.begin": 1, "vchPubKey.end": 1, "vchPubKey.size": 3, - "||": 17, "IsCompressed": 2, "Raw": 1, "secure_allocator": 2, @@ -11286,7 +13326,7 @@ "vchSecret": 1, "GetPrivKey": 1, "SetPubKey": 1, - "Sign": 1, + "Sign": 2, "LIBCANIH": 2, "": 1, "": 1, @@ -11294,7 +13334,6 @@ "//#define": 1, "DEBUG": 5, "dout": 2, - "#else": 25, "cerr": 1, "libcanister": 2, "//the": 8, @@ -11353,7 +13392,7 @@ "canister*": 1, "parent": 1, "//internal": 1, - "id": 1, + "id": 4, "//use": 1, "own.": 1, "newline": 2, @@ -11401,7 +13440,6 @@ "getFile": 1, "otherwise": 1, "overwrites": 1, - "operation": 1, "succeeded": 2, "writeFile": 2, "//get": 1, @@ -11417,14 +13455,13 @@ "avoid": 1, "uncaching": 1, "//really": 1, - "just": 1, + "just": 2, "internally": 1, "harm.": 1, "cacheclean": 1, "dFlush": 1, "Q_OS_LINUX": 2, "": 1, - "#if": 44, "QT_VERSION": 1, "QT_VERSION_CHECK": 1, "#error": 9, @@ -11460,6 +13497,138 @@ "phantom.execute": 1, "app.exec": 1, "phantom.returnValue": 1, + "__OG_MATH_INL__": 2, + "og": 1, + "OG_INLINE": 41, + "Math": 41, + "Abs": 1, + "MASK_SIGNED": 2, + "y": 16, + "Fabs": 1, + "f": 104, + "uInt": 1, + "*pf": 1, + "reinterpret_cast": 8, + "": 1, + "pf": 1, + "fabsf": 1, + "Round": 1, + "floorf": 2, + "Floor": 1, + "Ceil": 1, + "ceilf": 1, + "Ftoi": 1, + "@todo": 1, + "note": 1, + "sse": 1, + "cvttss2si": 2, + "OG_ASM_MSVC": 4, + "OG_FTOI_USE_SSE": 2, + "SysInfo": 2, + "cpu.general.SSE": 2, + "__asm": 8, + "eax": 5, + "mov": 6, + "fld": 4, + "fistp": 3, + "//__asm": 3, + "O_o": 3, + "#elif": 7, + "OG_ASM_GNU": 4, + "__asm__": 4, + "__volatile__": 4, + "cast": 7, + "why": 3, + "did": 3, + "": 3, + "FtoiFast": 2, + "Ftol": 1, + "": 1, + "Fmod": 1, + "numerator": 2, + "denominator": 2, + "fmodf": 1, + "Modf": 2, + "modff": 2, + "Sqrt": 2, + "sqrtf": 2, + "InvSqrt": 1, + "OG_ASSERT": 4, + "RSqrt": 1, + "g": 2, + "*reinterpret_cast": 3, + "guess": 1, + "f375a86": 1, + "": 1, + "Newtons": 1, + "calculation": 1, + "Log": 1, + "logf": 3, + "Log2": 1, + "INV_LN_2": 1, + "Log10": 1, + "INV_LN_10": 1, + "Pow": 1, + "exp": 2, + "powf": 1, + "Exp": 1, + "expf": 1, + "IsPowerOfTwo": 4, + "faster": 3, + "two": 2, + "known": 1, + "methods": 2, + "moved": 1, + "beginning": 1, + "HigherPowerOfTwo": 4, + "LowerPowerOfTwo": 2, + "FloorPowerOfTwo": 1, + "CeilPowerOfTwo": 1, + "ClosestPowerOfTwo": 1, + "Digits": 1, + "digits": 6, + "step": 3, + "Sin": 2, + "sinf": 1, + "ASin": 1, + "<=>": 2, + "0f": 2, + "HALF_PI": 2, + "asinf": 1, + "Cos": 2, + "cosf": 1, + "ACos": 1, + "PI": 1, + "acosf": 1, + "Tan": 1, + "tanf": 1, + "ATan": 2, + "atanf": 1, + "f1": 2, + "f2": 2, + "atan2f": 1, + "SinCos": 1, + "sometimes": 1, + "assembler": 1, + "waaayy": 1, + "_asm": 1, + "fsincos": 1, + "ecx": 2, + "edx": 2, + "fstp": 2, + "dword": 2, + "asm": 1, + "Deg2Rad": 1, + "DEG_TO_RAD": 1, + "Rad2Deg": 1, + "RAD_TO_DEG": 1, + "Square": 1, + "v": 10, + "Cube": 1, + "Sec2Ms": 1, + "sec": 2, + "Ms2Sec": 1, + "ms": 2, "NINJA_METRICS_H_": 3, "int64_t.": 1, "Metrics": 2, @@ -11524,7 +13693,6 @@ "Seconds": 1, "call.": 1, "Elapsed": 1, - "static_cast": 8, "": 1, "primary": 1, "metrics.": 1, @@ -11587,7 +13755,6 @@ "OnShutdown": 1, "StaticDescriptorInitializer_protocol_2dbuffer_2eproto": 2, "static_descriptor_initializer_protocol_2dbuffer_2eproto_": 1, - "_MSC_VER": 3, "kNameFieldNumber": 2, "Message": 7, "SharedCtor": 4, @@ -11600,7 +13767,6 @@ "SetCachedSize": 2, "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN": 2, "GOOGLE_SAFE_CONCURRENT_WRITES_END": 2, - "descriptor": 2, "*default_instance_": 1, "Person*": 7, "xffu": 3, @@ -11636,7 +13802,6 @@ "SERIALIZE": 2, "WriteString": 1, "unknown_fields": 7, - ".empty": 3, "SerializeUnknownFields": 1, "uint8*": 4, "SerializeWithCachedSizesToArray": 2, @@ -11691,7 +13856,6 @@ "UnknownFieldSet*": 1, "GetCachedSize": 1, "clear_name": 2, - "size_t": 5, "release_name": 2, "set_allocated_name": 2, "set_has_name": 7, @@ -11700,7 +13864,6 @@ "u": 9, "*name_": 1, "assign": 3, - "reinterpret_cast": 7, "temp": 2, "SWIG": 2, "QSCICOMMAND_H": 2, @@ -11713,7 +13876,6 @@ "represents": 1, "editor": 1, "command": 9, - "two": 1, "keys": 3, "bound": 4, "Methods": 1, @@ -12061,7 +14223,6 @@ "drawing": 4, "actually": 1, "sized.": 1, - "methods": 1, "area": 5, "draw": 1, "text.": 3, @@ -12122,11 +14283,9 @@ "expected_length": 4, "ASSERT": 17, "overflow": 1, - "digits": 3, "c0_": 64, "d": 8, "HexValue": 2, - "j": 4, "PushBack": 8, "Advance": 44, "STATIC_ASSERT": 5, @@ -12140,7 +14299,6 @@ "COLON": 2, "SEMICOLON": 2, "CONDITIONAL": 2, - "f": 5, "LBRACK": 2, "RBRACK": 2, "LBRACE": 2, @@ -12148,7 +14306,6 @@ "BIT_NOT": 2, "Next": 3, "current_": 2, - "next_": 2, "has_multiline_comment_before_next_": 5, "token": 64, "": 1, @@ -12220,7 +14377,6 @@ "IsCarriageReturn": 2, "IsLineFeed": 2, "fall": 2, - "v": 3, "xxx": 1, "immediately": 1, "octal": 1, @@ -12233,7 +14389,6 @@ "E": 3, "l": 1, "w": 1, - "y": 13, "keyword": 1, "Unescaped": 1, "in_character_class": 2, @@ -12304,7 +14459,6 @@ "": 6, "kASCIISize": 1, "ConvertToUtf16": 2, - "*reinterpret_cast": 1, "": 2, "kUC16Size": 2, "is_ascii": 3, @@ -12406,7 +14560,6 @@ "QtMsgType": 1, "dump_path": 1, "minidump_id": 1, - "void*": 1, "context": 8, "QVariant": 1, "coffee2js": 1, @@ -12479,7 +14632,6 @@ "FLAG_random_seed": 2, "val": 3, "ScopedLock": 1, - "lock": 1, "entropy_mutex.Pointer": 1, "random": 1, "random_base": 3, @@ -12530,7 +14682,6 @@ "r.double_value": 3, "r.uint64_t_value": 1, "HeapNumber": 1, - "cast": 1, "set_value": 1, "InitializeOncePerProcessImpl": 3, "SetUp": 4, @@ -12551,7 +14702,6 @@ "ExternalReference": 1, "CallOnce": 1, "V8_V8_H_": 3, - "defined": 21, "GOOGLE3": 2, "NDEBUG": 4, "both": 1, @@ -12590,7 +14740,6 @@ "PY_VERSION_HEX": 9, "METH_COEXIST": 1, "PyDict_CheckExact": 1, - "op": 6, "Py_TYPE": 4, "PyDict_Type": 1, "PyDict_Contains": 1, @@ -12764,7 +14913,6 @@ "CYTHON_INLINE": 68, "__GNUC__": 5, "__inline__": 1, - "#elif": 3, "__inline": 1, "__STDC_VERSION__": 2, "L": 1, @@ -14212,48 +16360,510 @@ "ip.join": 1 }, "Common Lisp": { - ";": 10, - "-": 10, + ";": 152, + "@file": 1, + "macros": 2, + "-": 161, + "advanced.cl": 1, + "@breif": 1, + "Advanced": 1, + "macro": 5, + "practices": 1, + "defining": 1, + "your": 1, + "own": 1, + "Macro": 1, + "definition": 1, + "skeleton": 1, + "(": 365, + "defmacro": 5, + "name": 6, + "parameter*": 1, + ")": 372, + "body": 8, + "form*": 1, + "Note": 2, + "that": 5, + "backquote": 1, + "expression": 2, + "is": 6, + "most": 2, + "often": 1, + "used": 2, + "in": 23, + "the": 35, + "form": 1, + "primep": 4, + "test": 1, + "a": 7, + "number": 2, + "for": 3, + "prime": 12, + "defun": 23, + "n": 8, + "if": 14, + "<": 1, + "return": 3, + "from": 8, + "do": 9, + "i": 8, + "+": 35, + "p": 10, + "t": 7, + "not": 6, + "zerop": 1, + "mod": 1, + "sqrt": 1, + "when": 4, + "next": 11, + "bigger": 1, + "than": 1, + "specified": 2, + "The": 2, + "recommended": 1, + "procedures": 1, + "to": 4, + "writting": 1, + "new": 6, + "are": 2, + "as": 1, + "follows": 1, + "Write": 2, + "sample": 2, + "call": 2, + "and": 12, + "code": 2, + "it": 2, + "should": 1, + "expand": 1, + "into": 2, + "primes": 3, + "format": 3, + "Expected": 1, + "expanded": 1, + "codes": 1, + "generate": 1, + "hardwritten": 1, + "expansion": 2, + "arguments": 1, + "var": 49, + "range": 4, + "&": 8, + "rest": 5, + "let": 6, + "first": 5, + "start": 5, + "second": 3, + "end": 8, + "third": 2, + "@body": 4, + "More": 1, + "concise": 1, + "implementations": 1, + "with": 7, + "synonym": 1, + "also": 1, + "emits": 1, + "more": 1, + "friendly": 1, + "messages": 1, + "on": 1, + "incorrent": 1, + "input.": 1, + "Test": 1, + "result": 1, + "of": 3, + "macroexpand": 2, + "function": 2, + "gensyms": 4, + "value": 8, + "Define": 1, + "note": 1, + "how": 1, + "comma": 1, + "interpolate": 1, + "loop": 2, + "names": 2, + "collect": 1, + "gensym": 1, + "#": 15, + "|": 9, + "ESCUELA": 1, + "POLITECNICA": 1, + "SUPERIOR": 1, + "UNIVERSIDAD": 1, + "AUTONOMA": 1, + "DE": 1, + "MADRID": 1, + "INTELIGENCIA": 1, + "ARTIFICIAL": 1, + "Motor": 1, + "de": 2, + "inferencia": 1, + "Basado": 1, + "en": 2, + "parte": 1, + "Peter": 1, + "Norvig": 1, + "Global": 1, + "variables": 6, + "defvar": 4, + "*hypothesis": 1, + "list*": 7, + "*rule": 4, + "*fact": 2, + "Constants": 1, + "defconstant": 2, + "fail": 10, + "nil": 3, + "no": 6, + "bindings": 45, + "lambda": 4, + "b": 6, + "mapcar": 2, + "man": 3, + "luis": 1, + "pedro": 1, + "woman": 2, + "mart": 1, + "daniel": 1, + "laura": 1, + "facts": 1, + "x": 47, + "aux": 3, + "unify": 12, + "hypothesis": 10, + "list": 9, + "____________________________________________________________________________": 5, + "FUNCTION": 3, + "FIND": 1, + "RULES": 2, + "COMMENTS": 3, + "Returns": 2, + "rules": 5, + "whose": 1, + "THENs": 1, + "term": 1, + "given": 3, + "": 2, + "satisfy": 1, + "this": 1, + "requirement": 1, + "renamed.": 1, + "EXAMPLES": 2, + "setq": 1, + "renamed": 3, + "rule": 17, + "rename": 1, + "then": 7, + "unless": 3, + "null": 1, + "equal": 4, + "VALUE": 1, + "FROM": 1, + "all": 2, + "solutions": 1, + "found": 5, + "using": 1, + "": 1, + ".": 10, + "single": 1, + "can": 4, + "have": 1, + "multiple": 1, + "solutions.": 1, + "mapcan": 1, + "R1": 2, + "pertenece": 3, + "E": 4, + "_": 8, + "R2": 2, + "Xs": 2, + "Then": 1, + "EVAL": 2, + "RULE": 2, + "PERTENECE": 6, + "E.42": 2, + "returns": 4, + "NIL": 3, + "That": 2, + "query": 4, + "be": 2, + "proven": 2, + "binding": 17, + "necessary": 2, + "fact": 4, + "has": 1, + "On": 1, + "other": 1, + "hand": 1, + "E.49": 2, + "XS.50": 2, + "R2.": 1, + "eval": 6, + "ifs": 1, + "NOT": 2, + "question": 1, + "T": 1, + "equality": 2, + "UNIFY": 1, + "Finds": 1, + "general": 1, + "unifier": 1, + "two": 2, + "input": 2, + "expressions": 2, + "taking": 1, + "account": 1, + "": 1, + "In": 1, + "case": 1, + "total": 1, + "unification.": 1, + "Otherwise": 1, + "which": 1, + "constant": 1, + "anonymous": 4, + "make": 4, + "variable": 6, + "Auxiliary": 1, + "Functions": 1, + "cond": 3, + "or": 4, + "get": 5, + "lookup": 5, + "occurs": 5, + "extend": 2, + "symbolp": 2, + "eql": 2, + "char": 2, + "symbol": 2, + "assoc": 1, + "car": 2, + "val": 6, + "cdr": 2, + "cons": 2, + "append": 1, + "eq": 7, + "consp": 2, + "subst": 3, + "listp": 1, + "exp": 1, + "unique": 3, + "find": 6, + "anywhere": 6, + "predicate": 8, + "tree": 11, + "optional": 2, + "so": 4, + "far": 4, + "atom": 3, + "funcall": 2, + "pushnew": 1, + "gentemp": 2, + "quote": 3, + "s/reuse": 1, + "cons/cons": 1, + "expresion": 2, + "some": 1, + "EOF": 1, "*": 2, "lisp": 1, - "(": 14, - "in": 1, "package": 1, "foo": 2, - ")": 14, "Header": 1, "comment.": 4, - "defvar": 1, "*foo*": 1, - "eval": 1, - "when": 1, "execute": 1, "compile": 1, "toplevel": 2, "load": 1, - "defun": 1, "add": 1, - "x": 5, - "&": 3, - "optional": 1, "y": 2, "key": 1, "z": 2, "declare": 1, "ignore": 1, "Inline": 1, - "+": 2, - "or": 1, - "#": 2, - "|": 2, "Multi": 1, "line": 2, - "defmacro": 1, - "body": 1, - "b": 1, - "if": 1, "After": 1 }, + "Component Pascal": { + "MODULE": 2, + "ObxControls": 1, + ";": 123, + "IMPORT": 2, + "Dialog": 1, + "Ports": 1, + "Properties": 1, + "Views": 1, + "CONST": 1, + "beginner": 5, + "advanced": 3, + "expert": 1, + "guru": 2, + "TYPE": 1, + "View": 6, + "POINTER": 2, + "TO": 2, + "RECORD": 2, + "(": 91, + "Views.View": 2, + ")": 94, + "size": 1, + "INTEGER": 10, + "END": 31, + "VAR": 9, + "data*": 1, + "class*": 1, + "list*": 1, + "Dialog.List": 1, + "width*": 1, + "predef": 12, + "ARRAY": 2, + "OF": 2, + "PROCEDURE": 12, + "SetList": 4, + "BEGIN": 13, + "IF": 11, + "data.class": 5, + "THEN": 12, + "data.list.SetLen": 3, + "data.list.SetItem": 11, + "ELSIF": 1, + "ELSE": 3, + "v": 6, + "CopyFromSimpleView": 2, + "source": 2, + "v.size": 10, + ".size": 1, + "Restore": 2, + "f": 1, + "Views.Frame": 1, + "l": 1, + "t": 1, + "r": 7, + "b": 1, + "[": 13, + "]": 13, + "f.DrawRect": 1, + "Ports.fill": 1, + "Ports.red": 1, + "HandlePropMsg": 2, + "msg": 2, + "Views.PropMessage": 1, + "WITH": 1, + "Properties.SizePref": 1, + "DO": 4, + "msg.w": 1, + "msg.h": 1, + "ClassNotify*": 1, + "op": 4, + "from": 2, + "to": 5, + "Dialog.changed": 2, + "OR": 4, + "&": 8, + "data.list.index": 3, + "data.width": 4, + "Dialog.Update": 2, + "data": 2, + "Dialog.UpdateList": 1, + "data.list": 1, + "ClassNotify": 1, + "ListNotify*": 1, + "ListNotify": 1, + "ListGuard*": 1, + "par": 2, + "Dialog.Par": 2, + "par.disabled": 1, + "ListGuard": 1, + "WidthGuard*": 1, + "par.readOnly": 1, + "#": 3, + "WidthGuard": 1, + "Open*": 1, + "NEW": 2, + "*": 1, + "Ports.mm": 1, + "Views.OpenAux": 1, + "Open": 1, + "ObxControls.": 1, + "ObxFact": 1, + "Stores": 1, + "Models": 1, + "TextModels": 1, + "TextControllers": 1, + "Integers": 1, + "Read": 3, + "TextModels.Reader": 2, + "x": 15, + "Integers.Integer": 3, + "i": 17, + "len": 5, + "beg": 11, + "ch": 14, + "CHAR": 3, + "buf": 5, + "r.ReadChar": 5, + "WHILE": 3, + "r.eot": 4, + "<=>": 1, + "ReadChar": 1, + "ASSERT": 1, + "eot": 1, + "<": 8, + "r.Pos": 2, + "-": 1, + "REPEAT": 3, + "INC": 4, + "UNTIL": 3, + "+": 1, + "r.SetPos": 2, + "X": 1, + "Integers.ConvertFromString": 1, + "Write": 3, + "w": 4, + "TextModels.Writer": 2, + "Integers.Sign": 2, + "w.WriteChar": 3, + "Integers.Digits10Of": 1, + "DEC": 1, + "Integers.ThisDigit10": 1, + "Compute*": 1, + "end": 6, + "n": 3, + "s": 3, + "Stores.Operation": 1, + "attr": 3, + "TextModels.Attributes": 1, + "c": 3, + "TextControllers.Controller": 1, + "TextControllers.Focus": 1, + "NIL": 3, + "c.HasSelection": 1, + "c.GetSelection": 1, + "c.text.NewReader": 1, + "r.ReadPrev": 2, + "r.attr": 1, + "Integers.Compare": 1, + "Integers.Long": 3, + "MAX": 1, + "LONGINT": 1, + "SHORT": 1, + "Integers.Short": 1, + "Integers.Product": 1, + "Models.BeginScript": 1, + "c.text": 2, + "c.text.Delete": 1, + "c.text.NewWriter": 1, + "w.SetPos": 1, + "w.SetAttr": 1, + "Models.EndScript": 1, + "Compute": 1, + "ObxFact.": 1 + }, "Coq": { "Inductive": 41, "day": 9, @@ -15681,6 +18291,253 @@ "Ruby": 1, "distribution.": 1 }, + "Crystal": { + "SHEBANG#!bin/crystal": 2, + "require": 2, + "describe": 2, + "do": 26, + "it": 21, + "run": 14, + "(": 201, + ")": 201, + ".to_i.should": 11, + "eq": 16, + "end": 135, + ".to_f32.should": 2, + ".to_b.should": 1, + "be_true": 1, + "assert_type": 7, + "{": 7, + "int32": 8, + "}": 7, + "union_of": 1, + "char": 1, + "result": 3, + "types": 3, + "[": 9, + "]": 9, + "mod": 1, + "result.program": 1, + "foo": 3, + "mod.types": 1, + "as": 4, + "NonGenericClassType": 1, + "foo.instance_vars": 1, + ".type.should": 3, + "mod.int32": 1, + "GenericClassType": 2, + "foo_i32": 4, + "foo.instantiate": 2, + "of": 3, + "Type": 2, + "|": 8, + "ASTNode": 4, + "foo_i32.lookup_instance_var": 2, + "module": 1, + "Crystal": 1, + "class": 2, + "def": 84, + "transform": 81, + "transformer": 1, + "transformer.before_transform": 1, + "self": 77, + "node": 164, + "transformer.transform": 1, + "transformer.after_transform": 1, + "Transformer": 1, + "before_transform": 1, + "after_transform": 1, + "Expressions": 2, + "exps": 6, + "node.expressions.each": 1, + "exp": 3, + "new_exp": 3, + "exp.transform": 3, + "if": 23, + "new_exp.is_a": 1, + "exps.concat": 1, + "new_exp.expressions": 1, + "else": 2, + "<<": 1, + "exps.length": 1, + "node.expressions": 3, + "Call": 1, + "node_obj": 1, + "node.obj": 9, + "node_obj.transform": 1, + "transform_many": 23, + "node.args": 3, + "node_block": 1, + "node.block": 2, + "node_block.transform": 1, + "node_block_arg": 1, + "node.block_arg": 6, + "node_block_arg.transform": 1, + "And": 1, + "node.left": 3, + "node.left.transform": 3, + "node.right": 3, + "node.right.transform": 3, + "Or": 1, + "StringInterpolation": 1, + "ArrayLiteral": 1, + "node.elements": 1, + "node_of": 1, + "node.of": 2, + "node_of.transform": 1, + "HashLiteral": 1, + "node.keys": 1, + "node.values": 2, + "of_key": 1, + "node.of_key": 2, + "of_key.transform": 1, + "of_value": 1, + "node.of_value": 2, + "of_value.transform": 1, + "If": 1, + "node.cond": 5, + "node.cond.transform": 5, + "node.then": 3, + "node.then.transform": 3, + "node.else": 5, + "node.else.transform": 3, + "Unless": 1, + "IfDef": 1, + "MultiAssign": 1, + "node.targets": 1, + "SimpleOr": 1, + "Def": 1, + "node.body": 12, + "node.body.transform": 10, + "receiver": 2, + "node.receiver": 4, + "receiver.transform": 2, + "block_arg": 2, + "block_arg.transform": 2, + "Macro": 1, + "PointerOf": 1, + "node.exp": 3, + "node.exp.transform": 3, + "SizeOf": 1, + "InstanceSizeOf": 1, + "IsA": 1, + "node.obj.transform": 5, + "node.const": 1, + "node.const.transform": 1, + "RespondsTo": 1, + "Case": 1, + "node.whens": 1, + "node_else": 1, + "node_else.transform": 1, + "When": 1, + "node.conds": 1, + "ImplicitObj": 1, + "ClassDef": 1, + "superclass": 1, + "node.superclass": 2, + "superclass.transform": 1, + "ModuleDef": 1, + "While": 1, + "Generic": 1, + "node.name": 5, + "node.name.transform": 5, + "node.type_vars": 1, + "ExceptionHandler": 1, + "node.rescues": 1, + "node_ensure": 1, + "node.ensure": 2, + "node_ensure.transform": 1, + "Rescue": 1, + "node.types": 2, + "Union": 1, + "Hierarchy": 1, + "Metaclass": 1, + "Arg": 1, + "default_value": 1, + "node.default_value": 2, + "default_value.transform": 1, + "restriction": 1, + "node.restriction": 2, + "restriction.transform": 1, + "BlockArg": 1, + "node.fun": 1, + "node.fun.transform": 1, + "Fun": 1, + "node.inputs": 1, + "output": 1, + "node.output": 2, + "output.transform": 1, + "Block": 1, + "node.args.map": 1, + "Var": 2, + "FunLiteral": 1, + "node.def.body": 1, + "node.def.body.transform": 1, + "FunPointer": 1, + "obj": 1, + "obj.transform": 1, + "Return": 1, + "node.exps": 5, + "Break": 1, + "Next": 1, + "Yield": 1, + "scope": 1, + "node.scope": 2, + "scope.transform": 1, + "Include": 1, + "Extend": 1, + "RangeLiteral": 1, + "node.from": 1, + "node.from.transform": 1, + "node.to": 2, + "node.to.transform": 2, + "Assign": 1, + "node.target": 1, + "node.target.transform": 1, + "node.value": 3, + "node.value.transform": 3, + "Nop": 1, + "NilLiteral": 1, + "BoolLiteral": 1, + "NumberLiteral": 1, + "CharLiteral": 1, + "StringLiteral": 1, + "SymbolLiteral": 1, + "RegexLiteral": 1, + "MetaVar": 1, + "InstanceVar": 1, + "ClassVar": 1, + "Global": 1, + "Require": 1, + "Path": 1, + "Self": 1, + "LibDef": 1, + "FunDef": 1, + "body": 1, + "body.transform": 1, + "TypeDef": 1, + "StructDef": 1, + "UnionDef": 1, + "EnumDef": 1, + "ExternalVar": 1, + "IndirectRead": 1, + "IndirectWrite": 1, + "TypeOf": 1, + "Primitive": 1, + "Not": 1, + "TypeFilteredNode": 1, + "TupleLiteral": 1, + "Cast": 1, + "DeclareVar": 1, + "node.var": 1, + "node.var.transform": 1, + "node.declared_type": 1, + "node.declared_type.transform": 1, + "Alias": 1, + "TupleIndexer": 1, + "Attribute": 1, + "exps.map": 1 + }, "CSS": { ".clearfix": 8, "{": 1661, @@ -16644,6 +19501,684 @@ "#undef": 1, "Undefine": 1 }, + "Dogescript": { + "quiet": 1, + "wow": 4, + "such": 2, + "language": 3, + "very": 1, + "syntax": 1, + "github": 1, + "recognized": 1, + "loud": 1, + "much": 1, + "friendly": 2, + "rly": 1, + "is": 2, + "true": 1, + "plz": 2, + "console.loge": 2, + "with": 2, + "but": 1, + "module.exports": 1 + }, + "E": { + "def": 24, + "makeVehicle": 3, + "(": 65, + "self": 1, + ")": 64, + "{": 57, + "vehicle": 2, + "to": 27, + "milesTillEmpty": 1, + "return": 19, + "self.milesPerGallon": 1, + "*": 1, + "self.getFuelRemaining": 1, + "}": 57, + "makeCar": 4, + "var": 6, + "fuelRemaining": 4, + "car": 8, + "extends": 2, + "milesPerGallon": 2, + "getFuelRemaining": 2, + "makeJet": 1, + "jet": 3, + "println": 2, + "The": 2, + "can": 1, + "go": 1, + "car.milesTillEmpty": 1, + "miles.": 1, + "name": 4, + "x": 3, + "y": 3, + "moveTo": 1, + "newX": 2, + "newY": 2, + "getX": 1, + "getY": 1, + "setName": 1, + "newName": 2, + "getName": 1, + "sportsCar": 1, + "sportsCar.moveTo": 1, + "sportsCar.getName": 1, + "is": 1, + "at": 1, + "X": 1, + "location": 1, + "sportsCar.getX": 1, + "makeVOCPair": 1, + "brandName": 3, + "String": 1, + "near": 6, + "myTempContents": 6, + "none": 2, + "brand": 5, + "__printOn": 4, + "out": 4, + "TextWriter": 4, + "void": 5, + "out.print": 4, + "ProveAuth": 2, + "<$brandName>": 3, + "prover": 1, + "getBrand": 4, + "coerce": 2, + "specimen": 2, + "optEjector": 3, + "sealedBox": 2, + "offerContent": 1, + "CheckAuth": 2, + "checker": 3, + "template": 1, + "match": 4, + "[": 10, + "get": 2, + "authList": 2, + "any": 2, + "]": 10, + "specimenBox": 2, + "null": 1, + "if": 2, + "specimenBox.__respondsTo": 1, + "specimenBox.offerContent": 1, + "else": 1, + "for": 3, + "auth": 3, + "in": 1, + "throw.eject": 1, + "Unmatched": 1, + "authorization": 1, + "__respondsTo": 2, + "_": 3, + "true": 1, + "false": 1, + "__getAllegedType": 1, + "null.__getAllegedType": 1, + "#File": 1, + "objects": 1, + "hardwired": 1, + "files": 1, + "file1": 1, + "": 1, + "file2": 1, + "": 1, + "#Using": 2, + "a": 4, + "variable": 1, + "file": 3, + "filePath": 2, + "file3": 1, + "": 1, + "single": 1, + "character": 1, + "specify": 1, + "Windows": 1, + "drive": 1, + "file4": 1, + "": 1, + "file5": 1, + "": 1, + "file6": 1, + "": 1, + "pragma.syntax": 1, + "send": 1, + "message": 4, + "when": 2, + "friend": 4, + "<-receive(message))>": 1, + "chatUI.showMessage": 4, + "catch": 2, + "prob": 2, + "receive": 1, + "receiveFriend": 2, + "friendRcvr": 2, + "bind": 2, + "save": 1, + "file.setText": 1, + "makeURIFromObject": 1, + "chatController": 2, + "load": 1, + "getObjectFromURI": 1, + "file.getText": 1, + "<": 1, + "-": 2, + "tempVow": 2, + "#...use": 1, + "#....": 1, + "report": 1, + "problem": 1, + "finally": 1, + "#....log": 1, + "event": 1 + }, + "Eagle": { + "": 2, + "version=": 4, + "encoding=": 2, + "": 2, + "eagle": 4, + "SYSTEM": 2, + "dtd": 2, + "": 2, + "": 2, + "": 2, + "": 4, + "alwaysvectorfont=": 2, + "verticaltext=": 2, + "": 2, + "": 2, + "distance=": 2, + "unitdist=": 2, + "unit=": 2, + "style=": 2, + "multiple=": 2, + "display=": 2, + "altdistance=": 2, + "altunitdist=": 2, + "altunit=": 2, + "": 2, + "": 118, + "number=": 119, + "name=": 447, + "color=": 118, + "fill=": 118, + "visible=": 118, + "active=": 125, + "": 2, + "": 1, + "": 1, + "": 497, + "x1=": 630, + "y1=": 630, + "x2=": 630, + "y2=": 630, + "width=": 512, + "layer=": 822, + "": 1, + "": 2, + "": 4, + "": 60, + "&": 5501, + "lt": 2665, + ";": 5567, + "b": 64, + "gt": 2770, + "Resistors": 2, + "Capacitors": 4, + "Inductors": 2, + "/b": 64, + "p": 65, + "Based": 2, + "on": 2, + "the": 5, + "previous": 2, + "libraries": 2, + "ul": 2, + "li": 12, + "r.lbr": 2, + "cap.lbr": 2, + "cap": 2, + "-": 768, + "fe.lbr": 2, + "captant.lbr": 2, + "polcap.lbr": 2, + "ipc": 2, + "smd.lbr": 2, + "/ul": 2, + "All": 2, + "SMD": 4, + "packages": 2, + "are": 2, + "defined": 2, + "according": 2, + "to": 3, + "IPC": 2, + "specifications": 2, + "and": 5, + "CECC": 2, + "author": 3, + "Created": 3, + "by": 3, + "librarian@cadsoft.de": 3, + "/author": 3, + "for": 5, + "Electrolyt": 2, + "see": 4, + "also": 2, + "www.bccomponents.com": 2, + "www.panasonic.com": 2, + "www.kemet.com": 2, + "http": 4, + "//www.secc.co.jp/pdf/os_e/2004/e_os_all.pdf": 2, + "(": 4, + "SANYO": 2, + ")": 4, + "trimmer": 2, + "refence": 2, + "u": 2, + "www.electrospec": 2, + "inc.com/cross_references/trimpotcrossref.asp": 2, + "/u": 2, + "table": 2, + "border": 2, + "cellspacing": 2, + "cellpadding": 2, + "width": 6, + "cellpaddding": 2, + "tr": 2, + "valign": 2, + "td": 4, + "amp": 66, + "nbsp": 66, + "/td": 4, + "font": 2, + "color": 20, + "size": 2, + "TRIM": 4, + "POT": 4, + "CROSS": 4, + "REFERENCE": 4, + "/font": 2, + "P": 128, + "TABLE": 4, + "BORDER": 4, + "CELLSPACING": 4, + "CELLPADDING": 4, + "TR": 36, + "TD": 170, + "COLSPAN": 16, + "FONT": 166, + "SIZE": 166, + "FACE": 166, + "ARIAL": 166, + "B": 106, + "RECTANGULAR": 2, + "MULTI": 6, + "TURN": 10, + "/B": 90, + "/FONT": 166, + "/TD": 170, + "/TR": 36, + "ALIGN": 124, + "CENTER": 124, + "BOURNS": 6, + "BI": 10, + "TECH": 10, + "DALE": 10, + "VISHAY": 10, + "PHILIPS/MEPCO": 10, + "MURATA": 6, + "PANASONIC": 10, + "SPECTROL": 6, + "MILSPEC": 6, + "BGCOLOR": 76, + "BR": 1478, + "W": 92, + "Y": 36, + "J": 12, + "L": 18, + "X": 82, + "PH": 2, + "XH": 2, + "SLT": 2, + "ALT": 42, + "T8S": 2, + "T18/784": 2, + "/1897": 2, + "/1880": 2, + "EKP/CT20/RJ": 2, + "RJ": 14, + "EKQ": 4, + "EKR": 4, + "EKJ": 2, + "EKL": 2, + "S": 18, + "EVMCOG": 2, + "T602": 2, + "RT/RTR12": 6, + "RJ/RJR12": 6, + "SQUARE": 2, + "BOURN": 4, + "H": 24, + "Z": 16, + "T63YB": 2, + "T63XB": 2, + "T93Z": 2, + "T93YA": 2, + "T93XA": 2, + "T93YB": 2, + "T93XB": 2, + "EKP": 8, + "EKW": 6, + "EKM": 4, + "EKB": 2, + "EKN": 2, + "P/CT9P": 2, + "P/3106P": 2, + "W/3106W": 2, + "X/3106X": 2, + "Y/3106Y": 2, + "Z/3105Z": 2, + "EVMCBG": 2, + "EVMCCG": 2, + "RT/RTR22": 8, + "RJ/RJR22": 6, + "RT/RTR26": 6, + "RJ/RJR26": 12, + "RT/RTR24": 6, + "RJ/RJR24": 12, + "SINGLE": 4, + "E": 6, + "K": 4, + "T": 10, + "V": 10, + "M": 10, + "R": 6, + "U": 4, + "C": 6, + "F": 4, + "RX": 6, + "PA": 2, + "A": 16, + "XW": 2, + "XL": 2, + "PM": 2, + "PX": 2, + "RXW": 2, + "RXL": 2, + "T7YB": 2, + "T7YA": 2, + "TXD": 2, + "TYA": 2, + "TYP": 2, + "TYD": 2, + "TX": 4, + "SX": 6, + "ET6P": 2, + "ET6S": 2, + "ET6X": 2, + "W/8014EMW": 2, + "P/8014EMP": 2, + "X/8014EMX": 2, + "TM7W": 2, + "TM7P": 2, + "TM7X": 2, + "SMS": 2, + "SMB": 2, + "SMA": 2, + "CT": 12, + "EKV": 2, + "EKX": 2, + "EKZ": 2, + "N": 2, + "RVA0911V304A": 2, + "RVA0911H413A": 2, + "RVG0707V100A": 2, + "RVA0607V": 2, + "RVA1214H213A": 2, + "EVMQ0G": 4, + "EVMQIG": 2, + "EVMQ3G": 2, + "EVMS0G": 2, + "EVMG0G": 2, + "EVMK4GA00B": 2, + "EVM30GA00B": 2, + "EVMK0GA00B": 2, + "EVM38GA00B": 2, + "EVMB6": 2, + "EVLQ0": 2, + "EVMMSG": 2, + "EVMMBG": 2, + "EVMMAG": 2, + "EVMMCS": 2, + "EVMM1": 2, + "EVMM0": 2, + "EVMM3": 2, + "RJ/RJR50": 6, + "/TABLE": 4, + "TOCOS": 4, + "AUX/KYOCERA": 4, + "G": 10, + "ST63Z": 2, + "ST63Y": 2, + "ST5P": 2, + "ST5W": 2, + "ST5X": 2, + "A/B": 2, + "C/D": 2, + "W/X": 2, + "ST5YL/ST53YL": 2, + "ST5YJ/5T53YJ": 2, + "ST": 14, + "EVM": 8, + "YS": 2, + "D": 2, + "G4B": 2, + "G4A": 2, + "TR04": 2, + "S1": 4, + "TRG04": 2, + "DVR": 2, + "CVR": 4, + "A/C": 2, + "ALTERNATE": 2, + "/tr": 2, + "/table": 2, + "": 60, + "": 4, + "": 53, + "RESISTOR": 52, + "": 64, + "x=": 240, + "y=": 242, + "dx=": 64, + "dy=": 64, + "": 108, + "size=": 114, + "NAME": 52, + "": 108, + "VALUE": 52, + "": 132, + "": 52, + "": 3, + "": 3, + "Pin": 1, + "Header": 1, + "Connectors": 1, + "PIN": 1, + "HEADER": 1, + "": 39, + "drill=": 41, + "shape=": 39, + "ratio=": 41, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "language=": 2, + "EAGLE": 2, + "Design": 5, + "Rules": 5, + "Die": 1, + "Standard": 1, + "sind": 1, + "so": 2, + "gew": 1, + "hlt": 1, + "dass": 1, + "sie": 1, + "f": 1, + "r": 1, + "die": 3, + "meisten": 1, + "Anwendungen": 1, + "passen.": 1, + "Sollte": 1, + "ihre": 1, + "Platine": 1, + "besondere": 1, + "Anforderungen": 1, + "haben": 1, + "treffen": 1, + "Sie": 1, + "erforderlichen": 1, + "Einstellungen": 1, + "hier": 1, + "und": 1, + "speichern": 1, + "unter": 1, + "einem": 1, + "neuen": 1, + "Namen": 1, + "ab.": 1, + "The": 1, + "default": 1, + "have": 2, + "been": 1, + "set": 1, + "cover": 1, + "a": 2, + "wide": 1, + "range": 1, + "of": 1, + "applications.": 1, + "Your": 1, + "particular": 1, + "design": 2, + "may": 1, + "different": 1, + "requirements": 1, + "please": 1, + "make": 1, + "necessary": 1, + "adjustments": 1, + "save": 1, + "your": 1, + "customized": 1, + "rules": 1, + "under": 1, + "new": 1, + "name.": 1, + "": 142, + "value=": 145, + "": 1, + "": 1, + "": 8, + "": 8, + "refer=": 7, + "": 1, + "": 1, + "": 3, + "library=": 3, + "package=": 3, + "smashed=": 3, + "": 6, + "": 3, + "1": 1, + "778": 1, + "16": 1, + "002": 1, + "": 1, + "": 1, + "": 3, + "": 4, + "element=": 4, + "pad=": 4, + "": 1, + "extent=": 1, + "": 3, + "": 2, + "": 8, + "": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "xreflabel=": 1, + "xrefpart=": 1, + "Frames": 1, + "Sheet": 2, + "Layout": 1, + "": 1, + "": 1, + "font=": 4, + "DRAWING_NAME": 1, + "LAST_DATE_TIME": 1, + "SHEET": 1, + "": 1, + "columns=": 1, + "rows=": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "prefix=": 1, + "uservalue=": 1, + "FRAME": 1, + "DIN": 1, + "A4": 1, + "landscape": 1, + "with": 1, + "location": 1, + "doc.": 1, + "field": 1, + "": 1, + "": 1, + "symbol=": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "wave": 10, + "soldering": 10, + "Source": 2, + "//download.siliconexpert.com/pdfs/2005/02/24/Semi_Ap/2/VSH/Resistor/dcrcwfre.pdf": 2, + "MELF": 8, + "type": 20, + "grid": 20, + "mm": 20, + "curve=": 56, + "": 12, + "radius=": 12 + }, "ECL": { "#option": 1, "(": 32, @@ -18026,6 +21561,3637 @@ "/cell": 2, "cell": 2 }, + "Frege": { + "module": 2, + "examples.CommandLineClock": 1, + "where": 39, + "data": 3, + "Date": 5, + "native": 4, + "java.util.Date": 1, + "new": 9, + "(": 339, + ")": 345, + "-": 730, + "IO": 13, + "MutableIO": 1, + "toString": 2, + "Mutable": 1, + "s": 21, + "ST": 1, + "String": 9, + "d.toString": 1, + "action": 2, + "to": 13, + "give": 2, + "us": 1, + "the": 20, + "current": 4, + "time": 1, + "as": 33, + "do": 38, + "d": 3, + "<->": 35, + "java": 5, + "lang": 2, + "Thread": 2, + "sleep": 4, + "takes": 1, + "a": 99, + "long": 4, + "and": 14, + "returns": 2, + "nothing": 2, + "but": 2, + "may": 1, + "throw": 1, + "an": 6, + "InterruptedException": 4, + "This": 2, + "is": 24, + "without": 1, + "doubt": 1, + "public": 1, + "static": 1, + "void": 2, + "millis": 1, + "throws": 4, + "Encoded": 1, + "in": 22, + "Frege": 1, + "argument": 1, + "type": 8, + "Long": 3, + "result": 11, + "does": 2, + "defined": 1, + "frege": 1, + "Lang": 1, + "main": 11, + "args": 2, + "forever": 1, + "print": 25, + "stdout.flush": 1, + "Thread.sleep": 4, + "examples.Concurrent": 1, + "import": 7, + "System.Random": 1, + "Java.Net": 1, + "URL": 2, + "Control.Concurrent": 1, + "C": 6, + "main2": 1, + "m": 2, + "<": 84, + "newEmptyMVar": 1, + "forkIO": 11, + "m.put": 3, + "replicateM_": 3, + "c": 33, + "m.take": 1, + "println": 25, + "example1": 1, + "putChar": 2, + "example2": 2, + "getLine": 2, + "case": 6, + "of": 32, + "Right": 6, + "n": 38, + "setReminder": 3, + "Left": 5, + "_": 60, + "+": 200, + "show": 24, + "L*n": 1, + "table": 1, + "mainPhil": 2, + "[": 120, + "fork1": 3, + "fork2": 3, + "fork3": 3, + "fork4": 3, + "fork5": 3, + "]": 116, + "mapM": 3, + "MVar": 3, + "1": 2, + "5": 1, + "philosopher": 7, + "Kant": 1, + "Locke": 1, + "Wittgenstein": 1, + "Nozick": 1, + "Mises": 1, + "return": 17, + "Int": 6, + "me": 13, + "left": 4, + "right": 4, + "g": 4, + "Random.newStdGen": 1, + "let": 8, + "phil": 4, + "tT": 2, + "g1": 2, + "Random.randomR": 2, + "L": 6, + "eT": 2, + "g2": 3, + "thinkTime": 3, + "*": 5, + "eatTime": 3, + "fl": 4, + "left.take": 1, + "rFork": 2, + "poll": 1, + "Just": 2, + "fr": 3, + "right.put": 1, + "left.put": 2, + "table.notifyAll": 2, + "Nothing": 2, + "table.wait": 1, + "inter": 3, + "catch": 2, + "getURL": 4, + "xx": 2, + "url": 1, + "URL.new": 1, + "con": 3, + "url.openConnection": 1, + "con.connect": 1, + "con.getInputStream": 1, + "typ": 5, + "con.getContentType": 1, + "stderr.println": 3, + "ir": 2, + "InputStreamReader.new": 2, + "fromMaybe": 1, + "charset": 2, + "unsupportedEncoding": 3, + "br": 4, + "BufferedReader": 1, + "getLines": 1, + "InputStream": 1, + "UnsupportedEncodingException": 1, + "InputStreamReader": 1, + "x": 45, + "x.catched": 1, + "ctyp": 2, + "charset=": 1, + "m.group": 1, + "SomeException": 2, + "Throwable": 1, + "m1": 1, + "MVar.newEmpty": 3, + "m2": 1, + "m3": 2, + "r": 7, + "catchAll": 3, + ".": 41, + "m1.put": 1, + "m2.put": 1, + "m3.put": 1, + "r1": 2, + "m1.take": 1, + "r2": 3, + "m2.take": 1, + "r3": 3, + "take": 13, + "ss": 8, + "mapM_": 5, + "putStrLn": 2, + "|": 62, + "x.getClass.getName": 1, + "y": 15, + "sum": 2, + "map": 49, + "length": 20, + "package": 2, + "examples.Sudoku": 1, + "Data.TreeMap": 1, + "Tree": 4, + "keys": 2, + "Data.List": 1, + "DL": 1, + "hiding": 1, + "find": 20, + "union": 10, + "Element": 6, + "Zelle": 8, + "set": 4, + "candidates": 18, + "Position": 22, + "Feld": 3, + "Brett": 13, + "for": 25, + "assumptions": 10, + "conclusions": 2, + "Assumption": 21, + "ISNOT": 14, + "IS": 16, + "derive": 2, + "Eq": 1, + "Ord": 1, + "instance": 1, + "Show": 1, + "p": 72, + "e": 15, + "pname": 10, + "e.show": 2, + "showcs": 5, + "cs": 27, + "joined": 4, + "Assumption.show": 1, + "elements": 12, + "all": 22, + "possible": 2, + "..": 1, + "positions": 16, + "rowstarts": 4, + "row": 20, + "starting": 3, + "colstarts": 3, + "column": 2, + "boxstarts": 3, + "box": 15, + "boxmuster": 3, + "pattern": 1, + "by": 3, + "adding": 1, + "upper": 2, + "position": 9, + "results": 1, + "real": 1, + "extract": 2, + "field": 9, + "getf": 16, + "f": 19, + "fs": 22, + "fst": 9, + "otherwise": 8, + "cell": 24, + "getc": 12, + "b": 113, + "snd": 20, + "compute": 5, + "list": 7, + "that": 18, + "belong": 3, + "same": 8, + "given": 3, + "z..": 1, + "z": 12, + "quot": 1, + "col": 17, + "mod": 3, + "ri": 2, + "div": 3, + "or": 15, + "depending": 1, + "on": 4, + "ci": 3, + "index": 3, + "middle": 2, + "check": 2, + "if": 5, + "candidate": 10, + "has": 2, + "exactly": 2, + "one": 2, + "member": 1, + "i.e.": 1, + "been": 1, + "solved": 1, + "single": 9, + "Bool": 2, + "true": 16, + "false": 13, + "unsolved": 10, + "rows": 4, + "cols": 6, + "boxes": 1, + "allrows": 8, + "allcols": 5, + "allboxs": 5, + "allrcb": 5, + "zip": 7, + "repeat": 3, + "containers": 6, + "PRINTING": 1, + "printable": 1, + "coordinate": 1, + "a1": 3, + "lower": 1, + "i9": 1, + "packed": 1, + "chr": 2, + "ord": 6, + "board": 41, + "printb": 4, + "p1line": 2, + "pfld": 4, + "line": 2, + "brief": 1, + "no": 4, + "some": 2, + "zs": 1, + "initial/final": 1, + "msg": 6, + "res012": 2, + "concatMap": 1, + "a*100": 1, + "b*10": 1, + "BOARD": 1, + "ALTERATION": 1, + "ACTIONS": 1, + "message": 1, + "about": 1, + "what": 1, + "done": 1, + "turnoff1": 3, + "i": 16, + "off": 11, + "nc": 7, + "head": 19, + "newb": 7, + "filter": 26, + "notElem": 7, + "turnoff": 11, + "turnoffh": 1, + "ps": 8, + "foldM": 2, + "toh": 2, + "setto": 3, + "cname": 4, + "nf": 2, + "SOLVING": 1, + "STRATEGIES": 1, + "reduce": 3, + "sets": 2, + "contains": 1, + "numbers": 1, + "already": 1, + "finds": 1, + "logs": 1, + "NAKED": 5, + "SINGLEs": 1, + "passing.": 1, + "sss": 3, + "each": 2, + "with": 15, + "more": 2, + "than": 2, + "fields": 6, + "are": 6, + "rcb": 16, + "elem": 16, + "collect": 1, + "remove": 3, + "from": 7, + "look": 10, + "number": 4, + "appears": 1, + "container": 9, + "this": 2, + "can": 9, + "go": 1, + "other": 2, + "place": 1, + "HIDDEN": 6, + "SINGLE": 1, + "hiddenSingle": 2, + "select": 1, + "containername": 1, + "FOR": 11, + "IN": 9, + "occurs": 5, + "PAIRS": 8, + "TRIPLES": 8, + "QUADS": 2, + "nakedPair": 4, + "t": 14, + "nm": 6, + "SELECT": 3, + "pos": 5, + "tuple": 2, + "name": 2, + "//": 8, + "u": 6, + "fold": 7, + "non": 2, + "outof": 6, + "tuples": 2, + "hit": 7, + "subset": 3, + "any": 3, + "hiddenPair": 4, + "minus": 2, + "uniq": 4, + "sort": 4, + "common": 4, + "bs": 7, + "undefined": 1, + "cannot": 1, + "happen": 1, + "because": 1, + "either": 1, + "empty": 4, + "not": 5, + "intersectionlist": 2, + "intersections": 2, + "reason": 8, + "reson": 1, + "cpos": 7, + "WHERE": 2, + "tail": 2, + "intersection": 1, + "we": 5, + "occurences": 1, + "XY": 2, + "Wing": 2, + "there": 6, + "exists": 6, + "A": 7, + "X": 5, + "Y": 4, + "B": 5, + "Z": 6, + "shares": 2, + "reasoning": 1, + "will": 4, + "be": 9, + "since": 1, + "indeed": 1, + "thus": 1, + "see": 1, + "xyWing": 2, + "rcba": 4, + "share": 1, + "b1": 11, + "b2": 10, + "&&": 9, + "||": 2, + "then": 1, + "else": 1, + "c1": 4, + "c2": 3, + "N": 5, + "Fish": 1, + "Swordfish": 1, + "Jellyfish": 1, + "When": 2, + "particular": 1, + "digit": 1, + "located": 2, + "only": 1, + "columns": 2, + "eliminate": 1, + "those": 2, + "which": 2, + "fish": 7, + "fishname": 5, + "rset": 4, + "certain": 1, + "rflds": 2, + "rowset": 1, + "colss": 3, + "must": 4, + "appear": 1, + "at": 3, + "least": 3, + "cstart": 2, + "immediate": 1, + "consequences": 6, + "assumption": 8, + "form": 1, + "conseq": 3, + "cp": 3, + "two": 1, + "contradict": 2, + "contradicts": 7, + "get": 3, + "aPos": 5, + "List": 1, + "turned": 1, + "when": 2, + "true/false": 1, + "toClear": 7, + "whose": 1, + "implications": 5, + "themself": 1, + "chain": 2, + "paths": 12, + "solution": 6, + "reverse": 4, + "css": 7, + "yields": 1, + "contradictory": 1, + "chainContra": 2, + "pro": 7, + "contra": 4, + "ALL": 2, + "conlusions": 1, + "uniqBy": 2, + "using": 2, + "sortBy": 2, + "comparing": 2, + "conslusion": 1, + "chains": 4, + "LET": 1, + "BE": 1, + "final": 2, + "conclusion": 4, + "THE": 1, + "FIRST": 1, + "implication": 2, + "ai": 2, + "so": 1, + "a0": 1, + "OR": 7, + "a2": 2, + "...": 2, + "IMPLIES": 1, + "For": 2, + "cells": 1, + "pi": 2, + "have": 1, + "construct": 2, + "p0": 1, + "p1": 1, + "c0": 1, + "cellRegionChain": 2, + "os": 3, + "cellas": 2, + "regionas": 2, + "iss": 3, + "ass": 2, + "first": 2, + "candidates@": 1, + "region": 2, + "oss": 2, + "Liste": 1, + "aller": 1, + "Annahmen": 1, + "ein": 1, + "bestimmtes": 1, + "acstree": 3, + "Tree.fromList": 1, + "bypass": 1, + "maybe": 1, + "tree": 1, + "lookup": 2, + "error": 1, + "performance": 1, + "resons": 1, + "confine": 1, + "ourselves": 1, + "20": 1, + "per": 1, + "mkPaths": 3, + "acst": 3, + "impl": 2, + "{": 1, + "a3": 1, + "ordered": 1, + "impls": 2, + "ns": 2, + "concat": 1, + "takeUntil": 1, + "null": 1, + "iterate": 1, + "expandchain": 3, + "avoid": 1, + "loops": 1, + "uni": 3, + "SOLVE": 1, + "SUDOKU": 1, + "Apply": 1, + "available": 1, + "strategies": 1, + "until": 1, + "changes": 1, + "anymore": 1, + "Strategy": 1, + "functions": 2, + "supposed": 1, + "applied": 1, + "changed": 1, + "board.": 1, + "strategy": 2, + "anything": 1, + "alter": 1, + "it": 2, + "next": 1, + "tried.": 1, + "solve": 19, + "res@": 16, + "apply": 17, + "res": 16, + "smallest": 1, + "comment": 16, + "SINGLES": 1, + "locked": 1, + "2": 3, + "QUADRUPELS": 6, + "3": 3, + "4": 3, + "WINGS": 1, + "FISH": 3, + "pcomment": 2, + "9": 5, + "forcing": 1, + "allow": 1, + "infer": 1, + "both": 1, + "brd": 2, + "com": 5, + "stderr": 3, + "<<": 4, + "log": 1, + "turn": 1, + "string": 3, + "into": 1, + "mkrow": 2, + "mkrow1": 2, + "xs": 4, + "make": 1, + "sure": 1, + "unpacked": 2, + "<=>": 1, + "0": 2, + "ignored": 1, + "h": 1, + "help": 1, + "usage": 1, + "Sudoku": 2, + "file": 4, + "81": 3, + "char": 1, + "consisting": 1, + "digits": 2, + "One": 1, + "such": 1, + "going": 1, + "http": 3, + "www": 1, + "sudokuoftheday": 1, + "pages": 1, + "o": 1, + "php": 1, + "click": 1, + "puzzle": 1, + "open": 1, + "tab": 1, + "Copy": 1, + "address": 1, + "your": 1, + "browser": 1, + "There": 1, + "also": 1, + "hard": 1, + "sudokus": 1, + "examples": 1, + "top95": 1, + "txt": 1, + "W": 1, + "felder": 2, + "decode": 4, + "files": 2, + "forM_": 1, + "sudoku": 2, + "openReader": 1, + "lines": 2, + "BufferedReader.getLines": 1, + "process": 5, + "candi": 2, + "consider": 3, + "acht": 4, + "neun": 2, + "examples.SwingExamples": 1, + "Java.Awt": 1, + "ActionListener": 2, + "Java.Swing": 1, + "rs": 2, + "Runnable.new": 1, + "helloWorldGUI": 2, + "buttonDemoGUI": 2, + "celsiusConverterGUI": 2, + "invokeLater": 1, + "tempTextField": 2, + "JTextField.new": 1, + "celsiusLabel": 1, + "JLabel.new": 3, + "convertButton": 1, + "JButton.new": 3, + "fahrenheitLabel": 1, + "frame": 3, + "JFrame.new": 3, + "frame.setDefaultCloseOperation": 3, + "JFrame.dispose_on_close": 3, + "frame.setTitle": 1, + "celsiusLabel.setText": 1, + "convertButton.setText": 1, + "convertButtonActionPerformed": 2, + "celsius": 3, + "getText": 1, + "double": 1, + "fahrenheitLabel.setText": 3, + "c*1.8": 1, + ".long": 1, + "ActionListener.new": 2, + "convertButton.addActionListener": 1, + "contentPane": 2, + "frame.getContentPane": 2, + "layout": 2, + "GroupLayout.new": 1, + "contentPane.setLayout": 1, + "TODO": 1, + "continue": 1, + "//docs.oracle.com/javase/tutorial/displayCode.html": 1, + "code": 1, + "//docs.oracle.com/javase/tutorial/uiswing/examples/learn/CelsiusConverterProject/src/learn/CelsiusConverterGUI.java": 1, + "frame.pack": 3, + "frame.setVisible": 3, + "label": 2, + "cp.add": 1, + "newContentPane": 2, + "JPanel.new": 1, + "JButton": 4, + "b1.setVerticalTextPosition": 1, + "SwingConstants.center": 2, + "b1.setHorizontalTextPosition": 1, + "SwingConstants.leading": 2, + "b2.setVerticalTextPosition": 1, + "b2.setHorizontalTextPosition": 1, + "b3": 7, + "Enable": 1, + "button": 1, + "setVerticalTextPosition": 1, + "SwingConstants": 2, + "center": 1, + "setHorizontalTextPosition": 1, + "leading": 1, + "setEnabled": 7, + "action1": 2, + "action3": 2, + "b1.addActionListener": 1, + "b3.addActionListener": 1, + "newContentPane.add": 3, + "newContentPane.setOpaque": 1, + "frame.setContentPane": 1 + }, + "Game Maker Language": { + "//draws": 1, + "the": 62, + "sprite": 12, + "draw": 3, + "true": 73, + ";": 1282, + "if": 397, + "(": 1501, + "facing": 17, + "RIGHT": 10, + ")": 1502, + "image_xscale": 17, + "-": 212, + "else": 151, + "blinkToggle": 1, + "{": 300, + "state": 50, + "CLIMBING": 5, + "or": 78, + "sprite_index": 14, + "sPExit": 1, + "sDamselExit": 1, + "sTunnelExit": 1, + "and": 155, + "global.hasJetpack": 4, + "not": 63, + "whipping": 5, + "draw_sprite_ext": 10, + "x": 76, + "y": 85, + "image_yscale": 14, + "image_angle": 14, + "image_blend": 2, + "image_alpha": 10, + "//draw_sprite": 1, + "draw_sprite": 9, + "sJetpackBack": 1, + "false": 85, + "}": 307, + "sJetpackRight": 1, + "sJetpackLeft": 1, + "+": 206, + "redColor": 2, + "make_color_rgb": 1, + "holdArrow": 4, + "ARROW_NORM": 2, + "sArrowRight": 1, + "ARROW_BOMB": 2, + "holdArrowToggle": 2, + "sBombArrowRight": 2, + "LEFT": 7, + "sArrowLeft": 1, + "sBombArrowLeft": 2, + "hangCountMax": 2, + "//////////////////////////////////////": 2, + "kLeft": 12, + "checkLeft": 1, + "kLeftPushedSteps": 3, + "kLeftPressed": 2, + "checkLeftPressed": 1, + "kLeftReleased": 3, + "checkLeftReleased": 1, + "kRight": 12, + "checkRight": 1, + "kRightPushedSteps": 3, + "kRightPressed": 2, + "checkRightPressed": 1, + "kRightReleased": 3, + "checkRightReleased": 1, + "kUp": 5, + "checkUp": 1, + "kDown": 5, + "checkDown": 1, + "//key": 1, + "canRun": 1, + "kRun": 2, + "kJump": 6, + "checkJump": 1, + "kJumpPressed": 11, + "checkJumpPressed": 1, + "kJumpReleased": 5, + "checkJumpReleased": 1, + "cantJump": 3, + "global.isTunnelMan": 1, + "sTunnelAttackL": 1, + "holdItem": 1, + "kAttack": 2, + "checkAttack": 2, + "kAttackPressed": 2, + "checkAttackPressed": 1, + "kAttackReleased": 2, + "checkAttackReleased": 1, + "kItemPressed": 2, + "checkItemPressed": 1, + "xPrev": 1, + "yPrev": 1, + "stunned": 3, + "dead": 3, + "//////////////////////////////////////////": 2, + "colSolidLeft": 4, + "colSolidRight": 3, + "colLeft": 6, + "colRight": 6, + "colTop": 4, + "colBot": 11, + "colLadder": 3, + "colPlatBot": 6, + "colPlat": 5, + "colWaterTop": 3, + "colIceBot": 2, + "runKey": 4, + "isCollisionMoveableSolidLeft": 1, + "isCollisionMoveableSolidRight": 1, + "isCollisionLeft": 2, + "isCollisionRight": 2, + "isCollisionTop": 1, + "isCollisionBottom": 1, + "isCollisionLadder": 1, + "isCollisionPlatformBottom": 1, + "isCollisionPlatform": 1, + "isCollisionWaterTop": 1, + "collision_point": 30, + "oIce": 1, + "checkRun": 1, + "runHeld": 3, + "HANGING": 10, + "approximatelyZero": 4, + "xVel": 24, + "xAcc": 12, + "platformCharacterIs": 23, + "ON_GROUND": 18, + "DUCKING": 4, + "pushTimer": 3, + "//if": 5, + "SS_IsSoundPlaying": 2, + "global.sndPush": 4, + "playSound": 3, + "runAcc": 2, + "abs": 9, + "alarm": 13, + "[": 99, + "]": 103, + "<": 39, + "floor": 11, + "/": 5, + "/xVel": 1, + "instance_exists": 8, + "oCape": 2, + "oCape.open": 6, + "kJumped": 7, + "ladderTimer": 4, + "ladder": 5, + "oLadder": 4, + "ladder.x": 3, + "oLadderTop": 2, + "yAcc": 26, + "climbAcc": 2, + "FALLING": 8, + "STANDING": 2, + "departLadderXVel": 2, + "departLadderYVel": 1, + "JUMPING": 6, + "jumpButtonReleased": 7, + "jumpTime": 8, + "IN_AIR": 5, + "gravityIntensity": 2, + "yVel": 20, + "RUNNING": 3, + "jumps": 3, + "//playSound": 1, + "global.sndLand": 1, + "grav": 22, + "global.hasGloves": 3, + "hangCount": 14, + "*": 18, + "yVel*0.3": 1, + "oWeb": 2, + "obj": 14, + "instance_place": 3, + "obj.life": 1, + "initialJumpAcc": 6, + "xVel/2": 3, + "gravNorm": 7, + "global.hasCape": 1, + "jetpackFuel": 2, + "fallTimer": 2, + "global.hasJordans": 1, + "yAccLimit": 2, + "global.hasSpringShoes": 1, + "global.sndJump": 1, + "jumpTimeTotal": 2, + "//let": 1, + "character": 20, + "continue": 4, + "to": 62, + "jump": 1, + "jumpTime/jumpTimeTotal": 1, + "looking": 2, + "UP": 1, + "LOOKING_UP": 4, + "oSolid": 14, + "move_snap": 6, + "oTree": 4, + "oArrow": 5, + "instance_nearest": 1, + "obj.stuck": 1, + "//the": 2, + "can": 1, + "t": 23, + "want": 1, + "use": 4, + "because": 2, + "is": 9, + "too": 2, + "high": 1, + "yPrevHigh": 1, + "//": 11, + "we": 5, + "ll": 1, + "move": 2, + "correct": 1, + "distance": 1, + "but": 2, + "need": 1, + "shorten": 1, + "out": 4, + "a": 55, + "little": 1, + "ratio": 1, + "xVelInteger": 2, + "/dist*0.9": 1, + "//can": 1, + "be": 4, + "changed": 1, + "moveTo": 2, + "round": 6, + "xVelInteger*ratio": 1, + "yVelInteger*ratio": 1, + "slopeChangeInY": 1, + "maxDownSlope": 1, + "floating": 1, + "just": 1, + "above": 1, + "slope": 1, + "so": 2, + "down": 1, + "upYPrev": 1, + "for": 26, + "<=upYPrev+maxDownSlope;y+=1)>": 1, + "hit": 1, + "solid": 1, + "below": 1, + "upYPrev=": 1, + "I": 1, + "know": 1, + "that": 2, + "this": 2, + "doesn": 1, + "seem": 1, + "make": 1, + "sense": 1, + "of": 25, + "name": 9, + "variable": 1, + "it": 6, + "all": 3, + "works": 1, + "correctly": 1, + "after": 1, + "break": 58, + "loop": 1, + "y=": 1, + "figures": 1, + "what": 1, + "index": 11, + "should": 25, + "characterSprite": 1, + "sets": 1, + "previous": 2, + "previously": 1, + "statePrevPrev": 1, + "statePrev": 2, + "calculates": 1, + "image_speed": 9, + "based": 1, + "on": 4, + "s": 6, + "velocity": 1, + "runAnimSpeed": 1, + "0": 21, + "1": 32, + "sqrt": 1, + "sqr": 2, + "climbAnimSpeed": 1, + "<=>": 3, + "4": 2, + "setCollisionBounds": 3, + "8": 9, + "5": 5, + "DUCKTOHANG": 1, + "image_index": 1, + "limit": 5, + "at": 23, + "animation": 1, + "always": 1, + "looks": 1, + "good": 1, + "var": 79, + "i": 95, + "playerObject": 1, + "playerID": 1, + "player": 36, + "otherPlayerID": 1, + "otherPlayer": 1, + "sameVersion": 1, + "buffer": 1, + "plugins": 4, + "pluginsRequired": 2, + "usePlugins": 1, + "tcp_eof": 3, + "global.serverSocket": 10, + "gotServerHello": 2, + "show_message": 7, + "instance_destroy": 7, + "exit": 10, + "room": 1, + "DownloadRoom": 1, + "keyboard_check": 1, + "vk_escape": 1, + "downloadingMap": 2, + "while": 15, + "tcp_receive": 3, + "min": 4, + "downloadMapBytes": 2, + "buffer_size": 2, + "downloadMapBuffer": 6, + "write_buffer": 2, + "write_buffer_to_file": 1, + "downloadMapName": 3, + "buffer_destroy": 8, + "roomchange": 2, + "do": 1, + "switch": 9, + "read_ubyte": 10, + "case": 50, + "HELLO": 1, + "global.joinedServerName": 2, + "receivestring": 4, + "advertisedMapMd5": 1, + "receiveCompleteMessage": 1, + "global.tempBuffer": 3, + "string_pos": 20, + "Server": 3, + "sent": 7, + "illegal": 2, + "map": 47, + "This": 2, + "server": 10, + "requires": 1, + "following": 2, + "play": 2, + "#": 3, + "suggests": 1, + "optional": 1, + "Error": 2, + "ocurred": 1, + "loading": 1, + "plugins.": 1, + "Maps/": 2, + ".png": 2, + "The": 6, + "version": 4, + "Enter": 1, + "Password": 1, + "Incorrect": 1, + "Password.": 1, + "Incompatible": 1, + "protocol": 3, + "version.": 1, + "Name": 1, + "Exploit": 1, + "Invalid": 2, + "plugin": 6, + "packet": 3, + "ID": 2, + "There": 1, + "are": 1, + "many": 1, + "connections": 1, + "from": 5, + "your": 1, + "IP": 1, + "You": 1, + "have": 2, + "been": 1, + "kicked": 1, + "server.": 1, + ".": 12, + "#Server": 1, + "went": 1, + "invalid": 1, + "internal": 1, + "#Exiting.": 1, + "full.": 1, + "noone": 7, + "ERROR": 1, + "when": 1, + "reading": 1, + "no": 1, + "such": 1, + "unexpected": 1, + "data.": 1, + "until": 1, + "downloadHandle": 3, + "url": 62, + "tmpfile": 3, + "window_oldshowborder": 2, + "window_oldfullscreen": 2, + "timeLeft": 1, + "counter": 1, + "AudioControlPlaySong": 1, + "window_get_showborder": 1, + "window_get_fullscreen": 1, + "window_set_fullscreen": 2, + "window_set_showborder": 1, + "global.updaterBetaChannel": 3, + "UPDATE_SOURCE_BETA": 1, + "UPDATE_SOURCE": 1, + "temp_directory": 1, + "httpGet": 1, + "httpRequestStatus": 1, + "download": 1, + "isn": 1, + "extract": 1, + "downloaded": 1, + "file": 2, + "now.": 1, + "extractzip": 1, + "working_directory": 6, + "execute_program": 1, + "game_end": 1, + "victim": 10, + "killer": 11, + "assistant": 16, + "damageSource": 18, + "argument0": 28, + "argument1": 10, + "argument2": 3, + "argument3": 1, + "//*************************************": 6, + "//*": 3, + "Scoring": 1, + "Kill": 1, + "log": 1, + "recordKillInLog": 1, + "victim.stats": 1, + "DEATHS": 1, + "WEAPON_KNIFE": 1, + "||": 16, + "WEAPON_BACKSTAB": 1, + "killer.stats": 8, + "STABS": 2, + "killer.roundStats": 8, + "POINTS": 10, + "victim.object.currentWeapon.object_index": 1, + "Medigun": 2, + "victim.object.currentWeapon.uberReady": 1, + "BONUS": 2, + "KILLS": 2, + "victim.object.intel": 1, + "DEFENSES": 2, + "recordEventInLog": 1, + "killer.team": 1, + "killer.name": 2, + "global.myself": 4, + "assistant.stats": 2, + "ASSISTS": 2, + "assistant.roundStats": 2, + ".5": 2, + "//SPEC": 1, + "instance_create": 20, + "victim.object.x": 3, + "victim.object.y": 3, + "Spectator": 1, + "Gibbing": 2, + "xoffset": 5, + "yoffset": 5, + "xsize": 3, + "ysize": 3, + "view_xview": 3, + "view_yview": 3, + "view_wview": 2, + "view_hview": 2, + "randomize": 1, + "with": 47, + "victim.object": 2, + "WEAPON_ROCKETLAUNCHER": 1, + "WEAPON_MINEGUN": 1, + "FRAG_BOX": 2, + "WEAPON_REFLECTED_STICKY": 1, + "WEAPON_REFLECTED_ROCKET": 1, + "FINISHED_OFF_GIB": 2, + "GENERATOR_EXPLOSION": 2, + "player.class": 15, + "CLASS_QUOTE": 3, + "global.gibLevel": 14, + "distance_to_point": 3, + "xsize/2": 2, + "ysize/2": 2, + "hasReward": 4, + "repeat": 7, + "createGib": 14, + "PumpkinGib": 1, + "hspeed": 14, + "vspeed": 13, + "random": 21, + "choose": 8, + "Gib": 1, + "player.team": 8, + "TEAM_BLUE": 6, + "BlueClump": 1, + "TEAM_RED": 8, + "RedClump": 1, + "blood": 2, + "BloodDrop": 1, + "blood.hspeed": 1, + "blood.vspeed": 1, + "blood.sprite_index": 1, + "PumpkinJuiceS": 1, + "//All": 1, + "Classes": 1, + "gib": 1, + "head": 1, + "hands": 2, + "feet": 1, + "Headgib": 1, + "//Medic": 1, + "has": 2, + "specially": 1, + "colored": 1, + "CLASS_MEDIC": 2, + "Hand": 3, + "Feet": 1, + "//Class": 1, + "specific": 1, + "gibs": 1, + "CLASS_PYRO": 2, + "Accesory": 5, + "CLASS_SOLDIER": 2, + "CLASS_ENGINEER": 3, + "CLASS_SNIPER": 3, + "playsound": 2, + "deadbody": 2, + "DeathSnd1": 1, + "DeathSnd2": 1, + "DeadGuy": 1, + "deadbody.sprite_index": 2, + "haxxyStatue": 1, + "deadbody.image_index": 2, + "CHARACTER_ANIMATION_DEAD": 1, + "deadbody.hspeed": 1, + "deadbody.vspeed": 1, + "deadbody.image_xscale": 1, + "global.gg_birthday": 1, + "myHat": 2, + "PartyHat": 1, + "myHat.image_index": 2, + "victim.team": 2, + "global.xmas": 1, + "XmasHat": 1, + "Deathcam": 1, + "global.killCam": 3, + "KILL_BOX": 1, + "FINISHED_OFF": 5, + "DeathCam": 1, + "DeathCam.killedby": 1, + "DeathCam.name": 1, + "DeathCam.oldxview": 1, + "DeathCam.oldyview": 1, + "DeathCam.lastDamageSource": 1, + "DeathCam.team": 1, + "global.myself.team": 3, + "xr": 19, + "yr": 19, + "cloakAlpha": 1, + "team": 13, + "canCloak": 1, + "cloakAlpha/2": 1, + "invisible": 1, + "stabbing": 2, + "power": 1, + "currentWeapon.stab.alpha": 1, + "&&": 6, + "global.showHealthBar": 3, + "draw_set_alpha": 3, + "draw_healthbar": 1, + "hp*100/maxHp": 1, + "c_black": 1, + "c_red": 3, + "c_green": 1, + "mouse_x": 1, + "mouse_y": 1, + "<25)>": 1, + "cloak": 2, + "global": 8, + "myself": 2, + "draw_set_halign": 1, + "fa_center": 1, + "draw_set_valign": 1, + "fa_bottom": 1, + "team=": 1, + "draw_set_color": 2, + "c_blue": 2, + "draw_text": 4, + "35": 1, + "showTeammateStats": 1, + "weapons": 3, + "50": 3, + "Superburst": 1, + "string": 13, + "currentWeapon": 2, + "uberCharge": 1, + "20": 1, + "Shotgun": 1, + "Nuts": 1, + "N": 1, + "Bolts": 1, + "nutsNBolts": 1, + "Minegun": 1, + "Lobbed": 1, + "Mines": 1, + "lobbed": 1, + "ubercolour": 6, + "overlaySprite": 6, + "zoomed": 1, + "SniperCrouchRedS": 1, + "SniperCrouchBlueS": 1, + "sniperCrouchOverlay": 1, + "overlay": 1, + "omnomnomnom": 2, + "draw_sprite_ext_overlay": 7, + "omnomnomnomSprite": 2, + "omnomnomnomOverlay": 2, + "omnomnomnomindex": 4, + "c_white": 13, + "ubered": 7, + "7": 4, + "taunting": 2, + "tauntsprite": 2, + "tauntOverlay": 2, + "tauntindex": 2, + "humiliated": 1, + "humiliationPoses": 1, + "animationImage": 9, + "humiliationOffset": 1, + "animationOffset": 6, + "burnDuration": 2, + "burnIntensity": 2, + "numFlames": 1, + "maxIntensity": 1, + "FlameS": 1, + "flameArray_x": 1, + "flameArray_y": 1, + "maxDuration": 1, + "demon": 4, + "demonX": 5, + "median": 2, + "demonY": 4, + "demonOffset": 4, + "demonDir": 2, + "dir": 3, + "demonFrame": 5, + "sprite_get_number": 1, + "*player.team": 2, + "dir*1": 2, + "#define": 26, + "__http_init": 3, + "global.__HttpClient": 4, + "object_add": 1, + "object_set_persistent": 1, + "__http_split": 3, + "text": 19, + "delimeter": 7, + "list": 36, + "count": 4, + "ds_list_create": 5, + "ds_list_add": 23, + "string_copy": 32, + "string_length": 25, + "return": 56, + "__http_parse_url": 4, + "ds_map_create": 4, + "ds_map_add": 15, + "colonPos": 22, + "string_char_at": 13, + "slashPos": 13, + "real": 14, + "queryPos": 12, + "ds_map_destroy": 6, + "__http_resolve_url": 2, + "baseUrl": 3, + "refUrl": 18, + "urlParts": 15, + "refUrlParts": 5, + "canParseRefUrl": 3, + "result": 11, + "ds_map_find_value": 22, + "__http_resolve_path": 3, + "ds_map_replace": 3, + "ds_map_exists": 11, + "ds_map_delete": 1, + "path": 10, + "query": 4, + "relUrl": 1, + "__http_construct_url": 2, + "basePath": 4, + "refPath": 7, + "parts": 29, + "refParts": 5, + "lastPart": 3, + "ds_list_find_value": 9, + "ds_list_size": 11, + "ds_list_delete": 5, + "ds_list_destroy": 4, + "part": 6, + "ds_list_replace": 3, + "__http_parse_hex": 2, + "hexString": 4, + "hexValues": 3, + "digit": 4, + "__http_prepare_request": 4, + "client": 33, + "headers": 11, + "parsed": 18, + "show_error": 2, + "destroyed": 3, + "CR": 10, + "chr": 3, + "LF": 5, + "CRLF": 17, + "socket": 40, + "tcp_connect": 1, + "errored": 19, + "error": 18, + "linebuf": 33, + "line": 19, + "statusCode": 6, + "reasonPhrase": 2, + "responseBody": 19, + "buffer_create": 7, + "responseBodySize": 5, + "responseBodyProgress": 5, + "responseHeaders": 9, + "requestUrl": 2, + "requestHeaders": 2, + "write_string": 9, + "key": 17, + "ds_map_find_first": 1, + "is_string": 2, + "ds_map_find_next": 1, + "socket_send": 1, + "__http_parse_header": 3, + "ord": 16, + "headerValue": 9, + "string_lower": 3, + "headerName": 4, + "__http_client_step": 2, + "socket_has_error": 1, + "socket_error": 1, + "__http_client_destroy": 20, + "available": 7, + "tcp_receive_available": 1, + "bytesRead": 6, + "c": 20, + "read_string": 9, + "Reached": 2, + "end": 11, + "HTTP": 1, + "defines": 1, + "sequence": 2, + "as": 1, + "marker": 1, + "elements": 1, + "except": 2, + "entity": 1, + "body": 2, + "see": 1, + "appendix": 1, + "19": 1, + "3": 1, + "tolerant": 1, + "applications": 1, + "Strip": 1, + "trailing": 1, + "First": 1, + "status": 2, + "code": 2, + "first": 3, + "Response": 1, + "message": 1, + "Status": 1, + "Line": 1, + "consisting": 1, + "followed": 1, + "by": 5, + "numeric": 1, + "its": 1, + "associated": 1, + "textual": 1, + "phrase": 1, + "each": 18, + "element": 8, + "separated": 1, + "SP": 1, + "characters": 3, + "No": 3, + "allowed": 1, + "in": 21, + "final": 1, + "httpVer": 2, + "spacePos": 11, + "space": 4, + "response": 5, + "second": 2, + "Other": 1, + "Blank": 1, + "write": 1, + "remainder": 1, + "write_buffer_part": 3, + "Header": 1, + "Receiving": 1, + "transfer": 6, + "encoding": 2, + "chunked": 4, + "Chunked": 1, + "let": 1, + "decode": 36, + "actualResponseBody": 8, + "actualResponseSize": 1, + "actualResponseBodySize": 3, + "Parse": 1, + "chunks": 1, + "chunk": 12, + "size": 7, + "extension": 3, + "data": 4, + "HEX": 1, + "buffer_bytes_left": 6, + "chunkSize": 11, + "Read": 1, + "byte": 2, + "We": 1, + "found": 21, + "semicolon": 1, + "beginning": 1, + "skip": 1, + "stuff": 2, + "header": 2, + "Doesn": 1, + "did": 1, + "empty": 13, + "something": 1, + "up": 6, + "Parsing": 1, + "failed": 56, + "hex": 2, + "was": 1, + "hexadecimal": 1, + "Is": 1, + "bigger": 2, + "than": 1, + "remaining": 1, + "2": 2, + "responseHaders": 1, + "location": 4, + "resolved": 5, + "socket_destroy": 4, + "http_new_get": 1, + "variable_global_exists": 2, + "http_new_get_ex": 1, + "http_step": 1, + "client.errored": 3, + "client.state": 3, + "http_status_code": 1, + "client.statusCode": 1, + "http_reason_phrase": 1, + "client.error": 1, + "client.reasonPhrase": 1, + "http_response_body": 1, + "client.responseBody": 1, + "http_response_body_size": 1, + "client.responseBodySize": 1, + "http_response_body_progress": 1, + "client.responseBodyProgress": 1, + "http_response_headers": 1, + "client.responseHeaders": 1, + "http_destroy": 1, + "RoomChangeObserver": 1, + "set_little_endian_global": 1, + "file_exists": 5, + "file_delete": 3, + "backupFilename": 5, + "file_find_first": 1, + "file_find_next": 1, + "file_find_close": 1, + "customMapRotationFile": 7, + "restart": 4, + "//import": 1, + "wav": 1, + "files": 1, + "music": 1, + "global.MenuMusic": 3, + "sound_add": 3, + "global.IngameMusic": 3, + "global.FaucetMusic": 3, + "sound_volume": 3, + "global.sendBuffer": 19, + "global.HudCheck": 1, + "global.map_rotation": 19, + "global.CustomMapCollisionSprite": 1, + "window_set_region_scale": 1, + "ini_open": 2, + "global.playerName": 7, + "ini_read_string": 12, + "string_count": 2, + "MAX_PLAYERNAME_LENGTH": 2, + "global.fullscreen": 3, + "ini_read_real": 65, + "global.useLobbyServer": 2, + "global.hostingPort": 2, + "global.music": 2, + "MUSIC_BOTH": 1, + "global.playerLimit": 4, + "//thy": 1, + "playerlimit": 1, + "shalt": 1, + "exceed": 1, + "global.dedicatedMode": 7, + "ini_write_real": 60, + "global.multiClientLimit": 2, + "global.particles": 2, + "PARTICLES_NORMAL": 1, + "global.monitorSync": 3, + "set_synchronization": 2, + "global.medicRadar": 2, + "global.showHealer": 2, + "global.showHealing": 2, + "global.showTeammateStats": 2, + "global.serverPluginsPrompt": 2, + "global.restartPrompt": 2, + "//user": 1, + "HUD": 1, + "settings": 1, + "global.timerPos": 2, + "global.killLogPos": 2, + "global.kothHudPos": 2, + "global.clientPassword": 1, + "global.shuffleRotation": 2, + "global.timeLimitMins": 2, + "max": 2, + "global.serverPassword": 2, + "global.mapRotationFile": 1, + "global.serverName": 2, + "global.welcomeMessage": 2, + "global.caplimit": 3, + "global.caplimitBkup": 1, + "global.autobalance": 2, + "global.Server_RespawntimeSec": 4, + "global.rewardKey": 1, + "unhex": 1, + "global.rewardId": 1, + "global.mapdownloadLimitBps": 2, + "isBetaVersion": 1, + "global.attemptPortForward": 2, + "global.serverPluginList": 3, + "global.serverPluginsRequired": 2, + "CrosshairFilename": 5, + "CrosshairRemoveBG": 4, + "global.queueJumping": 2, + "global.backgroundHash": 2, + "global.backgroundTitle": 2, + "global.backgroundURL": 2, + "global.backgroundShowVersion": 2, + "readClasslimitsFromIni": 1, + "global.currentMapArea": 1, + "global.totalMapAreas": 1, + "global.setupTimer": 1, + "global.serverPluginsInUse": 1, + "global.pluginPacketBuffers": 1, + "global.pluginPacketPlayers": 1, + "ini_write_string": 10, + "ini_key_delete": 1, + "global.classlimits": 10, + "CLASS_SCOUT": 1, + "CLASS_HEAVY": 2, + "CLASS_DEMOMAN": 1, + "CLASS_SPY": 1, + "//screw": 1, + "will": 1, + "start": 1, + "//map_truefort": 1, + "maps": 37, + "//map_2dfort": 1, + "//map_conflict": 1, + "//map_classicwell": 1, + "//map_waterway": 1, + "//map_orange": 1, + "//map_dirtbowl": 1, + "//map_egypt": 1, + "//arena_montane": 1, + "//arena_lumberyard": 1, + "//gen_destroy": 1, + "//koth_valley": 1, + "//koth_corinth": 1, + "//koth_harvest": 1, + "//dkoth_atalia": 1, + "//dkoth_sixties": 1, + "//Server": 1, + "respawn": 1, + "time": 1, + "calculator.": 1, + "Converts": 1, + "frame.": 1, + "read": 1, + "multiply": 1, + "hehe": 1, + "global.Server_Respawntime": 3, + "global.mapchanging": 1, + "ini_close": 2, + "global.protocolUuid": 2, + "parseUuid": 2, + "PROTOCOL_UUID": 1, + "global.gg2lobbyId": 2, + "GG2_LOBBY_UUID": 1, + "initRewards": 1, + "IPRaw": 3, + "portRaw": 3, + "doubleCheck": 8, + "global.launchMap": 5, + "parameter_count": 1, + "parameter_string": 8, + "global.serverPort": 1, + "global.serverIP": 1, + "global.isHost": 1, + "Client": 1, + "global.customMapdesginated": 2, + "fileHandle": 6, + "mapname": 9, + "file_text_open_read": 1, + "file_text_eof": 1, + "file_text_read_string": 1, + "starts": 1, + "tab": 2, + "string_delete": 1, + "delete": 1, + "comment": 1, + "starting": 1, + "file_text_readln": 1, + "file_text_close": 1, + "load": 1, + "ini": 1, + "Maps": 9, + "section": 1, + "//Set": 1, + "rotation": 1, + "sort_list": 7, + "*maps": 1, + "ds_list_sort": 1, + "mod": 1, + "global.gg2Font": 2, + "font_add_sprite": 2, + "gg2FontS": 1, + "global.countFont": 1, + "countFontS": 1, + "draw_set_font": 1, + "cursor_sprite": 1, + "CrosshairS": 5, + "directory_exists": 2, + "directory_create": 2, + "AudioControl": 1, + "SSControl": 1, + "message_background": 1, + "popupBackgroundB": 1, + "message_button": 1, + "popupButtonS": 1, + "message_text_font": 1, + "message_button_font": 1, + "message_input_font": 1, + "//Key": 1, + "Mapping": 1, + "global.jump": 1, + "global.down": 1, + "global.left": 1, + "global.right": 1, + "global.attack": 1, + "MOUSE_LEFT": 1, + "global.special": 1, + "MOUSE_RIGHT": 1, + "global.taunt": 1, + "global.chat1": 1, + "global.chat2": 1, + "global.chat3": 1, + "global.medic": 1, + "global.drop": 1, + "global.changeTeam": 1, + "global.changeClass": 1, + "global.showScores": 1, + "vk_shift": 1, + "calculateMonthAndDay": 1, + "loadplugins": 1, + "registry_set_root": 1, + "HKLM": 1, + "global.NTKernelVersion": 1, + "registry_read_string_ext": 1, + "CurrentVersion": 1, + "SIC": 1, + "sprite_replace": 1, + "sprite_set_offset": 1, + "sprite_get_width": 1, + "/2": 2, + "sprite_get_height": 1, + "AudioControlToggleMute": 1, + "room_goto_fix": 2, + "Menu": 2, + "__jso_gmt_tuple": 1, + "//Position": 1, + "address": 1, + "table": 1, + "pos": 2, + "addr_table": 2, + "*argument_count": 1, + "//Build": 1, + "tuple": 1, + "ca": 1, + "isstr": 1, + "datastr": 1, + "argument_count": 1, + "//Check": 1, + "argument": 10, + "Unexpected": 18, + "position": 16, + "f": 5, + "JSON": 5, + "string.": 5, + "Cannot": 5, + "parse": 3, + "boolean": 3, + "value": 13, + "expecting": 9, + "digit.": 9, + "e": 4, + "E": 4, + "dot": 1, + "an": 24, + "integer": 6, + "Expected": 6, + "least": 6, + "arguments": 26, + "got": 6, + "find": 10, + "lookup.": 4, + "indices": 1, + "nested": 27, + "lists": 6, + "Index": 1, + "overflow": 4, + "Recursive": 1, + "abcdef": 1, + "number": 7, + "num": 1, + "assert_true": 1, + "_assert_error_popup": 2, + "string_repeat": 2, + "_assert_newline": 2, + "assert_false": 1, + "assert_equal": 1, + "//Safe": 1, + "equality": 1, + "check": 1, + "won": 1, + "support": 1, + "instead": 1, + "_assert_debug_value": 1, + "//String": 1, + "os_browser": 1, + "browser_not_a_browser": 1, + "string_replace_all": 1, + "//Numeric": 1, + "GMTuple": 1, + "jso_encode_string": 1, + "encode": 8, + "escape": 2, + "jso_encode_map": 4, + "one": 42, + "key1": 3, + "key2": 3, + "multi": 7, + "jso_encode_list": 3, + "three": 36, + "_jso_decode_string": 5, + "small": 1, + "quick": 2, + "brown": 2, + "fox": 2, + "over": 2, + "lazy": 2, + "dog.": 2, + "simple": 1, + "Waahoo": 1, + "negg": 1, + "mixed": 1, + "_jso_decode_boolean": 2, + "_jso_decode_real": 11, + "standard": 1, + "zero": 4, + "signed": 2, + "decimal": 1, + "digits": 1, + "positive": 7, + "negative": 7, + "exponent": 4, + "_jso_decode_integer": 3, + "_jso_decode_map": 14, + "didn": 14, + "include": 14, + "right": 14, + "prefix": 14, + "#1": 14, + "#2": 14, + "entry": 29, + "pi": 2, + "bool": 2, + "waahoo": 10, + "woohah": 8, + "mix": 4, + "_jso_decode_list": 14, + "woo": 2, + "Empty": 4, + "equal": 20, + "other.": 12, + "junk": 2, + "info": 1, + "taxi": 1, + "An": 4, + "filled": 4, + "map.": 2, + "A": 24, + "B": 18, + "C": 8, + "same": 6, + "content": 4, + "entered": 4, + "different": 12, + "orders": 4, + "D": 1, + "keys": 2, + "values": 4, + "six": 1, + "corresponding": 4, + "types": 4, + "other": 4, + "crash.": 4, + "list.": 2, + "Lists": 4, + "two": 16, + "entries": 2, + "also": 2, + "jso_map_check": 9, + "existing": 9, + "single": 11, + "jso_map_lookup": 3, + "wrong": 10, + "trap": 2, + "jso_map_lookup_type": 3, + "type": 8, + "four": 21, + "inexistent": 11, + "multiple": 20, + "jso_list_check": 8, + "jso_list_lookup": 3, + "jso_list_lookup_type": 3, + "inner": 1, + "indexing": 1, + "bad": 1, + "jso_cleanup_map": 1, + "one_map": 1, + "hashList": 5, + "pluginname": 9, + "pluginhash": 4, + "realhash": 1, + "handle": 1, + "filesize": 1, + "progress": 1, + "tempfile": 1, + "tempdir": 1, + "lastContact": 2, + "isCached": 2, + "isDebug": 2, + "split": 1, + "checkpluginname": 1, + "ds_list_find_index": 1, + ".zip": 3, + "ServerPluginsCache": 6, + "@": 5, + ".zip.tmp": 1, + ".tmp": 2, + "ServerPluginsDebug": 1, + "Warning": 2, + "being": 2, + "loaded": 2, + "ServerPluginsDebug.": 2, + "Make": 2, + "sure": 2, + "clients": 1, + "they": 1, + "may": 2, + "unable": 2, + "connect.": 2, + "you": 1, + "Downloading": 1, + "last_plugin.log": 2, + "plugin.gml": 1, + "playerId": 11, + "commandLimitRemaining": 4, + "variable_local_exists": 4, + "commandReceiveState": 1, + "commandReceiveExpectedBytes": 1, + "commandReceiveCommand": 1, + "player.socket": 12, + "player.commandReceiveExpectedBytes": 7, + "player.commandReceiveState": 7, + "player.commandReceiveCommand": 4, + "commandBytes": 2, + "commandBytesInvalidCommand": 1, + "commandBytesPrefixLength1": 1, + "commandBytesPrefixLength2": 1, + "default": 1, + "read_ushort": 2, + "PLAYER_LEAVE": 1, + "PLAYER_CHANGECLASS": 1, + "class": 8, + "getCharacterObject": 2, + "player.object": 12, + "SpawnRoom": 2, + "lastDamageDealer": 8, + "sendEventPlayerDeath": 4, + "BID_FAREWELL": 4, + "doEventPlayerDeath": 4, + "secondToLastDamageDealer": 2, + "lastDamageDealer.object": 2, + "lastDamageDealer.object.healer": 4, + "player.alarm": 4, + "<=0)>": 1, + "checkClasslimits": 2, + "ServerPlayerChangeclass": 2, + "sendBuffer": 1, + "PLAYER_CHANGETEAM": 1, + "newTeam": 7, + "balance": 5, + "redSuperiority": 6, + "calculate": 1, + "which": 1, + "Player": 1, + "TEAM_SPECTATOR": 1, + "newClass": 4, + "ServerPlayerChangeteam": 1, + "ServerBalanceTeams": 1, + "CHAT_BUBBLE": 2, + "bubbleImage": 5, + "global.aFirst": 1, + "write_ubyte": 20, + "setChatBubble": 1, + "BUILD_SENTRY": 2, + "collision_circle": 1, + "player.object.x": 3, + "player.object.y": 3, + "Sentry": 1, + "player.object.nutsNBolts": 1, + "player.sentry": 2, + "player.object.onCabinet": 1, + "write_ushort": 2, + "global.serializeBuffer": 3, + "player.object.x*5": 1, + "player.object.y*5": 1, + "write_byte": 1, + "player.object.image_xscale": 2, + "buildSentry": 1, + "DESTROY_SENTRY": 1, + "DROP_INTEL": 1, + "player.object.intel": 1, + "sendEventDropIntel": 1, + "doEventDropIntel": 1, + "OMNOMNOMNOM": 2, + "player.humiliated": 1, + "player.object.taunting": 1, + "player.object.omnomnomnom": 1, + "player.object.canEat": 1, + "omnomnomnomend": 2, + "xscale": 1, + "TOGGLE_ZOOM": 2, + "toggleZoom": 1, + "PLAYER_CHANGENAME": 2, + "nameLength": 4, + "socket_receivebuffer_size": 3, + "KICK": 2, + "KICK_NAME": 1, + "current_time": 2, + "lastNamechange": 2, + "INPUTSTATE": 1, + "keyState": 1, + "netAimDirection": 1, + "aimDirection": 1, + "netAimDirection*360/65536": 1, + "event_user": 1, + "REWARD_REQUEST": 1, + "player.rewardId": 1, + "player.challenge": 2, + "rewardCreateChallenge": 1, + "REWARD_CHALLENGE_CODE": 1, + "write_binstring": 1, + "REWARD_CHALLENGE_RESPONSE": 1, + "answer": 3, + "authbuffer": 1, + "read_binstring": 1, + "rewardAuthStart": 1, + "challenge": 1, + "rewardId": 1, + "PLUGIN_PACKET": 1, + "packetID": 3, + "buf": 5, + "success": 3, + "_PluginPacketPush": 1, + "KICK_BAD_PLUGIN_PACKET": 1, + "CLIENT_SETTINGS": 2, + "mirror": 4, + "player.queueJump": 1, + "global.levelType": 22, + "//global.currLevel": 1, + "global.currLevel": 22, + "global.hadDarkLevel": 4, + "global.startRoomX": 1, + "global.startRoomY": 1, + "global.endRoomX": 1, + "global.endRoomY": 1, + "oGame.levelGen": 2, + "j": 14, + "global.roomPath": 1, + "k": 5, + "global.lake": 3, + "isLevel": 1, + "999": 2, + "levelType": 2, + "16": 14, + "656": 3, + "oDark": 2, + "invincible": 2, + "sDark": 1, + "oTemple": 2, + "cityOfGold": 1, + "sTemple": 2, + "lake": 1, + "i*16": 8, + "j*16": 6, + "oLush": 2, + "obj.sprite_index": 4, + "sLush": 2, + "obj.invincible": 3, + "oBrick": 1, + "sBrick": 1, + "global.cityOfGold": 2, + "*16": 2, + "//instance_create": 2, + "oSpikes": 1, + "background_index": 1, + "bgTemple": 1, + "global.temp1": 1, + "global.gameStart": 3, + "scrLevelGen": 1, + "global.cemetary": 3, + "rand": 10, + "global.probCemetary": 1, + "oRoom": 1, + "scrRoomGen": 1, + "global.blackMarket": 3, + "scrRoomGenMarket": 1, + "scrRoomGen2": 1, + "global.yetiLair": 2, + "scrRoomGenYeti": 1, + "scrRoomGen3": 1, + "scrRoomGen4": 1, + "scrRoomGen5": 1, + "global.darkLevel": 4, + "global.noDarkLevel": 1, + "global.probDarkLevel": 1, + "oPlayer1.x": 2, + "oPlayer1.y": 2, + "oFlare": 1, + "global.genUdjatEye": 4, + "global.madeUdjatEye": 1, + "global.genMarketEntrance": 4, + "global.madeMarketEntrance": 1, + "////////////////////////////": 2, + "global.temp2": 1, + "isRoom": 3, + "scrEntityGen": 1, + "oEntrance": 1, + "global.customLevel": 1, + "oEntrance.x": 1, + "oEntrance.y": 1, + "global.snakePit": 1, + "global.alienCraft": 1, + "global.sacrificePit": 1, + "oPlayer1": 1, + "scrSetupWalls": 3, + "global.graphicsHigh": 1, + "tile_add": 4, + "bgExtrasLush": 1, + "*rand": 12, + "bgExtrasIce": 1, + "bgExtrasTemple": 1, + "bgExtras": 1, + "global.murderer": 1, + "global.thiefLevel": 1, + "isRealLevel": 1, + "oExit": 1, + "oShopkeeper": 1, + "obj.status": 1, + "oTreasure": 1, + "oWater": 1, + "sWaterTop": 1, + "sLavaTop": 1, + "scrCheckWaterTop": 1, + "global.temp3": 1 + }, + "GAMS": { + "*Basic": 1, + "example": 2, + "of": 7, + "transport": 5, + "model": 6, + "from": 2, + "GAMS": 5, + "library": 3, + "Title": 1, + "A": 3, + "Transportation": 1, + "Problem": 1, + "(": 22, + "TRNSPORT": 1, + "SEQ": 1, + ")": 22, + "Ontext": 1, + "This": 2, + "problem": 1, + "finds": 1, + "a": 3, + "least": 1, + "cost": 4, + "shipping": 1, + "schedule": 1, + "that": 1, + "meets": 1, + "requirements": 1, + "at": 5, + "markets": 2, + "and": 2, + "supplies": 1, + "factories.": 1, + "Dantzig": 1, + "G": 1, + "B": 1, + "Chapter": 2, + "In": 2, + "Linear": 1, + "Programming": 1, + "Extensions.": 1, + "Princeton": 2, + "University": 1, + "Press": 2, + "New": 1, + "Jersey": 1, + "formulation": 1, + "is": 1, + "described": 1, + "in": 10, + "detail": 1, + "Rosenthal": 1, + "R": 1, + "E": 1, + "Tutorial.": 1, + "User": 1, + "s": 1, + "Guide.": 1, + "The": 2, + "Scientific": 1, + "Redwood": 1, + "City": 1, + "California": 1, + "line": 1, + "numbers": 1, + "will": 1, + "not": 1, + "match": 1, + "those": 1, + "the": 1, + "book": 1, + "because": 1, + "these": 1, + "comments.": 1, + "Offtext": 1, + "Sets": 1, + "i": 18, + "canning": 1, + "plants": 1, + "/": 9, + "seattle": 3, + "san": 3, + "-": 6, + "diego": 3, + "j": 18, + "new": 3, + "york": 3, + "chicago": 3, + "topeka": 3, + ";": 15, + "Parameters": 1, + "capacity": 1, + "plant": 2, + "cases": 3, + "b": 2, + "demand": 4, + "market": 2, + "Table": 1, + "d": 2, + "distance": 1, + "thousands": 3, + "miles": 2, + "Scalar": 1, + "f": 2, + "freight": 1, + "dollars": 3, + "per": 3, + "case": 2, + "thousand": 1, + "/90/": 1, + "Parameter": 1, + "c": 3, + "*": 1, + "Variables": 1, + "x": 4, + "shipment": 1, + "quantities": 1, + "z": 3, + "total": 1, + "transportation": 1, + "costs": 1, + "Positive": 1, + "Variable": 1, + "Equations": 1, + "define": 1, + "objective": 1, + "function": 1, + "supply": 3, + "observe": 1, + "limit": 1, + "satisfy": 1, + "..": 3, + "e": 1, + "sum": 3, + "*x": 1, + "l": 1, + "g": 1, + "Model": 1, + "/all/": 1, + "Solve": 1, + "using": 1, + "lp": 1, + "minimizing": 1, + "Display": 1, + "x.l": 1, + "x.m": 1, + "ontext": 1, + "#user": 1, + "stuff": 1, + "Main": 1, + "topic": 1, + "Basic": 2, + "Featured": 4, + "item": 4, + "Trnsport": 1, + "Description": 1, + "offtext": 1 + }, + "GAP": { + "#############################################################################": 63, + "##": 766, + "#W": 4, + "example.gd": 2, + "This": 10, + "file": 7, + "contains": 7, + "a": 113, + "sample": 2, + "of": 114, + "GAP": 15, + "declaration": 1, + "file.": 3, + "DeclareProperty": 2, + "(": 721, + "IsLeftModule": 6, + ")": 722, + ";": 569, + "DeclareGlobalFunction": 5, + "#C": 7, + "IsQuuxFrobnicator": 1, + "": 3, + "": 28, + "": 7, + "Name=": 33, + "Arg=": 33, + "Type=": 7, + "": 28, + "Tests": 1, + "whether": 5, + "R": 5, + "is": 72, + "quux": 1, + "frobnicator.": 1, + "": 28, + "": 28, + "DeclareSynonym": 17, + "IsField": 1, + "and": 102, + "IsGroup": 1, + "implementation": 1, + "#M": 20, + "SomeOperation": 1, + "": 2, + "performs": 1, + "some": 2, + "operation": 1, + "on": 5, + "InstallMethod": 18, + "SomeProperty": 1, + "[": 145, + "]": 169, + "function": 37, + "M": 7, + "if": 103, + "IsFreeLeftModule": 3, + "not": 49, + "IsTrivial": 1, + "then": 128, + "return": 41, + "true": 21, + "fi": 91, + "TryNextMethod": 7, + "end": 34, + "#F": 17, + "SomeGlobalFunction": 2, + "A": 9, + "global": 1, + "variadic": 1, + "funfion.": 1, + "InstallGlobalFunction": 5, + "arg": 16, + "Length": 14, + "+": 9, + "*": 12, + "elif": 21, + "-": 67, + "else": 25, + "Error": 7, + "#": 73, + "SomeFunc": 1, + "x": 14, + "y": 8, + "local": 16, + "z": 3, + "func": 3, + "tmp": 20, + "j": 3, + "mod": 2, + "List": 6, + "while": 5, + "do": 18, + "for": 53, + "in": 64, + "Print": 24, + "od": 15, + "repeat": 1, + "until": 1, + "<": 17, + "Magic.gd": 1, + "AutoDoc": 4, + "package": 10, + "Copyright": 6, + "Max": 2, + "Horn": 2, + "JLU": 2, + "Giessen": 2, + "Sebastian": 2, + "Gutsche": 2, + "University": 4, + "Kaiserslautern": 2, + "SHEBANG#!#! @Description": 1, + "SHEBANG#!#! This": 1, + "SHEBANG#!#! any": 1, + "SHEBANG#!#! ": 1, + "SHEBANG#!#! ": 5, + "SHEBANG#!#! It": 3, + "SHEBANG#!#! That": 1, + "SHEBANG#!#! of": 1, + "SHEBANG#!#! (with": 1, + "SHEBANG#!#! main": 1, + "SHEBANG#!#! XML": 1, + "SHEBANG#!#! other": 1, + "SHEBANG#!#! as": 1, + "SHEBANG#!#! to": 2, + "SHEBANG#!#! Secondly,": 1, + "SHEBANG#!#! page": 1, + "SHEBANG#!#! (name,": 1, + "SHEBANG#!#! on": 1, + "SHEBANG#!Item>": 25, + "SHEBANG#!#! tags": 1, + "SHEBANG#!#! This": 1, + "SHEBANG#!#! produce": 1, + "SHEBANG#!#! MathJaX": 1, + "SHEBANG#!#! generated": 1, + "SHEBANG#!#! this,": 1, + "SHEBANG#!#! supplementary": 1, + "SHEBANG#!#! (see": 1, + "SHEBANG#!Enum>": 1, + "SHEBANG#!#! For": 1, + "SHEBANG#!>": 11, + "SHEBANG#!#! The": 1, + "SHEBANG#!#! ": 1, + "SHEBANG#!Mark>": 22, + "SHEBANG#!#! The": 2, + "SHEBANG#!A>": 1, + "SHEBANG#!#! ": 1, + "SHEBANG#!#! ": 4, + "SHEBANG#!#! This": 4, + "SHEBANG#!#! Directory()": 1, + "SHEBANG#!#! (i.e.": 1, + "SHEBANG#!#! Default": 1, + "SHEBANG#!#! for": 1, + "SHEBANG#!#! The": 3, + "SHEBANG#!#! record.": 3, + "SHEBANG#!#! equivalent": 3, + "SHEBANG#!#! enabled.": 3, + "SHEBANG#!#! package's": 1, + "SHEBANG#!#! In": 3, + "SHEBANG#!K>),": 3, + "SHEBANG#!#! If": 3, + "####": 34, + "TODO": 3, + "mention": 1, + "merging": 1, + "with": 24, + "PackageInfo.AutoDoc": 1, + "SHEBANG#!#! ": 3, + "SHEBANG#!#! ": 13, + "SHEBANG#!#! A": 6, + "SHEBANG#!#! If": 2, + "SHEBANG#!#! your": 1, + "SHEBANG#!#! you": 1, + "SHEBANG#!#! to": 4, + "SHEBANG#!#! is": 1, + "SHEBANG#!#! of": 2, + "SHEBANG#!#! This": 3, + "SHEBANG#!#! i.e.": 1, + "SHEBANG#!#! The": 2, + "SHEBANG#!#! then": 1, + "The": 21, + "param": 1, + "bit": 2, + "strange.": 1, + "We": 4, + "should": 2, + "probably": 2, + "change": 1, + "it": 8, + "to": 37, + "be": 24, + "more": 3, + "general": 1, + "as": 23, + "one": 11, + "might": 1, + "want": 1, + "define": 2, + "other": 4, + "entities...": 1, + "For": 10, + "now": 1, + "we": 3, + "document": 1, + "leave": 1, + "us": 1, + "the": 136, + "choice": 1, + "revising": 1, + "how": 1, + "works.": 1, + "": 2, + "": 117, + "entities": 2, + "": 117, + "": 2, + "": 2, + "list": 16, + "names": 1, + "or": 13, + "which": 8, + "are": 14, + "used": 10, + "corresponding": 1, + "XML": 4, + "entities.": 1, + "example": 3, + "set": 6, + "containing": 1, + "string": 6, + "": 2, + "SomePackage": 3, + "": 2, + "following": 4, + "added": 1, + "preamble": 1, + "": 2, + "CDATA": 2, + "ENTITY": 2, + "": 2, + "allows": 1, + "you": 3, + "write": 3, + "&": 37, + "amp": 1, + "your": 1, + "documentation": 2, + "reference": 1, + "that": 39, + "package.": 2, + "If": 11, + "another": 1, + "type": 2, + "entity": 1, + "desired": 1, + "can": 12, + "simply": 2, + "add": 2, + "instead": 1, + "two": 13, + "entry": 2, + "list.": 2, + "It": 1, + "will": 5, + "handled": 3, + "so": 3, + "please": 1, + "careful.": 1, + "": 2, + "SHEBANG#!#! for": 1, + "SHEBANG#!#! statement": 1, + "SHEBANG#!#! components": 2, + "SHEBANG#!#! example,": 1, + "SHEBANG#!#! acknowledgements": 1, + "SHEBANG#!#! ": 6, + "SHEBANG#!#! by": 1, + "SHEBANG#!#! package": 1, + "SHEBANG#!#! Usually": 2, + "SHEBANG#!#! are": 2, + "SHEBANG#!#! Default": 3, + "SHEBANG#!#! When": 1, + "SHEBANG#!#! they": 1, + "Document": 1, + "section_intros": 2, + "later": 1, + "on.": 1, + "However": 2, + "note": 2, + "thanks": 1, + "new": 2, + "comment": 1, + "syntax": 1, + "only": 5, + "remaining": 1, + "use": 5, + "this": 15, + "seems": 1, + "ability": 1, + "specify": 3, + "order": 1, + "chapters": 1, + "sections.": 1, + "TODO.": 1, + "SHEBANG#!#! files": 1, + "Note": 3, + "strictly": 1, + "speaking": 1, + "also": 3, + "scaffold.": 1, + "uses": 2, + "scaffolding": 2, + "mechanism": 4, + "really": 4, + "necessary": 2, + "custom": 1, + "name": 2, + "main": 1, + "Thus": 3, + "purpose": 1, + "parameter": 1, + "cater": 1, + "packages": 5, + "have": 3, + "existing": 1, + "using": 2, + "different": 2, + "wish": 1, + "scaffolding.": 1, + "explain": 1, + "why": 2, + "allow": 1, + "specifying": 1, + "gapdoc.main.": 1, + "code": 1, + "still": 1, + "honor": 1, + "though": 1, + "just": 1, + "case.": 1, + "SHEBANG#!#! In": 1, + "maketest": 12, + "part.": 1, + "Still": 1, + "under": 1, + "construction.": 1, + "SHEBANG#!#! ": 1, + "SHEBANG#!#! The": 1, + "SHEBANG#!#! a": 1, + "SHEBANG#!#! which": 1, + "SHEBANG#!#! the": 1, + "SHEBANG#!#! ": 1, + "SHEBANG#!#! ": 2, + "SHEBANG#!#! Sets": 1, + "SHEBANG#!#! A": 1, + "SHEBANG#!#! will": 1, + "SHEBANG#!#! @Returns": 1, + "SHEBANG#!#! @Arguments": 1, + "SHEBANG#!#! @ChapterInfo": 1, + "Magic.gi": 1, + "BindGlobal": 7, + "str": 8, + "suffix": 3, + "n": 31, + "m": 8, + "{": 21, + "}": 21, + "i": 25, + "d": 16, + "IsDirectoryPath": 1, + "CreateDir": 2, + "currently": 1, + "undocumented": 1, + "fail": 18, + "LastSystemError": 1, + ".message": 1, + "false": 7, + "pkg": 32, + "subdirs": 2, + "extensions": 1, + "d_rel": 6, + "files": 4, + "result": 9, + "DirectoriesPackageLibrary": 2, + "IsEmpty": 6, + "continue": 3, + "Directory": 5, + "DirectoryContents": 1, + "Sort": 1, + "AUTODOC_GetSuffix": 2, + "IsReadableFile": 2, + "Filename": 8, + "Add": 4, + "Make": 1, + "callable": 1, + "package_name": 1, + "AutoDocWorksheet.": 1, + "Which": 1, + "create": 1, + "worksheet": 1, + "package_info": 3, + "opt": 3, + "scaffold": 12, + "gapdoc": 7, + "autodoc": 8, + "pkg_dir": 5, + "doc_dir": 18, + "doc_dir_rel": 3, + "title_page": 7, + "tree": 8, + "is_worksheet": 13, + "position_document_class": 7, + "gapdoc_latex_option_record": 4, + "LowercaseString": 3, + "rec": 20, + "DirectoryCurrent": 1, + "PackageInfo": 1, + "key": 3, + "val": 4, + "ValueOption": 1, + "opt.": 1, + "IsBound": 39, + "opt.dir": 4, + "IsString": 7, + "IsDirectory": 1, + "AUTODOC_CreateDirIfMissing": 1, + "opt.scaffold": 5, + "package_info.AutoDoc": 3, + "IsRecord": 7, + "IsBool": 4, + "AUTODOC_APPEND_RECORD_WRITEONCE": 3, + "AUTODOC_WriteOnce": 10, + "opt.autodoc": 5, + "Concatenation": 15, + "package_info.Dependencies.NeededOtherPackages": 1, + "package_info.Dependencies.SuggestedOtherPackages": 1, + "ForAny": 1, + "autodoc.files": 7, + "autodoc.scan_dirs": 5, + "autodoc.level": 3, + "PushOptions": 1, + "level_value": 1, + "Append": 2, + "AUTODOC_FindMatchingFiles": 2, + "opt.gapdoc": 5, + "opt.maketest": 4, + "gapdoc.main": 8, + "package_info.PackageDoc": 3, + ".BookName": 2, + "gapdoc.bookname": 4, + "#Print": 1, + "gapdoc.files": 9, + "gapdoc.scan_dirs": 3, + "Set": 1, + "Number": 1, + "ListWithIdenticalEntries": 1, + "f": 11, + "DocumentationTree": 1, + "autodoc.section_intros": 2, + "AUTODOC_PROCESS_INTRO_STRINGS": 1, + "Tree": 2, + "AutoDocScanFiles": 1, + "PackageName": 2, + "scaffold.TitlePage": 4, + "scaffold.TitlePage.Title": 2, + ".TitlePage.Title": 2, + "Position": 2, + "Remove": 2, + "JoinStringsWithSeparator": 1, + "ReplacedString": 2, + "Syntax": 1, + "scaffold.document_class": 7, + "PositionSublist": 5, + "GAPDoc2LaTeXProcs.Head": 14, + "..": 6, + "scaffold.latex_header_file": 2, + "StringFile": 2, + "scaffold.gapdoc_latex_options": 4, + "RecNames": 1, + "scaffold.gapdoc_latex_options.": 5, + "IsList": 1, + "scaffold.includes": 4, + "scaffold.bib": 7, + "Unbind": 1, + "scaffold.main_xml_file": 2, + ".TitlePage": 1, + "ExtractTitleInfoFromPackageInfo": 1, + "CreateTitlePage": 1, + "scaffold.MainPage": 2, + "scaffold.dir": 1, + "scaffold.book_name": 1, + "CreateMainPage": 1, + "WriteDocumentation": 1, + "SetGapDocLaTeXOptions": 1, + "MakeGAPDocDoc": 1, + "CopyHTMLStyleFiles": 1, + "GAPDocManualLab": 1, + "maketest.folder": 3, + "maketest.scan_dir": 3, + "CreateMakeTest": 1, + "PackageInfo.g": 2, + "cvec": 1, + "s": 4, + "template": 1, + "SetPackageInfo": 1, + "Subtitle": 1, + "Version": 1, + "Date": 1, + "dd/mm/yyyy": 1, + "format": 2, + "Information": 1, + "about": 3, + "authors": 1, + "maintainers.": 1, + "Persons": 1, + "LastName": 1, + "FirstNames": 1, + "IsAuthor": 1, + "IsMaintainer": 1, + "Email": 1, + "WWWHome": 1, + "PostalAddress": 1, + "Place": 1, + "Institution": 1, + "Status": 2, + "information.": 1, + "Currently": 1, + "cases": 2, + "recognized": 1, + "successfully": 2, + "refereed": 2, + "developers": 1, + "agreed": 1, + "distribute": 1, + "them": 1, + "core": 1, + "system": 1, + "development": 1, + "versions": 1, + "all": 18, + "You": 1, + "must": 6, + "provide": 2, + "next": 6, + "entries": 8, + "status": 1, + "because": 2, + "was": 1, + "#CommunicatedBy": 1, + "#AcceptDate": 1, + "PackageWWWHome": 1, + "README_URL": 1, + ".PackageWWWHome": 2, + "PackageInfoURL": 1, + "ArchiveURL": 1, + ".Version": 2, + "ArchiveFormats": 1, + "Here": 2, + "short": 1, + "abstract": 1, + "explaining": 1, + "content": 1, + "HTML": 1, + "overview": 1, + "Web": 1, + "page": 1, + "an": 17, + "URL": 1, + "Webpage": 1, + "detailed": 1, + "information": 1, + "than": 1, + "few": 1, + "lines": 1, + "less": 1, + "ok": 1, + "Please": 1, + "specifing": 1, + "names.": 1, + "AbstractHTML": 1, + "PackageDoc": 1, + "BookName": 1, + "ArchiveURLSubset": 1, + "HTMLStart": 1, + "PDFFile": 1, + "SixFile": 1, + "LongTitle": 1, + "Dependencies": 1, + "NeededOtherPackages": 1, + "SuggestedOtherPackages": 1, + "ExternalConditions": 1, + "AvailabilityTest": 1, + "SHOW_STAT": 1, + "DirectoriesPackagePrograms": 1, + "#Info": 1, + "InfoWarning": 1, + "*Optional*": 2, + "but": 1, + "recommended": 1, + "path": 1, + "relative": 1, + "root": 1, + "many": 1, + "tests": 1, + "functionality": 1, + "sensible.": 1, + "#TestFile": 1, + "keyword": 1, + "related": 1, + "topic": 1, + "Keywords": 1, + "vspc.gd": 1, + "library": 2, + "Thomas": 2, + "Breuer": 2, + "#Y": 6, + "C": 11, + "Lehrstuhl": 2, + "D": 36, + "r": 2, + "Mathematik": 2, + "RWTH": 2, + "Aachen": 2, + "Germany": 2, + "School": 2, + "Math": 2, + "Comp.": 2, + "Sci.": 2, + "St": 2, + "Andrews": 2, + "Scotland": 2, + "Group": 3, + "declares": 1, + "operations": 2, + "vector": 67, + "spaces.": 4, + "bases": 5, + "free": 3, + "left": 15, + "modules": 1, + "found": 1, + "": 10, + "lib/basis.gd": 1, + ".": 257, + "IsLeftOperatorRing": 1, + "IsLeftOperatorAdditiveGroup": 2, + "IsRing": 1, + "IsAssociativeLOpDProd": 2, + "#T": 6, + "IsLeftOperatorRingWithOne": 2, + "IsRingWithOne": 1, + "IsLeftVectorSpace": 3, + "": 38, + "IsVectorSpace": 26, + "<#GAPDoc>": 17, + "Label=": 19, + "": 12, + "space": 74, + "": 12, + "module": 2, + "see": 30, + "nbsp": 30, + "": 71, + "Func=": 40, + "over": 24, + "division": 15, + "ring": 14, + "Chapter": 3, + "Chap=": 3, + "

": 23, + "Whenever": 1, + "talk": 1, + "": 42, + "F": 61, + "": 41, + "V": 152, + "additive": 1, + "group": 2, + "acts": 1, + "via": 6, + "multiplication": 1, + "from": 5, + "such": 4, + "action": 4, + "addition": 1, + "right": 2, + "distributive.": 1, + "accessed": 1, + "value": 9, + "attribute": 2, + "Vector": 1, + "spaces": 15, + "always": 1, + "Filt=": 4, + "synonyms.": 1, + "<#/GAPDoc>": 17, + "IsLeftActedOnByDivisionRing": 4, + "InstallTrueMethod": 4, + "IsGaussianSpace": 10, + "": 14, + "filter": 3, + "Sect=": 6, + "row": 17, + "matrix": 5, + "field": 12, + "say": 1, + "indicates": 3, + "vectors": 16, + "matrices": 5, + "respectively": 1, + "contained": 4, + "In": 3, + "case": 2, + "called": 1, + "Gaussian": 19, + "space.": 5, + "Bases": 1, + "computed": 2, + "elimination": 5, + "given": 4, + "generators.": 1, + "": 12, + "": 12, + "gap": 41, + "mats": 5, + "VectorSpace": 13, + "Rationals": 13, + "E": 2, + "element": 2, + "extension": 3, + "Field": 1, + "": 12, + "DeclareFilter": 1, + "IsFullMatrixModule": 1, + "IsFullRowModule": 1, + "IsDivisionRing": 5, + "": 12, + "nontrivial": 1, + "associative": 1, + "algebra": 2, + "multiplicative": 1, + "inverse": 1, + "each": 2, + "nonzero": 3, + "element.": 1, + "every": 1, + "possibly": 1, + "itself": 1, + "being": 2, + "thus": 1, + "property": 2, + "get": 1, + "usually": 1, + "represented": 1, + "coefficients": 3, + "stored": 1, + "DeclareSynonymAttr": 4, + "IsMagmaWithInversesIfNonzero": 1, + "IsNonTrivial": 1, + "IsAssociative": 1, + "IsEuclideanRing": 1, + "#A": 7, + "GeneratorsOfLeftVectorSpace": 1, + "GeneratorsOfVectorSpace": 2, + "": 7, + "Attr=": 10, + "returns": 14, + "generate": 1, + "FullRowSpace": 5, + "GeneratorsOfLeftOperatorAdditiveGroup": 2, + "CanonicalBasis": 3, + "supports": 1, + "canonical": 6, + "basis": 14, + "otherwise": 2, + "": 3, + "": 3, + "returned.": 4, + "defining": 1, + "its": 2, + "uniquely": 1, + "determined": 1, + "by": 14, + "exist": 1, + "same": 6, + "acting": 8, + "domain": 17, + "equality": 1, + "these": 5, + "decided": 1, + "comparing": 1, + "bases.": 1, + "exact": 1, + "meaning": 1, + "depends": 1, + "Canonical": 1, + "defined": 3, + "designs": 1, + "kind": 1, + "defines": 1, + "method": 4, + "installs": 1, + "call": 1, + "On": 1, + "hand": 1, + "install": 1, + "calls": 1, + "": 10, + "CANONICAL_BASIS_FLAGS": 1, + "": 9, + "vecs": 4, + "B": 16, + "": 8, + "3": 5, + "generators": 16, + "BasisVectors": 4, + "DeclareAttribute": 4, + "IsRowSpace": 2, + "consists": 7, + "IsRowModule": 1, + "IsGaussianRowSpace": 1, + "scalars": 2, + "occur": 2, + "vectors.": 2, + "calculations.": 2, + "Otherwise": 3, + "non": 4, + "Gaussian.": 2, + "need": 3, + "flag": 2, + "down": 2, + "methods": 4, + "delegate": 2, + "ones.": 2, + "IsNonGaussianRowSpace": 1, + "expresses": 2, + "cannot": 2, + "compute": 3, + "nice": 4, + "way.": 2, + "Let": 4, + "K": 4, + "spanned": 4, + "Then": 1, + "/": 12, + "cap": 1, + "v": 5, + "replacing": 1, + "forming": 1, + "concatenation.": 1, + "So": 2, + "associated": 3, + "DeclareHandlingByNiceBasis": 2, + "IsMatrixSpace": 2, + "IsMatrixModule": 1, + "IsGaussianMatrixSpace": 1, + "IsNonGaussianMatrixSpace": 1, + "irrelevant": 1, + "concatenation": 1, + "rows": 1, + "necessarily": 1, + "NormedRowVectors": 2, + "normed": 1, + "finite": 5, + "those": 1, + "first": 1, + "component.": 1, + "yields": 1, + "natural": 1, + "dimensional": 5, + "subspaces": 17, + "GF": 22, + "*Z": 5, + "Z": 6, + "Action": 1, + "GL": 1, + "OnLines": 1, + "TrivialSubspace": 2, + "subspace": 7, + "zero": 4, + "triv": 2, + "0": 2, + "AsSet": 1, + "TrivialSubmodule": 1, + "": 5, + "": 2, + "collection": 3, + "gens": 16, + "elements": 7, + "optional": 3, + "argument": 1, + "empty.": 1, + "known": 5, + "linearly": 3, + "independent": 3, + "particular": 1, + "dimension": 9, + "immediately": 2, + "formed": 1, + "argument.": 1, + "2": 1, + "Subspace": 4, + "generated": 1, + "SubspaceNC": 2, + "subset": 4, + "empty": 1, + "trivial": 1, + "parent": 3, + "returned": 3, + "does": 1, + "except": 1, + "omits": 1, + "check": 5, + "both": 2, + "W": 32, + "1": 3, + "Submodule": 1, + "SubmoduleNC": 1, + "#O": 2, + "AsVectorSpace": 4, + "view": 4, + "": 2, + "domain.": 1, + "form": 2, + "Oper=": 6, + "smaller": 1, + "larger": 1, + "ring.": 3, + "Dimension": 6, + "LeftActingDomain": 29, + "9": 1, + "AsLeftModule": 6, + "AsSubspace": 5, + "": 6, + "U": 12, + "collection.": 1, + "/2": 4, + "Parent": 4, + "DeclareOperation": 2, + "IsCollection": 3, + "Intersection2Spaces": 4, + "": 2, + "": 2, + "": 2, + "takes": 1, + "arguments": 1, + "intersection": 5, + "domains": 3, + "let": 1, + "their": 1, + "intersection.": 1, + "AsStruct": 2, + "equal": 1, + "either": 2, + "Substruct": 1, + "common": 1, + "Struct": 1, + "basis.": 1, + "handle": 1, + "intersections": 1, + "algebras": 2, + "ideals": 2, + "sided": 1, + "ideals.": 1, + "": 2, + "": 2, + "nonnegative": 2, + "integer": 2, + "length": 1, + "An": 2, + "alternative": 2, + "construct": 2, + "above": 2, + "FullRowModule": 2, + "FullMatrixSpace": 2, + "": 1, + "positive": 1, + "integers": 1, + "fact": 1, + "FullMatrixModule": 3, + "IsSubspacesVectorSpace": 9, + "fixed": 1, + "lies": 1, + "category": 1, + "Subspaces": 8, + "Size": 5, + "iter": 17, + "Iterator": 5, + "NextIterator": 5, + "DeclareCategory": 1, + "IsDomain": 1, + "IsFinite": 4, + "Returns": 1, + "": 1, + "Called": 2, + "k": 17, + "Special": 1, + "provided": 1, + "domains.": 1, + "IsInt": 3, + "IsSubspace": 3, + "OrthogonalSpaceInFullRowSpace": 1, + "complement": 1, + "full": 2, + "#P": 1, + "IsVectorSpaceHomomorphism": 3, + "": 2, + "": 1, + "mapping": 2, + "homomorphism": 1, + "linear": 1, + "source": 2, + "range": 1, + "b": 8, + "hold": 1, + "IsGeneralMapping": 2, + "#E": 2, + "vspc.gi": 1, + "generic": 1, + "SetLeftActingDomain": 2, + "": 2, + "external": 1, + "knows": 1, + "e.g.": 1, + "tell": 1, + "InstallOtherMethod": 3, + "IsAttributeStoringRep": 2, + "IsLeftActedOnByRing": 2, + "IsObject": 1, + "extL": 2, + "HasIsDivisionRing": 1, + "SetIsLeftActedOnByDivisionRing": 1, + "IsExtLSet": 1, + "IsIdenticalObj": 5, + "difference": 1, + "between": 1, + "shall": 1, + "CallFuncList": 1, + "FreeLeftModule": 1, + "newC": 7, + "IsSubset": 4, + "SetParent": 1, + "UseIsomorphismRelation": 2, + "UseSubsetRelation": 4, + "View": 1, + "base": 5, + "gen": 5, + "loop": 2, + "newgens": 4, + "extended": 1, + "Characteristic": 2, + "Basis": 5, + "AsField": 2, + "GeneratorsOfLeftModule": 9, + "LeftModuleByGenerators": 5, + "Zero": 5, + "Intersection": 1, + "ViewObj": 4, + "print": 1, + "no.": 1, + "HasGeneratorsOfLeftModule": 2, + "HasDimension": 1, + "override": 1, + "PrintObj": 5, + "HasZero": 1, + "": 2, + "factor": 2, + "": 1, + "ImagesSource": 1, + "NaturalHomomorphismBySubspace": 1, + "AsStructure": 3, + "Substructure": 3, + "Structure": 2, + "inters": 17, + "gensV": 7, + "gensW": 7, + "VW": 3, + "sum": 1, + "Intersection2": 4, + "IsFiniteDimensional": 2, + "Coefficients": 3, + "SumIntersectionMat": 1, + "LinearCombination": 2, + "HasParent": 2, + "SetIsTrivial": 1, + "ClosureLeftModule": 2, + "": 1, + "closure": 1, + "IsCollsElms": 1, + "HasBasis": 1, + "IsVector": 1, + "w": 3, + "easily": 1, + "UseBasis": 1, + "Methods": 1, + "collections": 1, + "#R": 1, + "IsSubspacesVectorSpaceDefaultRep": 7, + "representation": 1, + "components": 1, + "means": 1, + "DeclareRepresentation": 1, + "IsComponentObjectRep": 1, + ".dimension": 9, + ".structure": 9, + "number": 2, + "q": 20, + "prod_": 2, + "frac": 3, + "recursion": 1, + "sum_": 1, + "size": 12, + "qn": 10, + "qd": 10, + "ank": 6, + "Int": 1, + "Enumerator": 2, + "Use": 1, + "iterator": 3, + "allowed": 1, + "elms": 4, + "IsDoneIterator": 3, + ".associatedIterator": 3, + ".basis": 2, + "structure": 4, + "associatedIterator": 2, + "ShallowCopy": 2, + "IteratorByFunctions": 1, + "IsDoneIterator_Subspaces": 1, + "NextIterator_Subspaces": 1, + "ShallowCopy_Subspaces": 1, + "": 1, + "dim": 2, + "Objectify": 2, + "NewType": 2, + "CollectionsFamily": 2, + "FamilyObj": 2, + "map": 4, + "S": 4, + "Source": 1, + "Range": 1, + "IsLinearMapping": 1 + }, "GAS": { ".cstring": 1, "LC0": 2, @@ -18086,14 +25252,14 @@ "////": 4, "High": 1, "quality": 2, - "(": 386, + "(": 435, "Some": 1, "browsers": 1, "may": 1, "freeze": 1, "or": 1, "crash": 1, - ")": 386, + ")": 435, "//#define": 10, "HIGHQUALITY": 2, "Medium": 1, @@ -18120,7 +25286,7 @@ "RAGGED_LEAVES": 5, "DETAILED_NOISE": 3, "LIGHT_AA": 3, - "//": 36, + "//": 38, "sample": 2, "SSAA": 2, "HEAVY_AA": 2, @@ -18130,12 +25296,12 @@ "Configurations": 1, "#ifdef": 14, "#endif": 14, - "const": 18, - "float": 103, + "const": 19, + "float": 105, "eps": 5, "e": 4, "-": 108, - ";": 353, + ";": 383, "PI": 3, "vec3": 165, "sunDir": 5, @@ -18154,13 +25320,13 @@ "tonemapping": 1, "mod289": 4, "x": 11, - "{": 61, + "{": 82, "return": 47, "floor": 8, "*": 115, "/": 24, - "}": 61, - "vec4": 72, + "}": 82, + "vec4": 73, "permute": 4, "x*34.0": 1, "+": 108, @@ -18361,7 +25527,7 @@ "shadow": 4, "taken": 1, "for": 7, - "int": 7, + "int": 8, "rayDir*t": 2, "res": 6, "res.x": 3, @@ -18464,8 +25630,8 @@ "iResolution.x/iResolution.y*0.5": 1, "rd.x": 1, "rd.y": 1, - "void": 5, - "main": 3, + "void": 31, + "main": 5, "gl_FragCoord.xy": 7, "*0.25": 4, "*0.5": 1, @@ -18477,7 +25643,38 @@ "col*exposure": 1, "x*": 2, ".5": 1, - "gl_FragColor": 2, + "gl_FragColor": 3, + "#version": 2, + "core": 1, + "cbar": 2, + "cfoo": 1, + "CB": 2, + "CD": 2, + "CA": 1, + "CC": 1, + "CBT": 5, + "CDT": 3, + "CAT": 1, + "CCT": 1, + "norA": 4, + "norB": 3, + "norC": 1, + "norD": 1, + "norE": 4, + "norF": 1, + "norG": 1, + "norH": 1, + "norI": 1, + "norcA": 2, + "norcB": 3, + "norcC": 2, + "norcD": 2, + "head": 1, + "of": 1, + "cycle": 2, + "norcE": 1, + "lead": 1, + "into": 1, "NUM_LIGHTS": 4, "AMBIENT": 2, "MAX_DIST": 3, @@ -18486,7 +25683,7 @@ "lightColor": 3, "[": 29, "]": 29, - "varying": 3, + "varying": 4, "fragmentNormal": 2, "cameraVector": 2, "lightVector": 4, @@ -18514,7 +25711,11 @@ "specularDot": 2, "sample.rgb": 1, "sample.a": 1, - "#version": 1, + "static": 1, + "char*": 1, + "SimpleFragmentShader": 1, + "STRINGIFY": 1, + "FrontColor": 2, "kCoeff": 2, "kCube": 2, "uShift": 3, @@ -18567,6 +25768,179 @@ "gl_FragColor.rgba": 1, "sampled.rgb": 1 }, + "Gnuplot": { + "set": 98, + "label": 14, + "at": 14, + "-": 102, + "left": 15, + "norotate": 18, + "back": 23, + "textcolor": 13, + "rgb": 8, + "nopoint": 14, + "offset": 25, + "character": 22, + "lt": 15, + "style": 7, + "line": 4, + "linetype": 11, + "linecolor": 4, + "linewidth": 11, + "pointtype": 4, + "pointsize": 4, + "default": 4, + "pointinterval": 4, + "noxtics": 2, + "noytics": 2, + "title": 13, + "xlabel": 6, + "xrange": 3, + "[": 18, + "]": 18, + "noreverse": 13, + "nowriteback": 12, + "yrange": 4, + "bmargin": 1, + "unset": 2, + "colorbox": 3, + "plot": 3, + "cos": 9, + "(": 52, + "x": 7, + ")": 52, + "ls": 4, + ".2": 1, + ".4": 1, + ".6": 1, + ".8": 1, + "lc": 3, + "boxwidth": 1, + "absolute": 1, + "fill": 1, + "solid": 1, + "border": 3, + "key": 1, + "inside": 1, + "right": 1, + "top": 1, + "vertical": 2, + "Right": 1, + "noenhanced": 1, + "autotitles": 1, + "nobox": 1, + "histogram": 1, + "clustered": 1, + "gap": 1, + "datafile": 1, + "missing": 1, + "data": 1, + "histograms": 1, + "xtics": 3, + "in": 1, + "scale": 1, + "nomirror": 1, + "rotate": 3, + "by": 3, + "autojustify": 1, + "norangelimit": 3, + "font": 8, + "i": 1, + "using": 2, + "xtic": 1, + "ti": 4, + "col": 4, + "u": 25, + "SHEBANG#!gnuplot": 1, + "reset": 1, + "terminal": 1, + "png": 1, + "output": 1, + "ylabel": 5, + "#set": 2, + "xr": 1, + "yr": 1, + "pt": 2, + "notitle": 15, + "dummy": 3, + "v": 31, + "arrow": 7, + "from": 7, + "to": 7, + "head": 7, + "nofilled": 7, + "parametric": 3, + "view": 3, + "samples": 3, + "isosamples": 3, + "hidden3d": 2, + "trianglepattern": 2, + "undefined": 2, + "altdiagonal": 2, + "bentover": 2, + "ztics": 2, + "zlabel": 4, + "zrange": 2, + "sinc": 13, + "sin": 3, + "sqrt": 4, + "u**2": 4, + "+": 6, + "v**2": 4, + "/": 2, + "GPFUN_sinc": 2, + "xx": 2, + "dx": 2, + "x0": 4, + "x1": 4, + "x2": 4, + "x3": 4, + "x4": 4, + "x5": 4, + "x6": 4, + "x7": 4, + "x8": 4, + "x9": 4, + "splot": 3, + "<": 10, + "xmin": 3, + "xmax": 1, + "n": 1, + "zbase": 2, + ".5": 2, + "*n": 1, + "floor": 3, + "u/3": 1, + "*dx": 1, + "%": 2, + "u/3.*dx": 1, + "/0": 1, + "angles": 1, + "degrees": 1, + "mapping": 1, + "spherical": 1, + "noztics": 1, + "urange": 1, + "vrange": 1, + "cblabel": 1, + "cbrange": 1, + "user": 1, + "origin": 1, + "screen": 2, + "size": 1, + "front": 1, + "bdefault": 1, + "*cos": 1, + "*sin": 1, + "with": 3, + "lines": 2, + "labels": 1, + "point": 1, + "lw": 1, + ".1": 1, + "tc": 1, + "pal": 1 + }, "Gosu": { "<%!-->": 1, "defined": 1, @@ -18702,12 +26076,682 @@ "PersonCSVTemplate.renderToString": 1, "PersonCSVTemplate.render": 1 }, + "Grammatical Framework": { + "-": 594, + "(": 256, + "c": 73, + ")": 256, + "Aarne": 13, + "Ranta": 13, + "under": 33, + "LGPL": 33, + "abstract": 1, + "Foods": 34, + "{": 579, + "flags": 32, + "startcat": 1, + "Comment": 31, + ";": 1399, + "cat": 1, + "Item": 31, + "Kind": 33, + "Quality": 34, + "fun": 1, + "Pred": 30, + "This": 29, + "That": 29, + "These": 28, + "Those": 28, + "Mod": 29, + "Wine": 29, + "Cheese": 29, + "Fish": 29, + "Pizza": 28, + "Very": 29, + "Fresh": 29, + "Warm": 29, + "Italian": 29, + "Expensive": 29, + "Delicious": 29, + "Boring": 29, + "}": 580, + "Laurette": 2, + "Pretorius": 2, + "Sr": 2, + "&": 2, + "Jr": 2, + "and": 4, + "Ansu": 2, + "Berg": 2, + "concrete": 33, + "FoodsAfr": 1, + "of": 89, + "open": 23, + "Prelude": 11, + "Predef": 3, + "in": 32, + "coding": 29, + "utf8": 29, + "lincat": 28, + "s": 365, + "Str": 394, + "Number": 207, + "n": 206, + "AdjAP": 10, + "lin": 28, + "item": 36, + "quality": 90, + "item.s": 24, + "+": 480, + "quality.s": 50, + "Predic": 3, + "kind": 115, + "kind.s": 46, + "Sg": 184, + "Pl": 182, + "table": 148, + "Attr": 9, + "declNoun_e": 2, + "declNoun_aa": 2, + "declNoun_ss": 2, + "declNoun_s": 2, + "veryAdj": 2, + "regAdj": 61, + "smartAdj_e": 4, + "param": 22, + "|": 122, + "oper": 29, + "Noun": 9, + "operations": 2, + "wyn": 1, + "kaas": 1, + "vis": 1, + "pizza": 1, + "x": 74, + "let": 8, + "v": 6, + "tk": 1, + "last": 3, + "Adjective": 9, + "mkAdj": 27, + "y": 3, + "declAdj_e": 2, + "declAdj_g": 2, + "w": 15, + "init": 4, + "declAdj_oog": 2, + "i": 2, + "a": 57, + "x.s": 8, + "case": 44, + "_": 68, + "FoodsAmh": 1, + "Krasimir": 1, + "Angelov": 1, + "FoodsBul": 1, + "Gender": 94, + "Masc": 67, + "Fem": 65, + "Neutr": 21, + "Agr": 3, + "ASg": 23, + "APl": 11, + "g": 132, + "qual": 8, + "item.a": 2, + "qual.s": 8, + "kind.g": 38, + "#": 14, + "path": 14, + ".": 13, + "present": 7, + "Jordi": 2, + "Saludes": 2, + "FoodsCat": 1, + "FoodsI": 6, + "with": 5, + "Syntax": 7, + "SyntaxCat": 2, + "LexFoods": 12, + "LexFoodsCat": 2, + "FoodsChi": 1, + "p": 11, + "quality.p": 2, + "kind.c": 11, + "geKind": 5, + "longQuality": 8, + "mkKind": 2, + "Katerina": 2, + "Bohmova": 2, + "FoodsCze": 1, + "ResCze": 2, + "NounPhrase": 3, + "copula": 33, + "item.n": 29, + "item.g": 12, + "det": 86, + "noun": 51, + "regnfAdj": 2, + "Femke": 1, + "Johansson": 1, + "FoodsDut": 1, + "AForm": 4, + "APred": 8, + "AAttr": 3, + "regNoun": 38, + "f": 16, + "a.s": 8, + "regadj": 6, + "adj": 38, + "noun.s": 7, + "man": 10, + "men": 10, + "wijn": 3, + "koud": 3, + "duur": 2, + "dure": 2, + "FoodsEng": 1, + "language": 2, + "en_US": 1, + "car": 6, + "cold": 4, + "Julia": 1, + "Hammar": 1, + "FoodsEpo": 1, + "SS": 6, + "ss": 13, + "d": 6, + "cn": 11, + "cn.s": 8, + "vino": 3, + "nova": 3, + "FoodsFin": 1, + "SyntaxFin": 2, + "LexFoodsFin": 2, + "../foods": 1, + "FoodsFre": 1, + "SyntaxFre": 1, + "ParadigmsFre": 1, + "Utt": 4, + "NP": 4, + "CN": 4, + "AP": 4, + "mkUtt": 4, + "mkCl": 4, + "mkNP": 16, + "this_QuantSg": 2, + "that_QuantSg": 2, + "these_QuantPl": 2, + "those_QuantPl": 2, + "mkCN": 20, + "mkAP": 28, + "very_AdA": 4, + "mkN": 46, + "masculine": 4, + "feminine": 2, + "mkA": 47, + "FoodsGer": 1, + "SyntaxGer": 2, + "LexFoodsGer": 2, + "alltenses": 3, + "Dana": 1, + "Dannells": 1, + "Licensed": 1, + "FoodsHeb": 2, + "Species": 8, + "mod": 7, + "Modified": 5, + "sp": 11, + "Indef": 6, + "Def": 21, + "T": 2, + "regAdj2": 3, + "F": 2, + "Type": 9, + "Adj": 4, + "m": 9, + "cn.mod": 2, + "cn.g": 10, + "gvina": 6, + "hagvina": 3, + "gvinot": 6, + "hagvinot": 3, + "defH": 7, + "replaceLastLetter": 7, + "adjective": 22, + "tov": 6, + "tova": 3, + "tovim": 3, + "tovot": 3, + "to": 6, + "c@": 3, + "italki": 3, + "italk": 4, + "Vikash": 1, + "Rauniyar": 1, + "FoodsHin": 2, + "regN": 15, + "lark": 8, + "ms": 4, + "mp": 4, + "acch": 6, + "incomplete": 1, + "this_Det": 2, + "that_Det": 2, + "these_Det": 2, + "those_Det": 2, + "wine_N": 7, + "pizza_N": 7, + "cheese_N": 7, + "fish_N": 8, + "fresh_A": 7, + "warm_A": 8, + "italian_A": 7, + "expensive_A": 7, + "delicious_A": 7, + "boring_A": 7, + "prelude": 2, + "Martha": 1, + "Dis": 1, + "Brandt": 1, + "FoodsIce": 1, + "Defin": 9, + "Ind": 14, + "the": 7, + "word": 3, + "is": 6, + "more": 1, + "commonly": 1, + "used": 2, + "Iceland": 1, + "but": 1, + "Icelandic": 1, + "for": 6, + "it": 2, + "defOrInd": 2, + "order": 1, + "given": 1, + "forms": 2, + "mSg": 1, + "fSg": 1, + "nSg": 1, + "mPl": 1, + "fPl": 1, + "nPl": 1, + "mSgDef": 1, + "f/nSgDef": 1, + "_PlDef": 1, + "masc": 3, + "fem": 2, + "neutr": 2, + "x1": 3, + "x9": 1, + "ferskur": 5, + "fersk": 11, + "ferskt": 2, + "ferskir": 2, + "ferskar": 2, + "fersk_pl": 2, + "ferski": 2, + "ferska": 2, + "fersku": 2, + "t": 28, + "": 1, + "<": 10, + "Predef.tk": 2, + "FoodsIta": 1, + "SyntaxIta": 2, + "LexFoodsIta": 2, + "../lib/src/prelude": 1, + "Zofia": 1, + "Stankiewicz": 1, + "FoodsJpn": 1, + "Style": 3, + "AdjUse": 4, + "AdjType": 4, + "quality.t": 3, + "IAdj": 4, + "Plain": 3, + "Polite": 4, + "NaAdj": 4, + "na": 1, + "adjectives": 2, + "have": 2, + "different": 1, + "as": 2, + "attributes": 1, + "predicates": 2, + "phrase": 1, + "types": 1, + "can": 1, + "form": 4, + "without": 1, + "cannot": 1, + "sakana": 6, + "chosenna": 2, + "chosen": 2, + "akai": 2, + "Inese": 1, + "Bernsone": 1, + "FoodsLav": 1, + "Q": 5, + "Q1": 5, + "q": 10, + "spec": 2, + "Q2": 3, + "specAdj": 2, + "skaists": 5, + "skaista": 2, + "skaisti": 2, + "skaistas": 2, + "skaistais": 2, + "skaistaa": 2, + "skaistie": 2, + "skaistaas": 2, + "skaist": 8, + "John": 1, + "J.": 1, + "Camilleri": 1, + "FoodsMlt": 1, + "uniAdj": 2, + "Create": 6, + "an": 2, + "full": 1, + "function": 1, + "Params": 4, + "Sing": 4, + "Plural": 2, + "iswed": 2, + "sewda": 2, + "suwed": 3, + "regular": 2, + "Param": 2, + "frisk": 4, + "eg": 1, + "tal": 1, + "buzz": 1, + "uni": 4, + "Singular": 1, + "inherent": 1, + "ktieb": 2, + "kotba": 2, + "Copula": 1, + "linking": 1, + "verb": 1, + "article": 3, + "taking": 1, + "into": 1, + "account": 1, + "first": 1, + "letter": 1, + "next": 1, + "pre": 1, + "cons@": 1, + "cons": 1, + "determinant": 1, + "Sg/Pl": 1, + "string": 1, + "default": 1, + "gender": 2, + "number": 2, + "/GF/lib/src/prelude": 1, + "Nyamsuren": 1, + "Erdenebadrakh": 1, + "FoodsMon": 1, + "prefixSS": 1, + "Dinesh": 1, + "Simkhada": 1, + "FoodsNep": 1, + "adjPl": 2, + "bor": 2, + "FoodsOri": 1, + "FoodsPes": 1, + "optimize": 1, + "noexpand": 1, + "Add": 8, + "prep": 11, + "Indep": 4, + "kind.prep": 1, + "quality.prep": 1, + "at": 3, + "a.prep": 1, + "must": 1, + "be": 1, + "written": 1, + "x4": 2, + "pytzA": 3, + "pytzAy": 1, + "pytzAhA": 3, + "pr": 4, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "mrd": 8, + "tAzh": 8, + "tAzhy": 2, + "Rami": 1, + "Shashati": 1, + "FoodsPor": 1, + "mkAdjReg": 7, + "QualityT": 5, + "bonito": 2, + "bonita": 2, + "bonitos": 2, + "bonitas": 2, + "pattern": 1, + "adjSozinho": 2, + "sozinho": 3, + "sozinh": 4, + "independent": 1, + "adjUtil": 2, + "util": 3, + "uteis": 3, + "smart": 1, + "paradigm": 1, + "adjcetives": 1, + "ItemT": 2, + "KindT": 4, + "num": 6, + "noun.g": 3, + "animal": 2, + "animais": 2, + "gen": 4, + "carro": 3, + "Ramona": 1, + "Enache": 1, + "FoodsRon": 1, + "NGender": 6, + "NMasc": 2, + "NFem": 3, + "NNeut": 2, + "mkTab": 5, + "mkNoun": 5, + "getAgrGender": 3, + "acesta": 2, + "aceasta": 2, + "gg": 3, + "det.s": 1, + "peste": 2, + "pesti": 2, + "scump": 2, + "scumpa": 2, + "scumpi": 2, + "scumpe": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "ng": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "FoodsSpa": 1, + "SyntaxSpa": 1, + "StructuralSpa": 1, + "ParadigmsSpa": 1, + "FoodsSwe": 1, + "SyntaxSwe": 2, + "LexFoodsSwe": 2, + "**": 1, + "sv_SE": 1, + "FoodsTha": 1, + "SyntaxTha": 1, + "LexiconTha": 1, + "ParadigmsTha": 1, + "R": 4, + "ResTha": 1, + "R.thword": 4, + "FoodsTsn": 1, + "NounClass": 28, + "r": 9, + "b": 9, + "Bool": 5, + "p_form": 18, + "TType": 16, + "mkPredDescrCop": 2, + "item.c": 1, + "quality.p_form": 1, + "kind.w": 4, + "mkDemPron1": 3, + "kind.q": 4, + "mkDemPron2": 3, + "mkMod": 2, + "Lexicon": 1, + "mkNounNC14_6": 2, + "mkNounNC9_10": 4, + "smartVery": 2, + "mkVarAdj": 2, + "mkOrdAdj": 4, + "mkPerAdj": 2, + "mkVerbRel": 2, + "NC9_10": 14, + "NC14_6": 14, + "P": 4, + "V": 4, + "ModV": 4, + "y.b": 1, + "True": 3, + "y.w": 2, + "y.r": 2, + "y.c": 14, + "y.q": 4, + "smartQualRelPart": 5, + "x.t": 10, + "smartDescrCop": 5, + "False": 3, + "mkVeryAdj": 2, + "x.p_form": 2, + "mkVeryVerb": 3, + "mkQualRelPart_PName": 2, + "mkQualRelPart": 2, + "mkDescrCop_PName": 2, + "mkDescrCop": 2, + "FoodsTur": 1, + "Case": 10, + "softness": 4, + "Softness": 5, + "h": 4, + "Harmony": 5, + "Reason": 1, + "excluding": 1, + "plural": 3, + "In": 1, + "Turkish": 1, + "if": 1, + "subject": 1, + "not": 2, + "human": 2, + "being": 1, + "then": 1, + "singular": 1, + "regardless": 1, + "subject.": 1, + "Since": 1, + "all": 1, + "possible": 1, + "subjects": 1, + "are": 1, + "non": 1, + "do": 1, + "need": 1, + "form.": 1, + "quality.softness": 1, + "quality.h": 1, + "quality.c": 1, + "Nom": 9, + "Gen": 5, + "a.c": 1, + "a.softness": 1, + "a.h": 1, + "I_Har": 4, + "Ih_Har": 4, + "U_Har": 4, + "Uh_Har": 4, + "Ih": 1, + "Uh": 1, + "Soft": 3, + "Hard": 3, + "overload": 1, + "mkn": 1, + "peynir": 2, + "peynirler": 2, + "[": 2, + "]": 2, + "sarap": 2, + "saraplar": 2, + "sarabi": 2, + "saraplari": 2, + "italyan": 4, + "ca": 2, + "getSoftness": 2, + "getHarmony": 2, + "See": 1, + "comment": 1, + "lines": 1, + "excluded": 1, + "copula.": 1, + "base": 4, + "*": 1, + "Shafqat": 1, + "Virk": 1, + "FoodsUrd": 1, + "coupla": 2, + "interface": 1, + "N": 4, + "A": 6, + "instance": 5, + "ParadigmsCat": 1, + "M": 1, + "MorphoCat": 1, + "M.Masc": 2, + "ParadigmsFin": 1, + "ParadigmsGer": 1, + "ParadigmsIta": 1, + "ParadigmsSwe": 1, + "resource": 1, + "ne": 2, + "muz": 2, + "muzi": 2, + "msg": 3, + "fsg": 3, + "nsg": 3, + "mpl": 3, + "fpl": 3, + "npl": 3, + "mlad": 7, + "vynikajici": 7 + }, "Groovy": { "task": 1, "echoDirListViaAntBuilder": 1, "(": 7, ")": 7, - "{": 3, + "{": 9, "description": 1, "//Docs": 1, "http": 1, @@ -18735,7 +26779,7 @@ "ant.fileScanner": 1, "fileset": 1, "dir": 1, - "}": 3, + "}": 9, ".each": 1, "//Print": 1, "each": 1, @@ -18746,10 +26790,16 @@ "CWD": 1, "projectDir": 1, "removed.": 1, - "println": 2, + "println": 3, "it.toString": 1, "-": 1, - "SHEBANG#!groovy": 1 + "SHEBANG#!groovy": 2, + "html": 3, + "head": 2, + "component": 1, + "title": 2, + "body": 1, + "p": 1 }, "Groovy Server Pages": { "": 4, @@ -18818,6 +26868,283 @@ "": 1, "/each": 1 }, + "Haskell": { + "import": 6, + "Data.Char": 1, + "main": 4, + "IO": 2, + "(": 8, + ")": 8, + "do": 3, + "let": 2, + "hello": 2, + "putStrLn": 3, + "map": 13, + "toUpper": 1, + "module": 2, + "Main": 1, + "where": 4, + "Sudoku": 9, + "Data.Maybe": 2, + "sudoku": 36, + "[": 4, + "]": 3, + "pPrint": 5, + "+": 2, + "fromMaybe": 1, + "solve": 5, + "isSolved": 4, + "Data.List": 1, + "Data.List.Split": 1, + "type": 1, + "Int": 1, + "-": 3, + "Maybe": 1, + "|": 8, + "Just": 1, + "otherwise": 2, + "index": 27, + "<": 1, + "elemIndex": 1, + "sudokus": 2, + "nextTest": 5, + "i": 7, + "<->": 1, + "1": 2, + "9": 7, + "checkRow": 2, + "checkColumn": 2, + "checkBox": 2, + "listToMaybe": 1, + "mapMaybe": 1, + "take": 1, + "drop": 1, + "length": 12, + "getRow": 3, + "nub": 6, + "getColumn": 3, + "getBox": 3, + "filter": 3, + "0": 3, + "chunksOf": 10, + "quot": 3, + "transpose": 4, + "mod": 2, + "concat": 2, + "concatMap": 2, + "3": 4, + "27": 1, + "Bool": 1, + "product": 1, + "False": 4, + ".": 4, + "sudokuRows": 4, + "/": 3, + "sudokuColumns": 3, + "sudokuBoxes": 3, + "True": 1, + "String": 1, + "intercalate": 2, + "show": 1 + }, + "HTML": { + "": 2, + "HTML": 2, + "PUBLIC": 2, + "W3C": 2, + "DTD": 3, + "4": 1, + "0": 2, + "Frameset": 1, + "EN": 2, + "http": 3, + "www": 2, + "w3": 2, + "org": 2, + "TR": 2, + "REC": 1, + "html40": 1, + "frameset": 1, + "dtd": 2, + "": 2, + "": 2, + "Common_meta": 1, + "(": 14, + ")": 14, + "": 2, + "Android": 5, + "API": 7, + "Differences": 2, + "Report": 2, + "": 2, + "": 2, + "

": 10, + "class=": 22, + "Header": 1, + "

": 1, + "

": 1, + "

": 3, + "This": 1, + "document": 1, + "details": 1, + "the": 11, + "changes": 2, + "in": 4, + "framework": 2, + "API.": 3, + "It": 2, + "shows": 1, + "additions": 1, + "modifications": 1, + "and": 5, + "removals": 2, + "for": 2, + "packages": 1, + "classes": 1, + "methods": 1, + "fields.": 1, + "Each": 1, + "reference": 1, + "to": 3, + "an": 3, + "change": 2, + "includes": 1, + "a": 4, + "brief": 1, + "description": 1, + "of": 5, + "explanation": 1, + "suggested": 1, + "workaround": 1, + "where": 1, + "available.": 1, + "

": 3, + "The": 2, + "differences": 2, + "described": 1, + "this": 2, + "report": 1, + "are": 3, + "based": 1, + "comparison": 1, + "APIs": 1, + "whose": 1, + "versions": 1, + "specified": 1, + "upper": 1, + "-": 1, + "right": 1, + "corner": 1, + "page.": 1, + "compares": 1, + "newer": 1, + "older": 2, + "version": 1, + "noting": 1, + "any": 1, + "relative": 1, + "So": 1, + "example": 1, + "indicated": 1, + "no": 1, + "longer": 1, + "present": 1, + "For": 1, + "more": 1, + "information": 1, + "about": 1, + "SDK": 1, + "see": 1, + "
": 8, + "href=": 9, + "target=": 3, + "product": 1, + "site": 1, + "": 8, + ".": 1, + "if": 4, + "no_delta": 1, + "

": 1, + "Congratulation": 1, + "

": 1, + "No": 1, + "were": 1, + "detected": 1, + "between": 1, + "two": 1, + "provided": 1, + "APIs.": 1, + "endif": 4, + "removed_packages": 2, + "Table": 3, + "name": 3, + "rows": 3, + "{": 3, + "it.from": 1, + "ModelElementRow": 1, + "}": 3, + "
": 3, + "added_packages": 2, + "it.to": 2, + "PackageAddedLink": 1, + "SimpleTableRow": 2, + "changed_packages": 2, + "PackageChangedLink": 1, + "
": 11, + "": 2, + "": 2, + "html": 1, + "XHTML": 1, + "1": 1, + "Transitional": 1, + "xhtml1": 2, + "transitional": 1, + "xmlns=": 1, + "": 1, + "equiv=": 1, + "content=": 1, + "Related": 2, + "Pages": 2, + "": 1, + "rel=": 1, + "type=": 1, + "": 1, + "Main": 1, + "Page": 1, + "&": 3, + "middot": 3, + ";": 3, + "Class": 2, + "Overview": 2, + "Hierarchy": 1, + "All": 1, + "Classes": 1, + "Here": 1, + "is": 1, + "list": 1, + "all": 1, + "related": 1, + "documentation": 1, + "pages": 1, + "": 1, + "": 2, + "id=": 2, + "": 4, + "": 2, + "16": 1, + "Layout": 1, + "System": 1, + "
": 4, + "": 2, + "src=": 2, + "alt=": 2, + "width=": 1, + "height=": 2, + "
": 1, + "Generated": 1, + "with": 1, + "Doxygen": 1 + }, "Hy": { ";": 4, "Fibonacci": 1, @@ -19052,6 +27379,57 @@ "[": 1, "]": 1 }, + "Inform 7": { + "by": 3, + "Andrew": 3, + "Plotkin.": 2, + "Include": 1, + "Trivial": 3, + "Extension": 3, + "The": 1, + "Kitchen": 1, + "is": 4, + "a": 2, + "room.": 1, + "[": 1, + "This": 1, + "kitchen": 1, + "modelled": 1, + "after": 1, + "the": 4, + "one": 1, + "in": 2, + "Zork": 1, + "although": 1, + "it": 1, + "lacks": 1, + "detail": 1, + "to": 2, + "establish": 1, + "this": 1, + "player.": 1, + "]": 1, + "A": 3, + "purple": 1, + "cow": 3, + "called": 1, + "Gelett": 2, + "Kitchen.": 1, + "Instead": 1, + "of": 3, + "examining": 1, + "say": 1, + "Version": 1, + "Plotkin": 1, + "begins": 1, + "here.": 2, + "kind": 1, + "animal.": 1, + "can": 1, + "be": 1, + "purple.": 1, + "ends": 1 + }, "INI": { ";": 1, "editorconfig.org": 1, @@ -19081,6 +27459,87 @@ "SHEBANG#!ioke": 1, "println": 1 }, + "Isabelle": { + "theory": 1, + "HelloWorld": 3, + "imports": 1, + "Main": 1, + "begin": 1, + "section": 1, + "{": 5, + "*Playing": 1, + "around": 1, + "with": 2, + "Isabelle*": 1, + "}": 5, + "text": 4, + "*": 4, + "creating": 1, + "a": 2, + "lemma": 2, + "the": 2, + "name": 1, + "hello_world*": 1, + "hello_world": 2, + "by": 9, + "simp": 8, + "thm": 1, + "defining": 1, + "string": 1, + "constant": 1, + "definition": 1, + "where": 1, + "theorem": 2, + "(": 5, + "fact": 1, + "List.rev_rev_ident": 4, + ")": 5, + "*now": 1, + "we": 1, + "delete": 1, + "already": 1, + "proven": 1, + "lema": 1, + "and": 1, + "show": 2, + "it": 2, + "hand*": 1, + "declare": 1, + "[": 1, + "del": 1, + "]": 1, + "hide_fact": 1, + "corollary": 2, + "apply": 1, + "add": 1, + "HelloWorld_def": 1, + "done": 1, + "*does": 1, + "hold": 1, + "in": 1, + "general": 1, + "rev_rev_ident": 2, + "proof": 1, + "induction": 1, + "l": 2, + "case": 3, + "Nil": 1, + "thus": 1, + "next": 1, + "Cons": 1, + "ls": 1, + "assume": 1, + "IH": 2, + "have": 2, + "hence": 1, + "also": 1, + "finally": 1, + "using": 1, + "qed": 1, + "fastforce": 1, + "intro": 1, + "end": 1 + }, "Jade": { "p.": 1, "Hello": 1, @@ -20024,15 +28483,15 @@ ".internalBuildGeneratedFileFrom": 1 }, "JavaScript": { - "function": 1210, - "(": 8513, - ")": 8521, - "{": 2736, - ";": 4052, + "function": 1212, + "(": 8518, + ")": 8526, + "{": 2738, + ";": 4056, "//": 410, "jshint": 1, "_": 9, - "var": 910, + "var": 911, "Modal": 2, "content": 5, "options": 56, @@ -20042,15 +28501,15 @@ ".delegate": 2, ".proxy": 1, "this.hide": 1, - "this": 577, - "}": 2712, + "this": 578, + "}": 2714, "Modal.prototype": 1, "constructor": 8, "toggle": 10, - "return": 944, - "[": 1459, + "return": 945, + "[": 1461, "this.isShown": 3, - "]": 1456, + "]": 1458, "show": 10, "that": 33, "e": 663, @@ -20078,7 +28537,7 @@ "hide": 8, "body": 22, "modal": 4, - "-": 705, + "-": 706, "open": 2, "fade": 4, "hidden": 12, @@ -20738,6 +29197,12 @@ "_results.push": 2, "math.cube": 2, ".slice": 6, + "window": 18, + "angular": 1, + "Array.prototype.last": 1, + "this.length": 41, + "app": 3, + "angular.module": 1, "A": 24, "w": 110, "ma": 3, @@ -20876,7 +29341,6 @@ "c.prototype": 1, "init": 7, "this.context": 17, - "this.length": 40, "s.body": 2, "this.selector": 16, "Ta.exec": 1, @@ -21437,7 +29901,6 @@ "scrollTo": 1, "CSS1Compat": 1, "client": 3, - "window": 16, "document": 26, "window.document": 2, "navigator": 3, @@ -23091,7 +31554,6 @@ "week": 1, "bK": 1, "about": 1, - "app": 2, "storage": 1, "extension": 1, "widget": 1, @@ -24270,6 +32732,7 @@ "js": 1, "classes.join": 1, "this.document": 1, + "window.angular": 1, "PEG.parser": 1, "quote": 3, "result0": 264, @@ -26087,6 +34550,57 @@ "type": 1, "url": 1 }, + "JSONiq": { + "(": 14, + "Query": 2, + "for": 4, + "returning": 1, + "one": 1, + "database": 2, + "entry": 1, + ")": 14, + "import": 5, + "module": 5, + "namespace": 5, + "req": 6, + ";": 9, + "catalog": 4, + "variable": 4, + "id": 3, + "param": 4, + "-": 11, + "values": 4, + "[": 5, + "]": 5, + "part": 2, + "get": 2, + "data": 4, + "by": 2, + "key": 1, + "searching": 1, + "the": 1, + "keywords": 1, + "index": 3, + "phrase": 2, + "limit": 2, + "integer": 1, + "result": 1, + "at": 1, + "idx": 2, + "in": 1, + "search": 1, + "where": 1, + "le": 1, + "let": 1, + "result.s": 1, + "result.p": 1, + "return": 1, + "{": 2, + "|": 2, + "score": 1, + "result.r": 1, + "}": 2 + }, "JSONLD": { "{": 7, "}": 7, @@ -26193,6 +34707,14 @@ "end": 3, "return": 1 }, + "Kit": { + "
": 1, + "

": 1, + "

": 1, + "

": 1, + "

": 1, + "
": 1 + }, "Kotlin": { "package": 1, "addressbook": 1, @@ -27143,6 +35665,257 @@ "separate": 2, "COUNT": 2 }, + "Latte": { + "{": 54, + "**": 1, + "*": 4, + "@param": 3, + "string": 2, + "basePath": 1, + "web": 1, + "base": 1, + "path": 1, + "robots": 2, + "tell": 1, + "how": 1, + "to": 2, + "index": 1, + "the": 1, + "content": 1, + "of": 3, + "a": 4, + "page": 1, + "(": 18, + "optional": 1, + ")": 18, + "array": 1, + "flashes": 1, + "flash": 3, + "messages": 1, + "}": 54, + "": 1, + "html": 1, + "": 1, + "": 1, + "": 6, + "charset=": 1, + "name=": 4, + "content=": 5, + "n": 8, + "ifset=": 1, + "http": 1, + "equiv=": 1, + "": 1, + "ifset": 1, + "title": 4, + "/ifset": 1, + "Translation": 1, + "report": 1, + "": 1, + "": 2, + "rel=": 2, + "media=": 1, + "href=": 4, + "": 3, + "block": 3, + "#head": 1, + "/block": 3, + "": 1, + "": 1, + "class=": 12, + "document.documentElement.className": 1, + "+": 3, + "#navbar": 1, + "include": 3, + "_navbar.latte": 1, + "
": 6, + "inner": 1, + "foreach=": 3, + "_flash.latte": 1, + "
": 7, + "#content": 1, + "
": 1, + "
": 1, + "src=": 1, + "#scripts": 1, + "": 1, + "": 1, + "var": 3, + "define": 1, + "author": 7, + "": 2, + "Author": 2, + "authorId": 2, + "-": 71, + "id": 3, + "black": 2, + "avatar": 2, + "img": 2, + "rounded": 2, + "class": 2, + "tooltip": 4, + "Total": 1, + "time": 4, + "shortName": 1, + "translated": 4, + "on": 5, + "all": 1, + "videos.": 1, + "amaraCallbackLink": 1, + "row": 2, + "col": 3, + "md": 2, + "outOf": 5, + "done": 7, + "threshold": 4, + "alert": 2, + "warning": 2, + "<=>": 2, + "Seems": 1, + "complete": 1, + "|": 6, + "out": 1, + "

": 2, + "elseif": 2, + "<": 1, + "p": 1, + "if": 7, + "Although": 1, + "is": 1, + "there": 1, + "are": 1, + "no": 1, + "English": 1, + "subtitles": 1, + "for": 1, + "comparison.": 1, + "/if": 8, + "/cache": 1, + "editor": 1, + "ksid": 2, + "new": 5, + "video": 2, + "siteId": 1, + "Video": 1, + "khanovaskola.cz": 1, + "revision": 18, + "rev": 4, + "this": 3, + "older": 1, + "#": 2, + "else": 2, + "newer": 1, + "
": 1, + "

": 1, + "diffs": 3, + "noescape": 2, + "

": 1, + "description": 1, + "text": 4, + "as": 2, + "line": 3, + "context": 1, + "splitter": 1, + "template": 1, + "bottom": 1, + "Expand": 1, + "fa": 16, + "sort": 1, + "ellipsis": 1, + "h": 1, + "success": 1, + "amaraEdit": 1, + "amaraId": 2, + "editButton": 1, + "btn": 17, + "default": 6, + "edit": 1, + "khanAcademy": 1, + "kaButton": 1, + "link": 1, + "info": 1, + "group": 4, + "approve": 1, + "thumbs": 3, + "up": 1, + "markIncomplete": 2, + "down": 2, + "redirectToAdd": 1, + "plus": 1, + "square": 1, + "table": 2, + "condensed": 1, + "revisions": 1, + "revId": 1, + "secondary": 2, + "Percent": 1, + "lines": 1, + "&": 1, + "thinsp": 1, + "%": 1, + "": 3, + "": 3, + "": 2, + "incomplete": 3, + "approved": 2, + "": 1, + "user": 1, + "loggedIn": 1, + "&&": 1, + "comments": 2, + "count": 1, + "": 2, + "": 2, + "colspan=": 1, + "": 1, + "comment": 4, + "left": 1, + "createdAt": 1, + "timeAgo": 1, + "noborder": 1, + "input": 3, + "form": 1, + "control": 1, + "Comment": 1, + "only": 1, + "visible": 1, + "other": 1, + "editors": 1, + "save": 1, + "share": 1, + "": 1, + "": 1, + "/form": 1, + "/foreach": 1, + "
": 1 + }, "Less": { "@blue": 4, "#3bbfce": 1, @@ -27497,6 +36270,173 @@ "info": 1, "reproduce": 1 }, + "Liquid": { + "": 1, + "html": 1, + "PUBLIC": 1, + "W3C": 1, + "DTD": 2, + "XHTML": 1, + "1": 1, + "0": 1, + "Transitional": 1, + "EN": 1, + "http": 2, + "www": 1, + "w3": 1, + "org": 1, + "TR": 1, + "xhtml1": 2, + "transitional": 1, + "dtd": 1, + "": 1, + "xmlns=": 1, + "xml": 1, + "lang=": 2, + "": 1, + "": 1, + "equiv=": 1, + "content=": 1, + "": 1, + "{": 89, + "shop.name": 2, + "}": 89, + "-": 4, + "page_title": 1, + "": 1, + "|": 31, + "global_asset_url": 5, + "stylesheet_tag": 3, + "script_tag": 5, + "shopify_asset_url": 1, + "asset_url": 2, + "content_for_header": 1, + "": 1, + "": 1, + "id=": 28, + "

": 1, + "class=": 14, + "": 9, + "href=": 9, + "Skip": 1, + "to": 1, + "navigation.": 1, + "": 9, + "

": 1, + "%": 46, + "if": 5, + "cart.item_count": 7, + "
": 23, + "style=": 5, + "

": 3, + "There": 1, + "pluralize": 3, + "in": 8, + "title=": 3, + "your": 1, + "cart": 1, + "

": 3, + "

": 1, + "Your": 1, + "subtotal": 1, + "is": 1, + "cart.total_price": 2, + "money": 5, + ".": 3, + "

": 1, + "for": 6, + "item": 1, + "cart.items": 1, + "onMouseover=": 2, + "onMouseout=": 2, + "": 4, + "src=": 5, + "
": 23, + "endfor": 6, + "
": 2, + "endif": 5, + "

": 1, + "

": 1, + "onclick=": 1, + "View": 1, + "Mini": 1, + "Cart": 1, + "(": 1, + ")": 1, + "
": 3, + "content_for_layout": 1, + "
    ": 5, + "link": 2, + "linklists.main": 1, + "menu.links": 1, + "
  • ": 5, + "link.title": 2, + "link_to": 2, + "link.url": 2, + "
  • ": 5, + "
": 5, + "tags": 1, + "tag": 4, + "collection.tags": 1, + "": 1, + "link_to_add_tag": 1, + "": 1, + "highlight_active_tag": 1, + "link_to_tag": 1, + "linklists.footer.links": 1, + "All": 1, + "prices": 1, + "are": 1, + "shop.currency": 1, + "Powered": 1, + "by": 1, + "Shopify": 1, + "": 1, + "": 1, + "

": 1, + "We": 1, + "have": 1, + "wonderful": 1, + "products": 1, + "

": 1, + "image": 1, + "product.images": 1, + "forloop.first": 1, + "rel=": 2, + "alt=": 2, + "else": 1, + "product.title": 1, + "Vendor": 1, + "product.vendor": 1, + "link_to_vendor": 1, + "Type": 1, + "product.type": 1, + "link_to_type": 1, + "": 1, + "product.price_min": 1, + "product.price_varies": 1, + "product.price_max": 1, + "": 1, + "
": 1, + "action=": 1, + "method=": 1, + "": 1, + "": 1, + "type=": 2, + "
": 1, + "product.description": 1, + "": 1 + }, "Literate Agda": { "documentclass": 1, "{": 35, @@ -28031,27 +36971,27 @@ "in_8_list": 1 }, "M": { - "%": 203, + "%": 207, "zewdAPI": 52, - ";": 1275, + ";": 1309, "Enterprise": 5, "Web": 5, "Developer": 5, "run": 2, - "-": 1604, + "-": 1605, "time": 9, "functions": 4, - "and": 56, + "and": 59, "user": 27, "APIs": 1, "Product": 2, - "(": 2142, + "(": 2144, "Build": 6, - ")": 2150, + ")": 2152, "Date": 2, "Fri": 1, "Nov": 1, - "|": 170, + "|": 171, "for": 77, "GT.M": 30, "m_apache": 3, @@ -28072,52 +37012,52 @@ "rtweed@mgateway.com": 4, "This": 26, "program": 19, - "is": 81, + "is": 88, "free": 15, "software": 12, - "you": 16, - "can": 15, + "you": 17, + "can": 20, "redistribute": 11, - "it": 44, + "it": 45, "and/or": 11, "modify": 11, "under": 14, - "the": 217, + "the": 223, "terms": 11, - "of": 80, + "of": 84, "GNU": 33, "Affero": 33, "General": 33, "Public": 33, "License": 48, - "as": 22, + "as": 23, "published": 11, - "by": 33, + "by": 35, "Free": 11, "Software": 11, "Foundation": 11, "either": 13, "version": 16, - "or": 46, + "or": 50, "at": 21, "your": 16, "option": 12, - "any": 15, + "any": 16, "later": 11, "version.": 11, "distributed": 13, - "in": 78, + "in": 80, "hope": 11, - "that": 17, + "that": 19, "will": 23, - "be": 32, + "be": 35, "useful": 11, - "but": 17, + "but": 19, "WITHOUT": 12, "ANY": 12, "WARRANTY": 11, "without": 11, - "even": 11, + "even": 12, "implied": 11, "warranty": 11, "MERCHANTABILITY": 11, @@ -28131,21 +37071,21 @@ "details.": 12, "You": 13, "should": 16, - "have": 17, + "have": 21, "received": 11, - "a": 112, + "a": 130, "copy": 13, "along": 11, - "with": 43, - "this": 38, + "with": 45, + "this": 39, "program.": 9, "If": 14, - "not": 37, - "see": 25, + "not": 39, + "see": 26, "": 11, - ".": 814, - "QUIT": 249, - "_": 126, + ".": 815, + "QUIT": 251, + "_": 127, "getVersion": 1, "zewdCompiler": 6, "date": 1, @@ -28219,7 +37159,7 @@ "text": 6, "replaceAll": 11, "writeLine": 2, - "line": 9, + "line": 14, "CacheTempBuffer": 2, "j": 67, "increment": 11, @@ -28237,7 +37177,7 @@ "value": 72, "getSessionValue": 3, "tr": 13, - "+": 188, + "+": 189, "f": 93, "o": 51, "q": 244, @@ -28253,7 +37193,7 @@ "type": 2, "avoid": 1, "Cache": 3, - "bug": 1, + "bug": 2, "getPhraseIndex": 1, "zewdCompiler5": 1, "licensed": 1, @@ -28268,7 +37208,7 @@ "wldSessid": 1, "zzname": 1, "zv": 6, - "[": 53, + "[": 54, "extcErr": 1, "mess": 3, "namespace": 1, @@ -28376,7 +37316,7 @@ "char": 9, "len": 8, "create": 6, - "characters": 4, + "characters": 8, "str": 15, "convertDateToSeconds": 1, "hdate": 7, @@ -28421,12 +37361,12 @@ "format": 2, "Offset": 1, "relative": 1, - "to": 73, + "to": 74, "GMT": 1, "eg": 3, "hh": 4, "ss": 4, - "<": 19, + "<": 20, "_hh": 1, "time#3600": 1, "_mm": 1, @@ -28437,7 +37377,7 @@ "openNewFile": 2, "openFile": 2, "openDOM": 2, - "&": 27, + "&": 28, "#39": 1, "<\",\"<\")>": 1, "string=": 1, @@ -28446,7 +37386,7 @@ "HTML": 1, "quot": 2, "stop": 20, - "no": 53, + "no": 54, "no2": 1, "p1_c_p2": 1, "getIP": 2, @@ -28475,7 +37415,7 @@ "linkToParentSession": 2, "zewdCompiler20": 1, "exportToGTM": 1, - "routine": 4, + "routine": 6, "zewdDemo": 1, "Tutorial": 1, "Wed": 1, @@ -28524,10 +37464,10 @@ ".value": 1, "testField2": 1, "field3": 1, - "must": 7, + "must": 8, "null": 6, "dateTime": 1, - "start": 24, + "start": 26, "student": 14, "zwrite": 1, "write": 59, @@ -28553,12 +37493,91 @@ "todrop": 2, "Populate": 1, "values": 4, - "on": 15, + "on": 17, "first": 10, "use": 5, "only.": 1, "zextract": 3, "zlength": 3, + "Comment": 1, + "comment": 4, + "block": 1, + "comments": 5, + "always": 2, + "semicolon": 1, + "next": 1, + "while": 4, + "legal": 1, + "blank": 1, + "whitespace": 2, + "alone": 1, + "valid": 2, + "**": 4, + "Comments": 1, + "graphic": 3, + "character": 5, + "such": 1, + "@#": 1, + "*": 6, + "{": 5, + "}": 5, + "]": 15, + "/": 3, + "space": 1, + "considered": 1, + "though": 1, + "t": 12, + "it.": 2, + "ASCII": 2, + "whose": 1, + "numeric": 8, + "code": 29, + "above": 3, + "below": 1, + "are": 14, + "NOT": 2, + "allowed": 18, + "routine.": 1, + "multiple": 1, + "semicolons": 1, + "okay": 1, + "has": 7, + "tag": 2, + "after": 3, + "does": 1, + "command": 11, + "Tag1": 1, + "Tags": 2, + "an": 14, + "uppercase": 2, + "lowercase": 1, + "alphabetic": 2, + "series": 2, + "HELO": 1, + "most": 1, + "common": 1, + "label": 5, + "LABEL": 1, + "followed": 1, + "directly": 1, + "open": 1, + "parenthesis": 2, + "formal": 1, + "list": 1, + "variables": 3, + "close": 1, + "ANOTHER": 1, + "X": 19, + "Normally": 1, + "subroutine": 1, + "would": 2, + "ended": 1, + "we": 1, + "taking": 1, + "advantage": 1, + "rule": 1, + "END": 1, + "implicit": 1, "Digest": 2, "Extension": 9, "Piotr": 7, @@ -28589,7 +37608,6 @@ "digest.init": 3, "usually": 1, "when": 11, - "an": 11, "invalid": 4, "algorithm": 1, "was": 5, @@ -28604,9 +37622,7 @@ "contact": 2, "me": 2, "questions": 2, - "comments": 4, "returns": 7, - "ASCII": 1, "HEX": 1, "all": 8, "one": 5, @@ -28658,7 +37674,6 @@ "illustrate": 1, "dynamic": 1, "scope": 1, - "variables": 2, "triangle1": 1, "sum": 15, "main2": 1, @@ -28666,12 +37681,10 @@ "triangle2": 1, "compute": 2, "Fibonacci": 1, - "series": 1, "b": 64, "term": 10, "start1": 2, "entry": 5, - "label": 4, "start2": 1, "function": 6, "computes": 1, @@ -28783,7 +37796,6 @@ "modulo": 1, "division.": 1, "//en.wikipedia.org/wiki/MD5": 1, - "t": 11, "#64": 1, "msg_": 1, "_m_": 1, @@ -28825,9 +37837,7 @@ "keyId": 108, "been": 4, "tested": 1, - "valid": 1, "these": 1, - "are": 11, "called": 8, "To": 2, "Initialise": 2, @@ -28889,7 +37899,6 @@ "getAttributeId": 2, "domain": 1, "Not": 1, - "allowed": 17, "same": 2, "remove": 6, "existing": 2, @@ -28980,7 +37989,6 @@ "runSelect": 3, "count": 18, "select": 3, - "*": 5, "where": 6, "limit": 14, "asc": 1, @@ -29028,7 +38036,6 @@ ".itemStack": 1, "***": 2, "listCopy": 3, - "numeric": 6, "N.N": 12, "N.N1": 4, "externalSelect": 2, @@ -29239,7 +38246,6 @@ "protect": 11, "erropt": 6, "isstring": 5, - "code": 28, "pcre.config": 1, ".name": 1, ".erropt": 3, @@ -29263,7 +38269,6 @@ "LANG": 4, "LC_*": 1, "output": 49, - "command": 9, "Debian": 2, "tip": 1, "dpkg": 1, @@ -29337,7 +38342,6 @@ "begin_": 1, "_end": 1, "store": 6, - "above": 2, "stores": 1, "captured": 6, "key=": 2, @@ -29413,8 +38417,6 @@ "matched": 1, "back": 4, "th": 3, - "{": 4, - "}": 4, "replaced": 1, "substitution": 2, "begins": 1, @@ -29447,7 +38449,6 @@ "@ref": 2, "E": 12, "COMPILE": 2, - "has": 6, "meaning": 1, "zs": 2, "re": 2, @@ -29527,7 +38528,6 @@ "Run": 1, ".offset": 1, "used.": 2, - "always": 1, "strings": 1, "submitted": 1, "exact": 1, @@ -29536,8 +38536,6 @@ "way": 1, "i*2": 3, "what": 2, - "while": 3, - "/": 2, "/mg": 2, "aaa": 1, "nbb": 1, @@ -29560,7 +38558,6 @@ "listing": 1, "CHAR": 1, "different": 3, - "character": 2, "modes": 1, "In": 1, "probably": 1, @@ -29636,7 +38633,6 @@ "runs": 2, "especially": 1, "there": 2, - "would": 1, "paths": 2, "tree": 1, "checked.": 1, @@ -29741,7 +38737,6 @@ "false": 5, "post2": 1, "special": 2, - "after": 2, "post": 1, "condition": 1, "PRCAAPR": 1, @@ -29758,7 +38753,6 @@ "Accounts": 1, "Receivable": 1, "**198": 1, - "**": 2, "Mar": 1, "Per": 1, "VHA": 1, @@ -29768,7 +38762,6 @@ "PRCATY": 2, "NEW": 3, "DIC": 6, - "X": 18, "Y": 26, "DEBT": 10, "PRCADB": 5, @@ -29811,7 +38804,6 @@ "_PRCATY_": 1, "COMP1": 2, "RCY": 5, - "]": 14, "COMP2": 2, "_STAT_": 1, "_STAT": 1, @@ -30045,7 +39037,6 @@ "WVBEGDT1": 1, "NOTIFICATION": 1, "IS": 3, - "NOT": 1, "QUEUED.": 1, "WVB": 4, "OR": 2, @@ -30159,7 +39150,6 @@ "TODO": 1, "Caller": 1, "indentation": 1, - "comment": 1, "tab": 1, "space.": 1, "M/Wire": 4, @@ -30205,7 +39195,6 @@ "simply": 1, "Stop": 1, "RESJOB": 1, - "it.": 1, "mwireVersion": 4, "mwireDate": 2, "July": 1, @@ -30365,6 +39354,133 @@ "Markdown": { "Tender": 1 }, + "Mask": { + "header": 1, + "{": 10, + "img": 1, + ".logo": 1, + "src": 1, + "alt": 1, + "logo": 1, + ";": 3, + "h4": 1, + "if": 1, + "(": 3, + "currentUser": 1, + ")": 3, + ".account": 1, + "a": 1, + "href": 1, + "}": 10, + ".view": 1, + "ul": 1, + "for": 1, + "user": 1, + "index": 1, + "of": 1, + "users": 1, + "li.user": 1, + "data": 1, + "-": 3, + "id": 1, + ".name": 1, + ".count": 1, + ".date": 1, + "countdownComponent": 1, + "input": 1, + "type": 1, + "text": 1, + "dualbind": 1, + "value": 1, + "button": 1, + "x": 2, + "signal": 1, + "h5": 1, + "animation": 1, + "slot": 1, + "@model": 1, + "@next": 1, + "footer": 1, + "bazCompo": 1 + }, + "Mathematica": { + "Get": 1, + "[": 74, + "]": 73, + "Paclet": 1, + "Name": 1, + "-": 8, + "Version": 1, + "MathematicaVersion": 1, + "Description": 1, + "Creator": 1, + "Extensions": 1, + "{": 2, + "Language": 1, + "MainPage": 1, + "}": 2, + "BeginPackage": 1, + ";": 41, + "PossiblyTrueQ": 3, + "usage": 22, + "PossiblyFalseQ": 2, + "PossiblyNonzeroQ": 3, + "Begin": 2, + "expr_": 4, + "Not": 6, + "TrueQ": 4, + "expr": 4, + "End": 2, + "AnyQ": 3, + "AnyElementQ": 4, + "AllQ": 2, + "AllElementQ": 2, + "AnyNonzeroQ": 2, + "AnyPossiblyNonzeroQ": 2, + "RealQ": 3, + "PositiveQ": 3, + "NonnegativeQ": 3, + "PositiveIntegerQ": 3, + "NonnegativeIntegerQ": 4, + "IntegerListQ": 5, + "PositiveIntegerListQ": 3, + "NonnegativeIntegerListQ": 3, + "IntegerOrListQ": 2, + "PositiveIntegerOrListQ": 2, + "NonnegativeIntegerOrListQ": 2, + "SymbolQ": 2, + "SymbolOrNumberQ": 2, + "cond_": 4, + "L_": 5, + "Fold": 3, + "Or": 1, + "False": 4, + "cond": 4, + "/@": 3, + "L": 4, + "Flatten": 1, + "And": 4, + "True": 2, + "SHEBANG#!#!=": 1, + "n_": 5, + "Im": 1, + "n": 8, + "Positive": 2, + "IntegerQ": 3, + "&&": 4, + "input_": 6, + "ListQ": 1, + "input": 11, + "MemberQ": 3, + "IntegerQ/@input": 1, + "||": 4, + "a_": 2, + "Head": 2, + "a": 3, + "Symbol": 2, + "NumericQ": 1, + "EndPackage": 1 + }, "Matlab": { "function": 34, "[": 311, @@ -31740,6 +40856,2888 @@ "//wiki.eclipse.org/index.php/Linux_Tools_Project/GDB_Tracepoint_Analysis/User_Guide": 1, "//wiki.eclipse.org/Linux_Tools_Project/GDB_Tracepoint_Analysis/User_Guide": 1 }, + "Mercury": { + "%": 416, + "-": 6967, + "module": 46, + "ll_backend.code_info.": 1, + "interface.": 13, + "import_module": 126, + "check_hlds.type_util.": 2, + "hlds.code_model.": 1, + "hlds.hlds_data.": 2, + "hlds.hlds_goal.": 2, + "hlds.hlds_llds.": 1, + "hlds.hlds_module.": 2, + "hlds.hlds_pred.": 2, + "hlds.instmap.": 2, + "libs.globals.": 2, + "ll_backend.continuation_info.": 1, + "ll_backend.global_data.": 1, + "ll_backend.layout.": 1, + "ll_backend.llds.": 1, + "ll_backend.trace_gen.": 1, + "mdbcomp.prim_data.": 3, + "mdbcomp.goal_path.": 2, + "parse_tree.prog_data.": 2, + "parse_tree.set_of_var.": 2, + "assoc_list.": 3, + "bool.": 4, + "counter.": 1, + "io.": 8, + "list.": 4, + "map.": 3, + "maybe.": 3, + "set.": 4, + "set_tree234.": 1, + "term.": 3, + "implementation.": 12, + "backend_libs.builtin_ops.": 1, + "backend_libs.proc_label.": 1, + "hlds.arg_info.": 1, + "hlds.hlds_desc.": 1, + "hlds.hlds_rtti.": 2, + "libs.options.": 3, + "libs.trace_params.": 1, + "ll_backend.code_util.": 1, + "ll_backend.opt_debug.": 1, + "ll_backend.var_locn.": 1, + "parse_tree.builtin_lib_types.": 2, + "parse_tree.prog_type.": 2, + "parse_tree.mercury_to_mercury.": 1, + "cord.": 1, + "int.": 4, + "pair.": 3, + "require.": 6, + "stack.": 1, + "string.": 7, + "varset.": 2, + "type": 57, + "code_info.": 1, + "pred": 255, + "code_info_init": 2, + "(": 3351, + "bool": 406, + "in": 510, + "globals": 5, + "pred_id": 15, + "proc_id": 12, + "pred_info": 20, + "proc_info": 11, + "abs_follow_vars": 3, + "module_info": 26, + "static_cell_info": 4, + "const_struct_map": 3, + "resume_point_info": 11, + "out": 337, + "trace_slot_info": 3, + "maybe": 20, + "containing_goal_map": 4, + ")": 3351, + "list": 82, + "string": 115, + "int": 129, + "code_info": 208, + "is": 246, + "det.": 184, + "get_globals": 5, + "get_exprn_opts": 2, + "exprn_opts": 3, + "get_module_info": 7, + "get_pred_id": 6, + "get_proc_id": 5, + "get_pred_info": 2, + "get_proc_info": 4, + "get_varset": 3, + "prog_varset": 14, + "func": 24, + "get_var_types": 3, + "vartypes.": 1, + "get_maybe_trace_info": 2, + "trace_info": 3, + "get_emit_trail_ops": 2, + "add_trail_ops": 5, + "get_emit_region_ops": 2, + "add_region_ops": 6, + "get_forward_live_vars": 2, + "set_of_progvar": 10, + "set_forward_live_vars": 2, + "get_instmap": 4, + "instmap": 3, + "set_instmap": 3, + "get_par_conj_depth": 2, + "set_par_conj_depth": 2, + "get_label_counter": 3, + "counter": 6, + "get_succip_used": 2, + "get_layout_info": 4, + "proc_label_layout_info": 3, + "get_proc_trace_events": 2, + "set_proc_trace_events": 2, + "get_closure_layouts": 3, + "closure_proc_id_data": 4, + "get_max_reg_in_use_at_trace": 2, + "set_max_reg_in_use_at_trace": 2, + "get_created_temp_frame": 2, + "get_static_cell_info": 5, + "set_static_cell_info": 5, + "get_alloc_sites": 3, + "set_tree234": 3, + "alloc_site_info": 4, + "set_alloc_sites": 3, + "get_used_env_vars": 2, + "set": 16, + "set_used_env_vars": 2, + "get_opt_trail_ops": 2, + "get_opt_region_ops": 2, + "get_auto_comments": 2, + "get_lcmc_null": 2, + "get_containing_goal_map": 3, + "get_containing_goal_map_det": 2, + "get_const_struct_map": 2, + "add_out_of_line_code": 2, + "llds_code": 21, + "get_out_of_line_code": 2, + "get_var_slot_count": 2, + "set_maybe_trace_info": 3, + "get_opt_no_return_calls": 2, + "get_zombies": 2, + "set_zombies": 2, + "get_var_locn_info": 7, + "var_locn_info": 3, + "set_var_locn_info": 4, + "get_temps_in_use": 6, + "lval": 114, + "set_temps_in_use": 4, + "get_fail_info": 13, + "fail_info": 24, + "set_fail_info": 9, + "set_label_counter": 3, + "set_succip_used": 3, + "set_layout_info": 4, + "get_max_temp_slot_count": 2, + "set_max_temp_slot_count": 2, + "get_temp_content_map": 3, + "map": 7, + "slot_contents": 4, + "set_temp_content_map": 2, + "get_persistent_temps": 3, + "set_persistent_temps": 2, + "set_closure_layouts": 3, + "get_closure_seq_counter": 3, + "set_closure_seq_counter": 3, + "set_created_temp_frame": 2, + "code_info_static": 26, + "code_info_loc_dep": 22, + "code_info_persistent": 44, + ".": 610, + "cis_globals": 2, + "cis_exprn_opts": 2, + "cis_module_info": 2, + "cis_pred_id": 2, + "cis_proc_id": 2, + "cis_pred_info": 2, + "cis_proc_info": 2, + "cis_proc_label": 1, + "proc_label": 2, + "cis_varset": 2, + "cis_var_slot_count": 2, + "cis_maybe_trace_info": 3, + "cis_opt_no_resume_calls": 2, + "cis_emit_trail_ops": 2, + "cis_opt_trail_ops": 2, + "cis_emit_region_ops": 2, + "cis_opt_region_ops": 2, + "cis_auto_comments": 2, + "cis_lcmc_null": 2, + "cis_containing_goal_map": 2, + "cis_const_struct_map": 2, + "cild_forward_live_vars": 3, + "cild_instmap": 3, + "cild_zombies": 3, + "cild_var_locn_info": 3, + "cild_temps_in_use": 3, + "cild_fail_info": 3, + "cild_par_conj_depth": 3, + "cip_label_num_src": 3, + "cip_store_succip": 3, + "cip_label_info": 3, + "cip_proc_trace_events": 3, + "cip_stackslot_max": 3, + "cip_temp_contents": 3, + "cip_persistent_temps": 3, + "cip_closure_layout_seq": 3, + "cip_closure_layouts": 3, + "cip_max_reg_r_used": 3, + "cip_max_reg_f_used": 2, + "cip_created_temp_frame": 3, + "cip_static_cell_info": 3, + "cip_alloc_sites": 3, + "cip_used_env_vars": 3, + "cip_ts_string_table_size": 3, + "cip_ts_rev_string_table": 4, + "cip_out_of_line_code": 4, + "SaveSuccip": 2, + "Globals": 32, + "PredId": 50, + "ProcId": 31, + "PredInfo": 64, + "ProcInfo": 43, + "FollowVars": 6, + "ModuleInfo": 49, + "StaticCellInfo": 8, + "ConstStructMap": 2, + "ResumePoint": 13, + "TraceSlotInfo": 5, + "MaybeContainingGoalMap": 5, + "TSRevStringTable": 2, + "TSStringTableSize": 2, + "CodeInfo": 2, + "ProcLabel": 8, + "make_proc_label": 1, + "proc_info_get_initial_instmap": 1, + "InstMap": 6, + "proc_info_get_liveness_info": 1, + "Liveness": 4, + "CodeModel": 8, + "proc_info_interface_code_model": 2, + "build_input_arg_list": 1, + "ArgList": 2, + "proc_info_get_varset": 1, + "VarSet": 15, + "proc_info_get_vartypes": 2, + "VarTypes": 22, + "proc_info_get_stack_slots": 1, + "StackSlots": 5, + "ExprnOpts": 4, + "init_exprn_opts": 3, + "globals.lookup_bool_option": 18, + "use_float_registers": 5, + "UseFloatRegs": 6, + "yes": 144, + "FloatRegType": 3, + "reg_f": 1, + ";": 913, + "no": 365, + "reg_r": 2, + "globals.get_trace_level": 1, + "TraceLevel": 5, + "eff_trace_level_is_none": 2, + "trace_fail_vars": 1, + "FailVars": 3, + "MaybeFailVars": 3, + "set_of_var.union": 3, + "EffLiveness": 3, + "init_var_locn_state": 1, + "VarLocnInfo": 12, + "stack.init": 1, + "ResumePoints": 14, + "allow_hijacks": 3, + "AllowHijack": 3, + "Hijack": 6, + "allowed": 6, + "not_allowed": 5, + "DummyFailInfo": 2, + "resume_point_unknown": 9, + "may_be_different": 7, + "not_inside_non_condition": 2, + "map.init": 7, + "TempContentMap": 4, + "set.init": 7, + "PersistentTemps": 4, + "TempsInUse": 8, + "Zombies": 2, + "set_of_var.init": 1, + "LayoutMap": 2, + "max_var_slot": 1, + "VarSlotMax": 2, + "trace_reserved_slots": 1, + "FixedSlots": 2, + "_": 149, + "int.max": 1, + "SlotMax": 2, + "opt_no_return_calls": 3, + "OptNoReturnCalls": 2, + "use_trail": 3, + "UseTrail": 2, + "disable_trail_ops": 3, + "DisableTrailOps": 2, + "EmitTrailOps": 3, + "do_not_add_trail_ops": 1, + "optimize_trail_usage": 3, + "OptTrailOps": 2, + "optimize_region_ops": 3, + "OptRegionOps": 2, + "region_analysis": 3, + "UseRegions": 3, + "EmitRegionOps": 3, + "do_not_add_region_ops": 1, + "auto_comments": 4, + "AutoComments": 2, + "optimize_constructor_last_call_null": 3, + "LCMCNull": 2, + "CodeInfo0": 2, + "init_fail_info": 2, + "will": 1, + "override": 1, + "this": 4, + "dummy": 2, + "value": 16, + "nested": 1, + "parallel": 3, + "conjunction": 1, + "depth": 1, + "counter.init": 2, + "[": 203, + "]": 203, + "set_tree234.init": 1, + "cord.empty": 1, + "init_maybe_trace_info": 3, + "CodeInfo1": 2, + "exprn_opts.": 1, + "gcc_non_local_gotos": 3, + "OptNLG": 3, + "NLG": 3, + "have_non_local_gotos": 1, + "do_not_have_non_local_gotos": 1, + "asm_labels": 3, + "OptASM": 3, + "ASM": 3, + "have_asm_labels": 1, + "do_not_have_asm_labels": 1, + "static_ground_cells": 3, + "OptSGCell": 3, + "SGCell": 3, + "have_static_ground_cells": 1, + "do_not_have_static_ground_cells": 1, + "unboxed_float": 3, + "OptUBF": 3, + "UBF": 3, + "have_unboxed_floats": 1, + "do_not_have_unboxed_floats": 1, + "OptFloatRegs": 3, + "do_not_use_float_registers": 1, + "static_ground_floats": 3, + "OptSGFloat": 3, + "SGFloat": 3, + "have_static_ground_floats": 1, + "do_not_have_static_ground_floats": 1, + "static_code_addresses": 3, + "OptStaticCodeAddr": 3, + "StaticCodeAddrs": 3, + "have_static_code_addresses": 1, + "do_not_have_static_code_addresses": 1, + "trace_level": 4, + "CI": 294, + "proc_info_get_has_tail_call_events": 1, + "HasTailCallEvents": 3, + "tail_call_events": 1, + "get_next_label": 5, + "TailRecLabel": 2, + "MaybeTailRecLabel": 3, + "no_tail_call_events": 1, + "trace_setup": 1, + "TraceInfo": 2, + "MaxRegR": 4, + "MaxRegF": 4, + "cip_max_reg_f_used.": 1, + "TI": 4, + "LV": 2, + "IM": 2, + "Zs": 2, + "EI": 2, + "FI": 2, + "N": 6, + "LC": 2, + "SU": 2, + "LI": 2, + "PTE": 2, + "TM": 2, + "CM": 2, + "PT": 2, + "CLS": 2, + "CG": 2, + "MR": 4, + "MF": 1, + "MF.": 1, + "SCI": 2, + "ASI": 2, + "UEV": 2, + "ContainingGoalMap": 2, + "unexpected": 21, + "NewCode": 2, + "Code0": 2, + ".CI": 29, + "Code": 36, + "+": 127, + "Code.": 1, + "get_stack_slots": 2, + "stack_slots": 1, + "get_follow_var_map": 2, + "abs_follow_vars_map": 1, + "get_next_non_reserved": 2, + "reg_type": 1, + "set_follow_vars": 4, + "pre_goal_update": 3, + "hlds_goal_info": 22, + "has_subgoals": 2, + "post_goal_update": 3, + "body_typeinfo_liveness": 4, + "variable_type": 3, + "prog_var": 58, + "mer_type.": 1, + "variable_is_of_dummy_type": 2, + "is_dummy_type.": 1, + "search_type_defn": 4, + "mer_type": 21, + "hlds_type_defn": 1, + "semidet.": 10, + "lookup_type_defn": 2, + "hlds_type_defn.": 1, + "lookup_cheaper_tag_test": 2, + "maybe_cheaper_tag_test.": 1, + "filter_region_vars": 2, + "set_of_progvar.": 2, + "get_proc_model": 2, + "code_model.": 1, + "get_headvars": 2, + "get_arginfo": 2, + "arg_info": 2, + "get_pred_proc_arginfo": 3, + "current_resume_point_vars": 2, + "variable_name": 2, + "make_proc_entry_label": 2, + "code_addr.": 1, + "label": 5, + "succip_is_used": 2, + "add_trace_layout_for_label": 2, + "term.context": 3, + "trace_port": 1, + "forward_goal_path": 1, + "user_event_info": 1, + "layout_label_info": 2, + "get_cur_proc_label": 4, + "get_next_closure_seq_no": 2, + "add_closure_layout": 2, + "add_threadscope_string": 2, + "get_threadscope_rev_string_table": 2, + "add_scalar_static_cell": 2, + "typed_rval": 1, + "data_id": 3, + "add_scalar_static_cell_natural_types": 2, + "rval": 3, + "add_vector_static_cell": 2, + "llds_type": 1, + "add_alloc_site_info": 2, + "prog_context": 1, + "alloc_site_id": 2, + "add_resume_layout_for_label": 2, + "var_locn_get_stack_slots": 1, + "FollowVarMap": 2, + "var_locn_get_follow_var_map": 1, + "RegType": 2, + "NextNonReserved": 2, + "var_locn_get_next_non_reserved": 1, + "VarLocnInfo0": 4, + "var_locn_set_follow_vars": 1, + "GoalInfo": 44, + "HasSubGoals": 3, + "goal_info_get_resume_point": 1, + "no_resume_point": 1, + "resume_point": 1, + "goal_info_get_follow_vars": 1, + "MaybeFollowVars": 3, + "goal_info_get_pre_deaths": 1, + "PreDeaths": 3, + "rem_forward_live_vars": 3, + "maybe_make_vars_forward_dead": 2, + "goal_info_get_pre_births": 1, + "PreBirths": 2, + "add_forward_live_vars": 2, + "does_not_have_subgoals": 2, + "goal_info_get_post_deaths": 2, + "PostDeaths": 5, + "goal_info_get_post_births": 1, + "PostBirths": 3, + "make_vars_forward_live": 1, + "InstMapDelta": 2, + "goal_info_get_instmap_delta": 1, + "InstMap0": 2, + "instmap.apply_instmap_delta": 1, + "TypeInfoLiveness": 2, + "module_info_pred_info": 6, + "body_should_use_typeinfo_liveness": 1, + "Var": 13, + "Type": 18, + "lookup_var_type": 3, + "IsDummy": 2, + "VarType": 2, + "check_dummy_type": 1, + "TypeDefn": 6, + "type_to_ctor_det": 1, + "TypeCtor": 2, + "module_info_get_type_table": 1, + "TypeTable": 2, + "search_type_ctor_defn": 1, + "TypeDefnPrime": 2, + "CheaperTagTest": 3, + "get_type_defn_body": 1, + "TypeBody": 2, + "hlds_du_type": 1, + "CheaperTagTestPrime": 2, + "no_cheaper_tag_test": 1, + "ForwardLiveVarsBeforeGoal": 6, + "RegionVars": 2, + "code_info.get_var_types": 1, + "set_of_var.filter": 1, + "is_region_var": 1, + "HeadVars": 20, + "module_info_pred_proc_info": 4, + "proc_info_get_headvars": 2, + "ArgInfo": 4, + "proc_info_arg_info": 1, + "ResumeVars": 4, + "FailInfo": 19, + "ResumePointStack": 2, + "stack.det_top": 5, + "ResumePointInfo": 2, + "pick_first_resume_point": 1, + "ResumeMap": 8, + "map.keys": 3, + "ResumeMapVarList": 2, + "set_of_var.list_to_set": 3, + "Name": 4, + "Varset": 2, + "varset.lookup_name": 2, + "Immed0": 3, + "CodeAddr": 2, + "Immed": 3, + "globals.lookup_int_option": 1, + "procs_per_c_function": 3, + "ProcsPerFunc": 2, + "CurPredId": 2, + "CurProcId": 2, + "proc": 2, + "make_entry_label": 1, + "Label": 8, + "C0": 4, + "counter.allocate": 2, + "C": 34, + "internal_label": 3, + "Context": 20, + "Port": 2, + "IsHidden": 2, + "GoalPath": 2, + "MaybeSolverEventInfo": 2, + "Layout": 2, + "Internals0": 8, + "Exec": 5, + "trace_port_layout_info": 1, + "LabelNum": 8, + "entry_label": 2, + "map.search": 2, + "Internal0": 4, + "internal_layout_info": 6, + "Exec0": 3, + "Resume": 5, + "Return": 6, + "Internal": 8, + "map.det_update": 4, + "Internals": 6, + "map.det_insert": 3, + "LayoutInfo": 2, + "Resume0": 3, + "get_active_temps_data": 2, + "assoc_list": 1, + "Temps": 2, + "map.select": 1, + "TempsInUseContentMap": 2, + "map.to_assoc_list": 3, + "cis_proc_label.": 1, + "SeqNo": 2, + "ClosureLayout": 2, + "ClosureLayouts": 2, + "|": 38, + "String": 2, + "SlotNum": 2, + "Size0": 3, + "RevTable0": 2, + "Size": 4, + "RevTable": 3, + "RevTable.": 1, + "TableSize": 2, + "cip_ts_string_table_size.": 1, + "RvalsTypes": 2, + "DataAddr": 6, + "StaticCellInfo0": 6, + "global_data.add_scalar_static_cell": 1, + "Rvals": 2, + "global_data.add_scalar_static_cell_natural_types": 1, + "Types": 6, + "Vector": 2, + "global_data.add_vector_static_cell": 1, + "AllocId": 2, + "AllocSite": 3, + "AllocSites0": 2, + "set_tree234.insert": 1, + "AllocSites": 2, + "position_info.": 1, + "branch_end_info.": 1, + "branch_end": 4, + "branch_end_info": 7, + "remember_position": 3, + "position_info": 14, + "reset_to_position": 4, + "reset_resume_known": 2, + "generate_branch_end": 2, + "abs_store_map": 3, + "after_all_branches": 2, + "save_hp_in_branch": 2, + "pos_get_fail_info": 3, + "fail_info.": 2, + "LocDep": 6, + "cild_fail_info.": 1, + "CurCI": 2, + "NextCI": 2, + "Static": 2, + "Persistent": 2, + "NextCI0": 4, + "TempsInUse0": 4, + "set.union": 2, + "BranchStart": 2, + "BranchStartFailInfo": 2, + "BSResumeKnown": 2, + "CurFailInfo": 2, + "CurFailStack": 2, + "CurCurfMaxfr": 2, + "CurCondEnv": 2, + "CurHijack": 2, + "NewFailInfo": 2, + "StoreMap": 8, + "MaybeEnd0": 3, + "MaybeEnd": 6, + "AbsVarLocs": 3, + "assoc_list.values": 1, + "AbsLocs": 2, + "code_util.max_mentioned_abs_regs": 1, + "instmap_is_reachable": 1, + "VarLocs": 2, + "assoc_list.map_values_only": 2, + "abs_locn_to_lval": 2, + "place_vars": 1, + "remake_with_store_map": 4, + "empty": 9, + "EndCodeInfo1": 5, + "EndCodeInfo0": 3, + "FailInfo0": 13, + "FailInfo1": 2, + "ResumeKnown0": 5, + "CurfrMaxfr0": 2, + "CondEnv0": 3, + "Hijack0": 2, + "R": 2, + "ResumeKnown1": 2, + "CurfrMaxfr1": 2, + "CondEnv1": 2, + "Hijack1": 2, + "resume_point_known": 15, + "Redoip0": 3, + "Redoip1": 2, + "ResumeKnown": 21, + "expect": 15, + "unify": 21, + "must_be_equal": 11, + "CurfrMaxfr": 24, + "EndCodeInfoA": 2, + "TempsInUse1": 2, + "EndCodeInfo": 2, + "BranchEnd": 2, + "BranchEndCodeInfo": 2, + "BranchEndLocDep": 2, + "VarLocns": 2, + "VarLvals": 2, + "reinit_var_locn_state": 1, + "Slot": 2, + "Pos0": 2, + "Pos": 2, + "CI0": 2, + "CIStatic0": 2, + "CILocDep0": 2, + "CIPersistent0": 2, + "LocDep0": 2, + "CI1": 2, + "save_hp": 1, + "CI2": 2, + "CIStatic": 2, + "CIPersistent": 2, + "resume_map.": 1, + "resume_point_info.": 1, + "disj_hijack_info.": 1, + "prepare_for_disj_hijack": 2, + "code_model": 3, + "disj_hijack_info": 3, + "undo_disj_hijack": 2, + "ite_hijack_info.": 1, + "prepare_for_ite_hijack": 2, + "embedded_stack_frame_id": 3, + "ite_hijack_info": 3, + "ite_enter_then": 2, + "simple_neg_info.": 1, + "enter_simple_neg": 2, + "simple_neg_info": 3, + "leave_simple_neg": 2, + "det_commit_info.": 1, + "prepare_for_det_commit": 2, + "det_commit_info": 6, + "generate_det_commit": 2, + "semi_commit_info.": 1, + "prepare_for_semi_commit": 2, + "semi_commit_info": 6, + "generate_semi_commit": 2, + "effect_resume_point": 2, + "pop_resume_point": 1, + "top_resume_point": 1, + "set_resume_point_to_unknown": 1, + "set_resume_point_and_frame_to_unknown": 1, + "generate_failure": 2, + "fail_if_rval_is_false": 1, + "failure_is_direct_branch": 1, + "code_addr": 8, + "may_use_nondet_tailcall": 1, + "nondet_tail_call": 1, + "produce_vars": 1, + "resume_map": 9, + "flush_resume_vars_to_stack": 1, + "make_resume_point": 1, + "resume_locs": 1, + "generate_resume_point": 2, + "resume_point_vars": 1, + "resume_point_stack_addr": 2, + "stack": 1, + "curfr_vs_maxfr": 2, + "condition_env": 3, + "hijack_allowed": 2, + "orig_only": 2, + "stack_only": 2, + "orig_and_stack": 1, + "stack_and_orig": 1, + "redoip_update": 2, + "has_been_done": 5, + "wont_be_done.": 1, + "resume_point_unknown.": 1, + "may_be_different.": 1, + "inside_non_condition": 6, + "not_inside_non_condition.": 1, + "not_allowed.": 1, + "disj_no_hijack": 4, + "disj_temp_frame": 4, + "disj_quarter_hijack": 4, + "disj_half_hijack": 3, + "disj_full_hijack": 3, + "HijackInfo": 29, + "CondEnv": 12, + "Allow": 12, + "model_det": 2, + "model_semi": 3, + "singleton": 28, + "llds_instr": 64, + "comment": 5, + "model_non": 2, + "create_temp_frame": 4, + "do_fail": 6, + "stack.pop": 1, + "TopResumePoint": 6, + "RestResumePoints": 2, + "stack.is_empty": 1, + "wont_be_done": 2, + "acquire_temp_slot": 15, + "slot_lval": 14, + "redoip_slot": 30, + "curfr": 18, + "non_persistent_temp_slot": 15, + "RedoipSlot": 33, + "assign": 46, + "maxfr": 42, + "redofr_slot": 14, + "RedofrSlot": 17, + "from_list": 13, + "prevfr_slot": 3, + "pick_stack_resume_point": 3, + "StackLabel": 9, + "LabelConst": 4, + "const": 10, + "llconst_code_addr": 6, + "true": 3, + "ite_region_info": 5, + "ite_info": 3, + "ite_hijack_type": 2, + "ite_no_hijack": 3, + "ite_temp_frame": 3, + "ite_quarter_hijack": 3, + "ite_half_hijack": 3, + "ite_full_hijack": 3, + "CondCodeModel": 4, + "MaybeEmbeddedFrameId": 5, + "HijackType": 12, + "MaybeRegionInfo": 12, + "MaxfrSlot": 30, + "TempFrameCode": 4, + "MaxfrCode": 7, + "EmbeddedFrameId": 2, + "slot_success_record": 1, + "persistent_temp_slot": 1, + "SuccessRecordSlot": 6, + "InitSuccessCode": 3, + "llconst_false": 1, + "ITEResumePoint": 2, + "ThenCode": 10, + "ElseCode": 7, + "ResumePoints0": 5, + "stack.det_pop": 1, + "HijackResumeKnown": 2, + "OldCondEnv": 2, + "RegionInfo": 2, + "EmbeddedStackFrameId": 2, + "ITEStackResumeCodeAddr": 2, + "llconst_true": 1, + "AfterRegionOp": 3, + "if_val": 1, + "unop": 1, + "logical_not": 1, + "code_label": 2, + "use_and_maybe_pop_region_frame": 1, + "region_ite_nondet_cond_fail": 1, + "goto": 2, + "maybe_pick_stack_resume_point": 1, + "ResumeMap0": 2, + "make_fake_resume_map": 5, + "do_redo": 1, + "is_empty": 1, + "Vars": 10, + "Locns": 2, + "set.make_singleton_set": 1, + "reg": 1, + "pair": 7, + "region_commit_stack_frame": 5, + "AddTrailOps": 4, + "AddRegionOps": 5, + "CommitGoalInfo": 4, + "DetCommitInfo": 4, + "SaveMaxfrCode": 3, + "save_maxfr": 3, + "MaybeMaxfrSlot": 6, + "maybe_save_trail_info": 2, + "MaybeTrailSlots": 8, + "SaveTrailCode": 4, + "maybe_save_region_commit_frame": 4, + "MaybeRegionCommitFrameInfo": 8, + "SaveRegionCommitFrameCode": 2, + "SaveRegionCommitFrameCode.": 2, + "RestoreMaxfrCode": 3, + "restore_maxfr": 3, + "release_temp_slot": 1, + "maybe_restore_trail_info": 2, + "CommitTrailCode": 4, + "maybe_restore_region_commit_frame": 2, + "SuccessRegionCode": 3, + "_FailureRegionCode": 1, + "SuccessRegionCode.": 1, + "commit_hijack_info": 2, + "commit_temp_frame": 3, + "commit_quarter_hijack": 3, + "commit_half_hijack": 3, + "commit_full_hijack": 3, + "SemiCommitInfo": 4, + "clone_resume_point": 1, + "NewResumePoint": 4, + "stack.push": 1, + "StackLabelConst": 7, + "use_minimal_model_stack_copy_cut": 3, + "UseMinimalModelStackCopyCut": 4, + "Components": 4, + "foreign_proc_raw_code": 4, + "cannot_branch_away": 4, + "proc_affects_liveness": 2, + "live_lvals_info": 4, + "proc_does_not_affect_liveness": 2, + "MD": 4, + "proc_may_duplicate": 2, + "MarkCode": 3, + "foreign_proc_code": 2, + "proc_will_not_call_mercury": 2, + "HijackCode": 5, + "UseMinimalModel": 3, + "CutCode": 4, + "SuccessUndoCode": 5, + "FailureUndoCode": 5, + "AfterCommit": 2, + "ResumePointCode": 2, + "FailCode": 2, + "RestoreTrailCode": 2, + "FailureRegionCode": 2, + "SuccLabel": 3, + "GotoSuccLabel": 2, + "SuccLabelCode": 1, + "SuccessCode": 2, + "FailureCode": 2, + "SuccLabelCode.": 1, + "_ForwardLiveVarsBeforeGoal": 1, + "expr.": 1, + "char": 10, + "token": 5, + "num": 11, + "eof": 6, + "parse": 1, + "exprn/1": 1, + "xx": 1, + "scan": 16, + "mode": 8, + "rule": 3, + "exprn": 7, + "Num": 18, + "A": 14, + "term": 10, + "B": 8, + "{": 27, + "}": 28, + "*": 20, + "factor": 6, + "/": 1, + "//": 2, + "Chars": 2, + "Toks": 13, + "Toks0": 11, + "list__reverse": 1, + "Cs": 9, + "char__is_whitespace": 1, + "char__is_digit": 2, + "takewhile": 1, + "Digits": 2, + "Rest": 2, + "string__from_char_list": 1, + "NumStr": 2, + "string__det_to_int": 1, + "error": 7, + "hello.": 1, + "main": 15, + "io": 6, + "di": 54, + "uo": 58, + "IO": 4, + "io.write_string": 1, + "char.": 1, + "getopt_io.": 1, + "short_option": 36, + "option": 9, + "long_option": 241, + "option_defaults": 2, + "option_data": 2, + "nondet.": 1, + "special_handler": 1, + "special_data": 1, + "option_table": 5, + "maybe_option_table": 3, + "inconsequential_options": 1, + "options_help": 1, + "option_table_add_mercury_library_directory": 1, + "option_table.": 2, + "option_table_add_search_library_files_directory": 1, + "quote_arg": 1, + "inhibit_warnings": 4, + "inhibit_accumulator_warnings": 3, + "halt_at_warn": 3, + "halt_at_syntax_errors": 3, + "halt_at_auto_parallel_failure": 3, + "warn_singleton_vars": 3, + "warn_overlapping_scopes": 3, + "warn_det_decls_too_lax": 3, + "warn_inferred_erroneous": 3, + "warn_nothing_exported": 3, + "warn_unused_args": 3, + "warn_interface_imports": 3, + "warn_missing_opt_files": 3, + "warn_missing_trans_opt_files": 3, + "warn_missing_trans_opt_deps": 3, + "warn_non_contiguous_clauses": 3, + "warn_non_contiguous_foreign_procs": 3, + "warn_non_stratification": 3, + "warn_unification_cannot_succeed": 3, + "warn_simple_code": 3, + "warn_duplicate_calls": 3, + "warn_missing_module_name": 3, + "warn_wrong_module_name": 3, + "warn_smart_recompilation": 3, + "warn_undefined_options_variables": 3, + "warn_non_tail_recursion": 3, + "warn_target_code": 3, + "warn_up_to_date": 3, + "warn_stubs": 3, + "warn_dead_procs": 3, + "warn_table_with_inline": 3, + "warn_non_term_special_preds": 3, + "warn_known_bad_format_calls": 3, + "warn_unknown_format_calls": 3, + "warn_obsolete": 3, + "warn_insts_without_matching_type": 3, + "warn_unused_imports": 3, + "inform_ite_instead_of_switch": 3, + "warn_unresolved_polymorphism": 3, + "warn_suspicious_foreign_procs": 3, + "warn_state_var_shadowing": 3, + "inform_inferred": 3, + "inform_inferred_types": 3, + "inform_inferred_modes": 3, + "verbose": 4, + "very_verbose": 4, + "verbose_errors": 4, + "verbose_recompilation": 3, + "find_all_recompilation_reasons": 3, + "verbose_make": 3, + "verbose_commands": 3, + "output_compile_error_lines": 3, + "report_cmd_line_args": 3, + "report_cmd_line_args_in_doterr": 3, + "statistics": 4, + "detailed_statistics": 3, + "proc_size_statistics": 3, + "debug_types": 4, + "debug_modes": 4, + "debug_modes_statistics": 3, + "debug_modes_minimal": 3, + "debug_modes_verbose": 3, + "debug_modes_pred_id": 3, + "debug_dep_par_conj": 3, + "debug_det": 4, + "debug_code_gen_pred_id": 3, + "debug_opt": 3, + "debug_term": 4, + "constraint": 2, + "termination": 3, + "analysis": 1, + "debug_opt_pred_id": 3, + "debug_opt_pred_name": 3, + "debug_pd": 3, + "pd": 1, + "partial": 1, + "deduction/deforestation": 1, + "debug_il_asm": 3, + "il_asm": 1, + "IL": 2, + "generation": 1, + "via": 1, + "asm": 1, + "debug_liveness": 3, + "debug_stack_opt": 3, + "debug_make": 3, + "debug_closure": 3, + "debug_trail_usage": 3, + "debug_mode_constraints": 3, + "debug_intermodule_analysis": 3, + "debug_mm_tabling_analysis": 3, + "debug_indirect_reuse": 3, + "debug_type_rep": 3, + "make_short_interface": 4, + "make_interface": 5, + "make_private_interface": 4, + "make_optimization_interface": 5, + "make_transitive_opt_interface": 5, + "make_analysis_registry": 3, + "make_xml_documentation": 5, + "generate_source_file_mapping": 4, + "generate_dependency_file": 3, + "generate_dependencies": 4, + "generate_module_order": 3, + "generate_standalone_interface": 3, + "convert_to_mercury": 6, + "typecheck_only": 4, + "errorcheck_only": 4, + "target_code_only": 10, + "compile_only": 4, + "compile_to_shared_lib": 3, + "output_grade_string": 3, + "output_link_command": 3, + "output_shared_lib_link_command": 3, + "output_libgrades": 3, + "output_cc": 3, + "output_c_compiler_type": 4, + "output_csharp_compiler_type": 3, + "output_cflags": 3, + "output_library_link_flags": 3, + "output_grade_defines": 3, + "output_c_include_directory_flags": 4, + "smart_recompilation": 3, + "generate_item_version_numbers": 2, + "generate_mmc_make_module_dependencies": 4, + "assume_gmake": 3, + "trace_optimized": 4, + "trace_prof": 3, + "trace_table_io": 3, + "trace_table_io_only_retry": 3, + "trace_table_io_states": 3, + "trace_table_io_require": 3, + "trace_table_io_all": 3, + "trace_goal_flags": 3, + "prof_optimized": 4, + "exec_trace_tail_rec": 3, + "suppress_trace": 3, + "force_disable_tracing": 3, + "delay_death": 3, + "delay_death_max_vars": 3, + "stack_trace_higher_order": 3, + "force_disable_ssdebug": 3, + "generate_bytecode": 3, + "line_numbers": 4, + "frameopt_comments": 3, + "max_error_line_width": 3, + "show_dependency_graph": 3, + "imports_graph": 3, + "dump_trace_counts": 3, + "dump_hlds": 5, + "dump_hlds_pred_id": 3, + "dump_hlds_pred_name": 3, + "dump_hlds_alias": 4, + "dump_hlds_options": 3, + "dump_hlds_inst_limit": 3, + "dump_hlds_file_suffix": 3, + "dump_same_hlds": 3, + "dump_mlds": 4, + "verbose_dump_mlds": 4, + "mode_constraints": 3, + "simple_mode_constraints": 3, + "prop_mode_constraints": 4, + "benchmark_modes": 3, + "benchmark_modes_repeat": 3, + "sign_assembly": 3, + "separate_assemblies": 3, + "reorder_conj": 3, + "reorder_disj": 3, + "fully_strict": 3, + "strict_sequential": 3, + "allow_stubs": 3, + "infer_types": 3, + "infer_modes": 3, + "infer_det": 4, + "infer_all": 3, + "type_inference_iteration_limit": 3, + "mode_inference_iteration_limit": 3, + "event_set_file_name": 3, + "grade": 4, + "target": 14, + "il": 5, + "il_only": 4, + "compile_to_c": 4, + "c": 1, + "java": 35, + "java_only": 4, + "csharp": 6, + "csharp_only": 4, + "x86_64": 6, + "x86_64_only": 4, + "erlang": 6, + "erlang_only": 4, + "exec_trace": 3, + "decl_debug": 3, + "profiling": 5, + "profile_time": 5, + "profile_calls": 6, + "time_profiling": 3, + "memory_profiling": 3, + "profile_mem": 1, + "deep_profiling": 3, + "profile_deep": 4, + "profile_memory": 3, + "use_activation_counts": 3, + "pre_prof_transforms_simplify": 3, + "pre_implicit_parallelism_simplify": 3, + "coverage_profiling": 3, + "coverage_profiling_via_calls": 3, + "coverage_profiling_static": 3, + "profile_deep_coverage_after_goal": 3, + "profile_deep_coverage_branch_ite": 3, + "profile_deep_coverage_branch_switch": 3, + "profile_deep_coverage_branch_disj": 3, + "profile_deep_coverage_use_portcounts": 3, + "profile_deep_coverage_use_trivial": 2, + "profile_for_feedback": 2, + "use_zeroing_for_ho_cycles": 2, + "use_lots_of_ho_specialization": 2, + "deep_profile_tail_recursion": 2, + "record_term_sizes_as_words": 2, + "record_term_sizes_as_cells": 2, + "experimental_complexity": 2, + "gc": 2, + "threadscope": 2, + "trail_segments": 2, + "use_minimal_model_stack_copy": 2, + "use_minimal_model_own_stacks": 2, + "minimal_model_debug": 2, + "single_prec_float": 2, + "type_layout": 2, + "maybe_thread_safe_opt": 2, + "extend_stacks_when_needed": 2, + "stack_segments": 2, + "use_regions": 2, + "use_alloc_regions": 2, + "use_regions_debug": 2, + "use_regions_profiling": 2, + "source_to_source_debug": 5, + "ssdb_trace_level": 3, + "link_ssdb_libs": 4, + "tags": 2, + "num_tag_bits": 2, + "num_reserved_addresses": 2, + "num_reserved_objects": 2, + "bits_per_word": 2, + "bytes_per_word": 2, + "conf_low_tag_bits": 2, + "unboxed_enums": 2, + "unboxed_no_tag_types": 2, + "sync_term_size": 2, + "words": 1, + "gcc_global_registers": 2, + "pic_reg": 2, + "highlevel_code": 3, + "highlevel_data": 2, + "gcc_nested_functions": 2, + "det_copy_out": 2, + "nondet_copy_out": 2, + "put_commit_in_own_func": 2, + "put_nondet_env_on_heap": 2, + "verifiable_code": 2, + "il_refany_fields": 2, + "il_funcptr_types": 2, + "il_byref_tailcalls": 2, + "backend_foreign_languages": 2, + "stack_trace": 2, + "basic_stack_layout": 2, + "agc_stack_layout": 2, + "procid_stack_layout": 2, + "trace_stack_layout": 2, + "can_compare_constants_as_ints": 2, + "pretest_equality_cast_pointers": 2, + "can_compare_compound_values": 2, + "lexically_order_constructors": 2, + "mutable_always_boxed": 2, + "delay_partial_instantiations": 2, + "allow_defn_of_builtins": 2, + "special_preds": 2, + "type_ctor_info": 2, + "type_ctor_layout": 2, + "type_ctor_functors": 2, + "new_type_class_rtti": 2, + "rtti_line_numbers": 2, + "disable_minimal_model_stack_copy_pneg": 2, + "disable_minimal_model_stack_copy_cut": 2, + "use_minimal_model_stack_copy_pneg": 2, + "size_region_ite_fixed": 2, + "size_region_disj_fixed": 2, + "size_region_semi_disj_fixed": 1, + "size_region_commit_fixed": 2, + "size_region_ite_protect": 2, + "size_region_ite_snapshot": 2, + "size_region_semi_disj_protect": 2, + "size_region_disj_snapshot": 2, + "size_region_commit_entry": 2, + "solver_type_auto_init": 2, + "allow_multi_arm_switches": 2, + "type_check_constraints": 2, + "allow_argument_packing": 2, + "low_level_debug": 2, + "table_debug": 2, + "trad_passes": 2, + "parallel_liveness": 2, + "parallel_code_gen": 2, + "polymorphism": 2, + "reclaim_heap_on_failure": 2, + "reclaim_heap_on_semidet_failure": 2, + "reclaim_heap_on_nondet_failure": 2, + "have_delay_slot": 2, + "num_real_r_regs": 2, + "num_real_f_regs": 2, + "num_real_r_temps": 2, + "num_real_f_temps": 2, + "max_jump_table_size": 2, + "max_specialized_do_call_closure": 2, + "max_specialized_do_call_class_method": 2, + "compare_specialization": 2, + "should_pretest_equality": 2, + "fact_table_max_array_size": 2, + "fact_table_hash_percent_full": 2, + "gcc_local_labels": 2, + "prefer_switch": 2, + "opt_level": 3, + "opt_level_number": 2, + "opt_space": 2, + "Default": 3, + "to": 16, + "optimize": 3, + "time.": 1, + "intermodule_optimization": 2, + "read_opt_files_transitively": 2, + "use_opt_files": 2, + "use_trans_opt_files": 2, + "transitive_optimization": 2, + "intermodule_analysis": 2, + "analysis_repeat": 2, + "analysis_file_cache": 2, + "allow_inlining": 2, + "inlining": 2, + "inline_simple": 2, + "inline_builtins": 2, + "inline_single_use": 2, + "inline_call_cost": 2, + "inline_compound_threshold": 2, + "inline_simple_threshold": 2, + "inline_vars_threshold": 2, + "intermod_inline_simple_threshold": 2, + "from_ground_term_threshold": 2, + "enable_const_struct": 2, + "common_struct": 2, + "common_struct_preds": 2, + "common_goal": 2, + "constraint_propagation": 2, + "local_constraint_propagation": 2, + "optimize_unused_args": 2, + "intermod_unused_args": 2, + "optimize_higher_order": 2, + "higher_order_size_limit": 2, + "higher_order_arg_limit": 2, + "unneeded_code": 2, + "unneeded_code_copy_limit": 2, + "unneeded_code_debug": 2, + "unneeded_code_debug_pred_name": 2, + "type_specialization": 2, + "user_guided_type_specialization": 2, + "introduce_accumulators": 2, + "optimize_constructor_last_call_accumulator": 2, + "optimize_constructor_last_call": 2, + "optimize_duplicate_calls": 2, + "constant_propagation": 2, + "excess_assign": 2, + "optimize_format_calls": 2, + "optimize_saved_vars_const": 2, + "optimize_saved_vars_cell": 2, + "optimize_saved_vars_cell_loop": 2, + "optimize_saved_vars_cell_full_path": 2, + "optimize_saved_vars_cell_on_stack": 2, + "optimize_saved_vars_cell_candidate_headvars": 2, + "optimize_saved_vars_cell_cv_store_cost": 2, + "optimize_saved_vars_cell_cv_load_cost": 2, + "optimize_saved_vars_cell_fv_store_cost": 2, + "optimize_saved_vars_cell_fv_load_cost": 2, + "optimize_saved_vars_cell_op_ratio": 2, + "optimize_saved_vars_cell_node_ratio": 2, + "optimize_saved_vars_cell_all_path_node_ratio": 2, + "optimize_saved_vars_cell_include_all_candidates": 2, + "optimize_saved_vars": 2, + "loop_invariants": 2, + "delay_construct": 2, + "follow_code": 2, + "optimize_dead_procs": 2, + "deforestation": 2, + "deforestation_depth_limit": 2, + "deforestation_cost_factor": 2, + "deforestation_vars_threshold": 2, + "deforestation_size_threshold": 2, + "analyse_trail_usage": 2, + "analyse_mm_tabling": 2, + "untuple": 2, + "tuple": 2, + "tuple_trace_counts_file": 2, + "tuple_costs_ratio": 2, + "tuple_min_args": 2, + "inline_par_builtins": 2, + "always_specialize_in_dep_par_conjs": 2, + "allow_some_paths_only_waits": 2, + "structure_sharing_analysis": 2, + "structure_sharing_widening": 2, + "structure_reuse_analysis": 2, + "structure_reuse_constraint": 2, + "structure_reuse_constraint_arg": 2, + "structure_reuse_max_conditions": 2, + "structure_reuse_repeat": 2, + "structure_reuse_free_cells": 2, + "termination_check": 2, + "verbose_check_termination": 2, + "termination_single_args": 2, + "termination_norm": 2, + "termination_error_limit": 2, + "termination_path_limit": 2, + "termination2": 2, + "check_termination2": 2, + "verbose_check_termination2": 2, + "termination2_norm": 2, + "widening_limit": 2, + "arg_size_analysis_only": 2, + "propagate_failure_constrs": 2, + "term2_maximum_matrix_size": 2, + "analyse_exceptions": 2, + "analyse_closures": 2, + "smart_indexing": 2, + "dense_switch_req_density": 2, + "lookup_switch_req_density": 2, + "dense_switch_size": 2, + "lookup_switch_size": 2, + "string_hash_switch_size": 2, + "string_binary_switch_size": 2, + "tag_switch_size": 2, + "try_switch_size": 2, + "binary_switch_size": 2, + "switch_single_rec_base_first": 2, + "switch_multi_rec_base_first": 2, + "use_atomic_cells": 2, + "middle_rec": 2, + "simple_neg": 2, + "optimize_tailcalls": 2, + "optimize_initializations": 2, + "eliminate_local_vars": 2, + "generate_trail_ops_inline": 2, + "common_data": 2, + "common_layout_data": 2, + "Also": 1, + "used": 2, + "for": 8, + "MLDS": 2, + "optimizations.": 1, + "optimize_peep": 2, + "optimize_peep_mkword": 2, + "optimize_jumps": 2, + "optimize_fulljumps": 2, + "pessimize_tailcalls": 2, + "checked_nondet_tailcalls": 2, + "use_local_vars": 2, + "local_var_access_threshold": 2, + "standardize_labels": 2, + "optimize_labels": 2, + "optimize_dups": 2, + "optimize_proc_dups": 2, + "optimize_frames": 2, + "optimize_delay_slot": 2, + "optimize_reassign": 2, + "optimize_repeat": 2, + "layout_compression_limit": 2, + "use_macro_for_redo_fail": 2, + "emit_c_loops": 2, + "everything_in_one_c_function": 2, + "local_thread_engine_base": 2, + "erlang_switch_on_strings_as_atoms": 2, + "target_debug": 2, + "cc": 2, + "cflags": 2, + "quoted_cflag": 2, + "c_include_directory": 2, + "c_optimize": 2, + "ansi_c": 2, + "inline_alloc": 2, + "gcc_flags": 2, + "quoted_gcc_flag": 2, + "clang_flags": 2, + "quoted_clang_flag": 2, + "msvc_flags": 2, + "quoted_msvc_flag": 2, + "cflags_for_warnings": 2, + "cflags_for_optimization": 2, + "cflags_for_ansi": 2, + "cflags_for_regs": 2, + "cflags_for_gotos": 2, + "cflags_for_threads": 2, + "cflags_for_debug": 2, + "cflags_for_pic": 2, + "c_flag_to_name_object_file": 2, + "object_file_extension": 2, + "pic_object_file_extension": 2, + "link_with_pic_object_file_extension": 2, + "c_compiler_type": 2, + "csharp_compiler_type": 2, + "java_compiler": 2, + "java_interpreter": 2, + "java_flags": 2, + "quoted_java_flag": 2, + "java_classpath": 2, + "java_object_file_extension": 2, + "il_assembler": 2, + "ilasm_flags": 2, + "quoted_ilasm_flag": 2, + "dotnet_library_version": 2, + "support_ms_clr": 2, + "support_rotor_clr": 2, + "csharp_compiler": 2, + "csharp_flags": 2, + "quoted_csharp_flag": 2, + "cli_interpreter": 2, + "erlang_compiler": 2, + "erlang_interpreter": 2, + "erlang_flags": 2, + "quoted_erlang_flag": 2, + "erlang_include_directory": 2, + "erlang_object_file_extension": 2, + "erlang_native_code": 2, + "erlang_inhibit_trivial_warnings": 2, + "output_file_name": 3, + "ld_flags": 2, + "quoted_ld_flag": 2, + "ld_libflags": 2, + "quoted_ld_libflag": 2, + "link_library_directories": 3, + "runtime_link_library_directories": 3, + "link_libraries": 3, + "link_objects": 2, + "mercury_library_directories": 2, + "mercury_library_directory_special": 2, + "search_library_files_directories": 2, + "search_library_files_directory_special": 2, + "mercury_libraries": 2, + "mercury_library_special": 2, + "mercury_standard_library_directory": 2, + "mercury_standard_library_directory_special": 2, + "init_file_directories": 2, + "init_files": 2, + "trace_init_files": 2, + "linkage": 2, + "linkage_special": 2, + "mercury_linkage": 2, + "mercury_linkage_special": 2, + "strip": 2, + "demangle": 2, + "allow_undefined": 2, + "use_readline": 2, + "runtime_flags": 2, + "extra_initialization_functions": 2, + "frameworks": 2, + "framework_directories": 3, + "shared_library_extension": 2, + "library_extension": 2, + "executable_file_extension": 2, + "link_executable_command": 2, + "link_shared_lib_command": 2, + "create_archive_command": 2, + "create_archive_command_output_flag": 2, + "create_archive_command_flags": 2, + "ranlib_command": 2, + "ranlib_flags": 2, + "mkinit_command": 2, + "mkinit_erl_command": 2, + "demangle_command": 2, + "filtercc_command": 2, + "trace_libs": 2, + "thread_libs": 2, + "hwloc_libs": 2, + "hwloc_static_libs": 2, + "shared_libs": 2, + "math_lib": 2, + "readline_libs": 2, + "linker_opt_separator": 2, + "linker_thread_flags": 2, + "shlib_linker_thread_flags": 2, + "linker_static_flags": 2, + "linker_strip_flag": 2, + "linker_link_lib_flag": 2, + "linker_link_lib_suffix": 2, + "shlib_linker_link_lib_flag": 2, + "shlib_linker_link_lib_suffix": 2, + "linker_debug_flags": 2, + "shlib_linker_debug_flags": 2, + "linker_trace_flags": 2, + "shlib_linker_trace_flags": 2, + "linker_path_flag": 2, + "linker_rpath_flag": 2, + "linker_rpath_separator": 2, + "shlib_linker_rpath_flag": 2, + "shlib_linker_rpath_separator": 2, + "linker_allow_undefined_flag": 2, + "linker_error_undefined_flag": 2, + "shlib_linker_use_install_name": 2, + "shlib_linker_install_name_flag": 2, + "shlib_linker_install_name_path": 2, + "java_archive_command": 2, + "make": 3, + "keep_going": 3, + "rebuild": 3, + "jobs": 3, + "track_flags": 2, + "invoked_by_mmc_make": 2, + "extra_init_command": 2, + "pre_link_command": 2, + "install_prefix": 2, + "use_symlinks": 2, + "mercury_configuration_directory": 2, + "mercury_configuration_directory_special": 2, + "install_command": 2, + "install_command_dir_option": 2, + "libgrades": 2, + "libgrades_include_components": 2, + "libgrades_exclude_components": 2, + "lib_linkages": 2, + "flags_file": 2, + "options_files": 2, + "config_file": 2, + "options_search_directories": 2, + "use_subdirs": 2, + "use_grade_subdirs": 2, + "search_directories": 3, + "intermod_directories": 2, + "use_search_directories_for_intermod": 2, + "libgrade_install_check": 2, + "order_make_by_timestamp": 2, + "show_make_times": 2, + "extra_library_header": 2, + "restricted_command_line": 2, + "env_type": 2, + "host_env_type": 2, + "target_env_type": 2, + "filenames_from_stdin": 2, + "typecheck_ambiguity_warn_limit": 2, + "typecheck_ambiguity_error_limit": 2, + "help": 4, + "version": 3, + "fullarch": 2, + "cross_compiling": 2, + "local_module_id": 2, + "analysis_file_cache_dir": 2, + "compiler_sufficiently_recent": 2, + "experiment": 2, + "ignore_par_conjunctions": 2, + "control_granularity": 2, + "distance_granularity": 2, + "implicit_parallelism": 2, + "feedback_file": 2, + "par_loop_control": 2, + "par_loop_control_preserve_tail_recursion.": 1, + "libs.handle_options.": 1, + "dir.": 1, + "option_category": 2, + "warning_option": 2, + "verbosity_option": 2, + "output_option": 2, + "aux_output_option": 2, + "language_semantics_option": 2, + "compilation_model_option": 2, + "internal_use_option": 2, + "code_gen_option": 2, + "special_optimization_option": 2, + "optimization_option": 2, + "target_code_compilation_option": 2, + "link_option": 2, + "build_system_option": 2, + "miscellaneous_option.": 1, + "Option": 2, + "option_defaults_2": 18, + "_Category": 1, + "OptionsList": 2, + "list.member": 2, + "multi.": 1, + "bool_special": 7, + "XXX": 3, + "should": 1, + "be": 1, + "accumulating": 49, + "maybe_string": 6, + "special": 17, + "string_special": 18, + "int_special": 1, + "maybe_string_special": 1, + "file_special": 1, + "miscellaneous_option": 1, + "par_loop_control_preserve_tail_recursion": 1, + "check_hlds.polymorphism.": 1, + "hlds.": 1, + "mdbcomp.": 1, + "parse_tree.": 1, + "polymorphism_process_module": 2, + "polymorphism_process_generated_pred": 2, + "unification_typeinfos_rtti_varmaps": 2, + "rtti_varmaps": 9, + "unification": 8, + "polymorphism_process_new_call": 2, + "builtin_state": 1, + "call_unify_context": 2, + "sym_name": 3, + "hlds_goal": 45, + "poly_info": 45, + "polymorphism_make_type_info_vars": 1, + "polymorphism_make_type_info_var": 1, + "int_or_var": 2, + "iov_int": 1, + "iov_var": 1, + "gen_extract_type_info": 1, + "tvar": 10, + "kind": 1, + "vartypes": 12, + "poly_info.": 1, + "create_poly_info": 1, + "poly_info_extract": 1, + "build_typeclass_info_type": 3, + "prog_constraint": 4, + "type_is_typeclass_info": 1, + "type_is_type_info_or_ctor_type": 1, + "build_type_info_type": 1, + "get_special_proc": 1, + "special_pred_id": 2, + "get_special_proc_det": 1, + "convert_pred_to_lambda_goal": 3, + "purity": 1, + "lambda_eval_method": 1, + "unify_context": 3, + "context": 1, + "unify_rhs": 4, + "fix_undetermined_mode_lambda_goal": 2, + "rhs_lambda_goal": 7, + "init_type_info_var": 1, + "init_const_type_ctor_info_var": 1, + "type_ctor": 1, + "cons_id": 2, + "type_info_kind": 2, + "type_info": 8, + "type_ctor_info.": 1, + "new_type_info_var_raw": 1, + "check_hlds.clause_to_proc.": 1, + "check_hlds.mode_util.": 1, + "hlds.from_ground_term_util.": 1, + "hlds.const_struct.": 1, + "hlds.goal_util.": 1, + "hlds.hlds_args.": 1, + "hlds.hlds_clauses.": 1, + "hlds.hlds_code_util.": 1, + "hlds.passes_aux.": 1, + "hlds.pred_table.": 1, + "hlds.quantification.": 1, + "hlds.special_pred.": 1, + "libs.": 1, + "mdbcomp.program_representation.": 1, + "parse_tree.prog_mode.": 1, + "parse_tree.prog_type_subst.": 1, + "solutions.": 1, + "module_info_get_preds": 3, + ".ModuleInfo": 8, + "Preds0": 2, + "PredIds0": 2, + "list.foldl": 6, + "maybe_polymorphism_process_pred": 3, + "Preds1": 2, + "PredIds1": 2, + "fixup_pred_polymorphism": 4, + "expand_class_method_bodies": 1, + "PredModule": 8, + "pred_info_module": 4, + "PredName": 8, + "pred_info_name": 4, + "PredArity": 6, + "pred_info_orig_arity": 3, + "no_type_info_builtin": 3, + "copy_module_clauses_to_procs": 1, + "polymorphism_process_pred_msg": 3, + "PredTable0": 3, + "map.lookup": 2, + "PredInfo0": 16, + "pred_info_get_clauses_info": 2, + "ClausesInfo0": 5, + "clauses_info_get_vartypes": 2, + "VarTypes0": 12, + "clauses_info_get_headvars": 2, + "pred_info_get_arg_types": 7, + "TypeVarSet": 15, + "ExistQVars": 13, + "ArgTypes0": 3, + "proc_arg_vector_partition_poly_args": 1, + "ExtraHeadVarList": 2, + "OldHeadVarList": 2, + "lookup_var_types": 6, + "ExtraArgTypes": 2, + "ArgTypes": 6, + "pred_info_set_arg_types": 1, + "PredInfo1": 5, + "OldHeadVarTypes": 2, + "type_list_subsumes": 2, + "Subn": 3, + "map.is_empty": 1, + "pred_info_set_existq_tvar_binding": 1, + "PredInfo2": 7, + "polymorphism_introduce_exists_casts_pred": 3, + "PredTable": 2, + "module_info_set_preds": 1, + "pred_info_get_procedures": 2, + ".PredInfo": 2, + "Procs0": 4, + "map.map_values_only": 1, + ".ProcInfo": 2, + "det": 21, + "introduce_exists_casts_proc": 1, + "Procs": 4, + "pred_info_set_procedures": 2, + "trace": 4, + "compiletime": 4, + "flag": 4, + "write_pred_progress_message": 1, + "polymorphism_process_pred": 4, + "mutable": 3, + "selected_pred": 1, + "ground": 9, + "untrailed": 2, + "level": 1, + "promise_pure": 30, + "pred_id_to_int": 1, + "impure": 2, + "set_selected_pred": 2, + "polymorphism_process_clause_info": 3, + "ClausesInfo": 13, + "Info": 134, + "ExtraArgModes": 20, + "poly_info_get_module_info": 4, + "poly_info_get_const_struct_db": 1, + "ConstStructDb": 2, + "module_info_set_const_struct_db": 1, + "poly_info_get_typevarset": 4, + "pred_info_set_typevarset": 1, + "pred_info_set_clauses_info": 1, + "ProcIds": 5, + "pred_info_procids": 2, + "polymorphism_process_proc_in_table": 3, + "module_info_set_pred_info": 1, + "clauses_info": 6, + "poly_arg_vector": 9, + "mer_mode": 14, + "ModuleInfo0": 8, + "init_poly_info": 1, + ".ClausesInfo": 2, + "_VarSet": 1, + "ExplicitVarTypes": 2, + "_TVarNameMap": 1, + "_VarTypes": 1, + "HeadVars0": 5, + "ClausesRep0": 2, + "ItemNumbers": 2, + "_RttiVarMaps": 1, + "HaveForeignClauses": 2, + "setup_headvars": 3, + "UnconstrainedTVars": 15, + "ExtraTypeInfoHeadVars": 4, + "ExistTypeClassInfoHeadVars": 6, + "get_clause_list": 1, + "Clauses0": 2, + "list.map_foldl": 2, + "polymorphism_process_clause": 3, + "Clauses": 2, + "poly_info_get_varset": 4, + ".Info": 25, + "poly_info_get_var_types": 6, + "poly_info_get_rtti_varmaps": 4, + "RttiVarMaps": 16, + "set_clause_list": 1, + "ClausesRep": 2, + "TVarNameMap": 2, + "This": 2, + "only": 4, + "while": 1, + "adding": 1, + "the": 27, + "clauses.": 1, + "proc_arg_vector": 9, + "clause": 2, + "OldHeadVars": 2, + "NewHeadVars": 2, + "Clause": 2, + "pred_info_is_imported": 2, + "Goal0": 21, + ".Clause": 1, + "clause_body": 2, + "empty_cache_maps": 4, + "poly_info_set_num_reuses": 1, + "polymorphism_process_goal": 20, + "Goal1": 2, + "produce_existq_tvars": 3, + "Goal2": 2, + "pred_info_get_exist_quant_tvars": 1, + "fixup_quantification": 1, + "Goal": 40, + "proc_table": 2, + "ProcTable": 2, + ".ProcTable": 1, + "ProcInfo0": 2, + "polymorphism_process_proc": 3, + "pred_info_is_pseudo_imported": 1, + "hlds_pred.in_in_unification_proc_id": 1, + "HeadVarList": 4, + "proc_arg_vector_to_list": 2, + "clauses_info_get_rtti_varmaps": 1, + "clauses_info_get_varset": 1, + "proc_info_set_headvars": 1, + "proc_info_set_rtti_varmaps": 1, + "proc_info_set_varset": 1, + "proc_info_set_vartypes": 1, + "copy_clauses_to_proc": 1, + "proc_info_get_argmodes": 2, + "ArgModes1": 2, + "ExtraArgModesList": 2, + "poly_arg_vector_to_list": 1, + "ArgModes": 5, + "proc_info_set_argmodes": 1, + "ExtraHeadTypeInfoVars": 7, + "ExistHeadTypeClassInfoVars": 9, + "pred_info_get_origin": 1, + "Origin": 8, + "ExtraArgModes0": 3, + "poly_arg_vector_init": 1, + "origin_instance_method": 1, + "InstanceMethodConstraints": 4, + "setup_headvars_instance_method": 3, + "origin_special_pred": 1, + "origin_transformed": 1, + "origin_created": 1, + "origin_assertion": 1, + "origin_lambda": 1, + "origin_user": 1, + "pred_info_get_class_context": 4, + "ClassContext": 6, + "InstanceTVars": 7, + "InstanceUnconstrainedTVars": 2, + "InstanceUnconstrainedTypeInfoVars": 2, + "setup_headvars_2": 4, + "instance_method_constraints": 2, + "InstanceTypes": 2, + "InstanceConstraints": 3, + "type_vars_list": 5, + "get_unconstrained_tvars": 1, + "UnconstrainedInstanceTVars": 6, + "ArgTypeVarSet": 5, + "make_head_vars": 3, + "UnconstrainedInstanceTypeInfoVars": 7, + "make_typeclass_info_head_vars": 3, + "do_record_type_info_locns": 3, + "InstanceHeadTypeClassInfoVars": 4, + "proc_arg_vector_set_instance_type_infos": 1, + "proc_arg_vector_set_instance_typeclass_infos": 1, + "RttiVarMaps0": 4, + "rtti_reuse_typeclass_info_var": 3, + "poly_info_set_rtti_varmaps": 3, + "in_mode": 3, + "InMode": 3, + "list.duplicate": 6, + "list.length": 16, + "UnconstrainedInstanceTypeInfoModes": 2, + "InstanceHeadTypeClassInfoModes": 2, + "poly_arg_vector_set_instance_type_infos": 1, + "poly_arg_vector_set_instance_typeclass_infos": 1, + "prog_constraints": 1, + "AllUnconstrainedTVars": 2, + "AllExtraHeadTypeInfoVars": 2, + "constraints": 4, + "UnivConstraints": 3, + "ExistConstraints": 6, + "prog_type.constraint_list_get_tvars": 2, + "UnivConstrainedTVars": 2, + "ExistConstrainedTVars": 2, + "poly_info_get_constraint_map": 4, + "ConstraintMap": 12, + "get_improved_exists_head_constraints": 4, + "ActualExistConstraints": 9, + "pred_info_get_markers": 1, + "PredMarkers": 2, + "check_marker": 1, + "marker_class_method": 1, + "RecordExistQLocns": 3, + "do_not_record_type_info_locns": 1, + "UnivHeadTypeClassInfoVars": 4, + "HeadTypeVars": 2, + "list.delete_elems": 12, + "UnconstrainedTVars0": 2, + "UnconstrainedTVars1": 2, + "UnconstrainedTVars2": 2, + "list.remove_dups": 4, + "UnconstrainedUnivTVars": 7, + "UnconstrainedExistTVars": 6, + "ExistHeadTypeInfoVars": 5, + "UnivHeadTypeInfoVars": 4, + "list.condense": 4, + "proc_arg_vector_set_univ_type_infos": 1, + "HeadVars1": 2, + "proc_arg_vector_set_exist_type_infos": 1, + "HeadVars2": 2, + "proc_arg_vector_set_univ_typeclass_infos": 1, + "HeadVars3": 2, + "proc_arg_vector_set_exist_typeclass_infos": 1, + "In": 6, + "out_mode": 2, + "Out": 6, + "NumUnconstrainedUnivTVars": 2, + "NumUnconstrainedExistTVars": 2, + "NumUnivClassInfoVars": 2, + "NumExistClassInfoVars": 2, + "UnivTypeInfoModes": 2, + "ExistTypeInfoModes": 2, + "UnivTypeClassInfoModes": 2, + "ExistTypeClassInfoModes": 2, + "poly_arg_vector_set_univ_type_infos": 1, + "poly_arg_vector_set_exist_type_infos": 1, + "poly_arg_vector_set_univ_typeclass_infos": 1, + "poly_arg_vector_set_exist_typeclass_infos": 1, + "some": 4, + "ToLocn": 4, + "TheVar": 2, + "TheLocn": 2, + "list.map": 17, + "UnivTypeLocns": 2, + "list.foldl_corresponding": 3, + "rtti_det_insert_type_info_locn": 3, + "ExistTypeLocns": 2, + "UnconstrainedInstanceTypeLocns": 2, + ".RttiVarMaps": 1, + "TypeInfoHeadVars": 2, + "pred_info_get_tvar_kinds": 2, + "KindMap": 2, + "PredClassContext": 5, + "PredExistConstraints": 2, + "exist_constraints": 1, + "ExistQVarsForCall": 2, + "goal_info_get_context": 4, + "make_typeclass_info_vars": 3, + "ExistTypeClassVarsMCAs": 2, + "ExtraTypeClassGoals": 5, + "assoc_list.keys": 8, + "ExistTypeClassVars": 3, + "assign_var_list": 8, + "ExtraTypeClassUnifyGoals": 2, + "vartypes_is_empty": 1, + "PredToActualTypeSubst": 4, + "ActualArgTypes": 8, + "ArgTypeSubst": 2, + "apply_subst_to_tvar_list": 1, + "ActualTypes": 2, + "polymorphism_do_make_type_info_vars": 5, + "TypeInfoVarsMCAs": 2, + "ExtraTypeInfoGoals": 4, + "TypeInfoVars": 5, + "ExtraTypeInfoUnifyGoals": 2, + "GoalList": 8, + "conj_list_to_goal": 6, + "Var1": 5, + "Vars1": 2, + "Var2": 5, + "Vars2": 2, + "Goals": 13, + "assign_var": 3, + "true_goal": 1, + "term.context_init": 2, + "create_pure_atomic_complicated_unification": 1, + "rhs_var": 2, + "umc_explicit": 1, + "constraint_map": 1, + "NumExistConstraints": 4, + "search_hlds_constraint_list": 1, + "unproven": 3, + "goal_id": 1, + "ActualExistConstraints0": 2, + "GoalExpr0": 18, + "GoalInfo0": 41, + "generic_call": 1, + "plain_call": 5, + "ArgVars0": 23, + "polymorphism_process_call": 4, + "ExtraVars": 13, + "ExtraGoals": 13, + "ArgVars": 6, + "CallExpr": 4, + "call_args": 1, + "Call": 4, + "call_foreign_proc": 4, + "polymorphism_process_foreign_proc": 3, + "XVar": 11, + "Y": 9, + "Mode": 12, + "Unification": 16, + "UnifyContext": 15, + "polymorphism_process_unify": 4, + "conj": 5, + "ConjType": 4, + "Goals0": 13, + "plain_conj": 4, + "polymorphism_process_plain_conj": 5, + "parallel_conj": 1, + "get_cache_maps_snapshot": 11, + "InitialSnapshot": 36, + "polymorphism_process_par_conj": 5, + "GoalExpr": 19, + "disj": 2, + "polymorphism_process_disj": 6, + "set_cache_maps_snapshot": 15, + "if_then_else": 2, + "Cond0": 2, + "Then0": 2, + "Else0": 2, + "Cond": 2, + "Then": 2, + "Else": 2, + "negation": 2, + "SubGoal0": 14, + "SubGoal": 16, + "switch": 2, + "CanFail": 4, + "Cases0": 4, + "polymorphism_process_cases": 5, + "Cases": 4, + "scope": 7, + "Reason0": 16, + "from_ground_term": 2, + "TermVar": 4, + "Kind": 5, + "from_ground_term_initial": 2, + "polymorphism_process_from_ground_term_initial": 3, + "from_ground_term_construct": 1, + "from_ground_term_deconstruct": 1, + "from_ground_term_other": 1, + "promise_solutions": 1, + "promise_purity": 1, + "require_detism": 1, + "require_complete_switch": 1, + "commit": 1, + "barrier": 1, + "loop_control": 1, + "exist_quant": 1, + "trace_goal": 1, + "shorthand": 2, + "ShortHand0": 4, + "atomic_goal": 2, + "GoalType": 2, + "Outer": 2, + "Inner": 2, + "MainGoal0": 2, + "OrElseGoals0": 2, + "OrElseInners": 2, + "MainGoal": 2, + "OrElseGoals": 2, + "ShortHand": 3, + "try_goal": 2, + "MaybeIO": 2, + "ResultVar": 2, + "SubGoalExpr0": 4, + "SubGoalInfo": 2, + "Conjuncts0": 2, + "ConjunctA0": 2, + "ConjunctB0": 2, + "ConjunctA": 2, + "ConjunctB": 2, + "Conjuncts": 2, + "SubGoalExpr": 2, + "bi_implication": 1, + "hlds_goal_expr": 2, + "SubGoalInfo0": 2, + "SubGoals0Prime": 2, + "SubGoals0": 2, + "polymorphism_process_fgti_goals": 5, + "RevMarkedSubGoals": 2, + "fgt_invariants_kept": 2, + "InvariantsStatus": 7, + "Reason": 2, + "fgt_invariants_broken": 2, + "introduce_partial_fgt_scopes": 1, + "deconstruct_top_down": 1, + "fgt_marked_goal": 2, + "fgt_invariants_status": 2, + "RevMarkedGoals": 4, + "OldInfo": 3, + "XVarPrime": 2, + "ModePrime": 2, + "UnificationPrime": 2, + "UnifyContextPrime": 2, + "rhs_functor": 5, + "ConsIdPrime": 2, + "YVarsPrime": 2, + "ConsId": 10, + "YVars": 4, + "polymorphism_process_unify_functor": 4, + "Changed": 10, + "VarSetBefore": 2, + "MaxVarBefore": 2, + "varset.max_var": 2, + "poly_info_get_num_reuses": 2, + "NumReusesBefore": 2, + "VarSetAfter": 2, + "MaxVarAfter": 2, + "NumReusesAfter": 2, + "MarkedGoal": 3, + "fgt_kept_goal": 1, + "fgt_broken_goal": 1, + ".RevMarkedGoals": 1, + "unify_mode": 2, + "Unification0": 8, + "_YVar": 1, + "unification_typeinfos": 5, + "_Changed": 3, + "Args": 11, + "Purity": 9, + "Groundness": 6, + "PredOrFunc": 6, + "EvalMethod": 8, + "LambdaVars": 13, + "Modes": 4, + "Det": 4, + "LambdaGoal0": 5, + "LambdaGoal1": 2, + "fixup_lambda_quantification": 1, + "LambdaGoal": 6, + "NonLocalTypeInfos": 3, + "set_of_var.to_sorted_list": 1, + "NonLocalTypeInfosList": 2, + "Y1": 2, + "NonLocals0": 10, + "goal_info_get_nonlocals": 6, + "NonLocals": 12, + "goal_info_set_nonlocals": 6, + "type_vars": 2, + "TypeVars": 8, + "get_type_info_locn": 1, + "TypeInfoLocns": 6, + "add_unification_typeinfos": 4, + "rtti_lookup_type_info_locn": 1, + "type_info_locn": 1, + "type_info_locn_var": 1, + "TypeInfoVars0": 2, + ".GoalInfo": 1, + "set_of_var.insert_list": 4, + ".Unification": 5, + "complicated_unify": 2, + "construct": 1, + "deconstruct": 2, + "simple_test": 1, + "X0": 8, + "ConsId0": 5, + "Mode0": 4, + "TypeOfX": 6, + "Arity": 5, + "closure_cons": 1, + "ShroudedPredProcId": 2, + "ProcId0": 3, + "unshroud_pred_proc_id": 1, + "type_is_higher_order_details": 1, + "_PredOrFunc": 1, + "CalleeArgTypes": 2, + "invalid_proc_id": 1, + "goal_info_add_feature": 1, + "feature_lambda_undetermined_mode": 1, + "GoalInfo1": 6, + "VarSet0": 2, + "Functor0": 6, + "poly_info_set_varset_and_types": 1, + "cons": 3, + "ConsTypeCtor": 2, + "remove_new_prefix": 1, + "OrigFunctor": 2, + "IsConstruction": 7, + "type_util.get_existq_cons_defn": 1, + "ConsDefn": 2, + "polymorphism_process_existq_unify_functor": 3, + "UnifyExpr": 2, + "Unify": 2, + "PredArgTypes": 10, + "Functor": 6, + "create_fresh_vars": 5, + "QualifiedPName": 5, + "qualified": 1, + "cons_id_dummy_type_ctor": 1, + "RHS": 2, + "CallUnifyContext": 2, + "LambdaGoalExpr": 2, + "not_builtin": 3, + "OutsideVars": 2, + "InsideVars": 2, + "set_of_var.intersect": 1, + "LambdaNonLocals": 2, + "GoalId": 8, + "goal_info_get_goal_id": 3, + "goal_info_init": 1, + "LambdaGoalInfo0": 2, + "goal_info_set_context": 1, + "LambdaGoalInfo1": 2, + "LambdaGoalInfo2": 2, + "goal_info_set_purity": 1, + "LambdaGoalInfo3": 2, + "goal_info_set_goal_id": 1, + "LambdaGoalInfo": 4, + "lambda_modes_and_det": 4, + "LambdaModes": 6, + "LambdaDet": 6, + "pred_info_is_pred_or_func": 1, + "ho_ground": 1, + "_LambdaModes0": 1, + "_LambdaDet0": 1, + "goal_to_conj_list": 1, + "LambdaGoalList0": 2, + "list.split_last": 1, + "LambdaGoalButLast0": 2, + "LastGoal0": 2, + "LastGoalExpr0": 2, + "LastGoalInfo0": 2, + "PredId0": 2, + "_DummyProcId": 1, + "Args0": 5, + "MaybeCallUnifyContext0": 2, + "QualifiedPName0": 2, + "LambdaGoalButLast": 2, + "LastGoalInfo": 2, + "MaybeCallUnifyContext": 4, + "LastGoalExpr": 2, + "LastGoal": 2, + "prog_vars": 1, + "determinism": 1, + "NumArgModes": 2, + "NumLambdaVars": 2, + "list.drop": 2, + "LambdaModesPrime": 2, + "proc_info_get_declared_determinism": 1, + "MaybeDet": 3, + "sorry": 1, + "varset.new_var": 1, + "add_var_type": 1, + "ctor_defn": 2, + "CtorDefn": 2, + "ActualRetType": 2, + "CtorTypeVarSet": 2, + "CtorExistQVars": 2, + "CtorKindMap": 2, + "CtorExistentialConstraints": 2, + "CtorArgTypes": 2, + "CtorRetType": 2, + "TypeVarSet0": 5, + "tvarset_merge_renaming": 3, + "CtorToParentRenaming": 6, + "apply_variable_renaming_to_tvar_list": 2, + "ParentExistQVars": 6, + "apply_variable_renaming_to_tvar_kind_map": 2, + "ParentKindMap": 7, + "apply_variable_renaming_to_prog_constraint_list": 1, + "ParentExistentialConstraints": 3, + "apply_variable_renaming_to_type_list": 4, + "ParentArgTypes": 6, + "apply_variable_renaming_to_type": 1, + "ParentRetType": 2, + "poly_info_set_typevarset": 3, + "type_list_subsumes_det": 3, + "ParentToActualTypeSubst": 6, + "NumExistentialConstraints": 3, + "lookup_hlds_constraint_list": 4, + "ActualExistentialConstraints": 4, + "ExtraTypeClassVarsMCAs": 2, + "ExtraTypeClassVars": 2, + "assumed": 2, + "make_existq_typeclass_info_vars": 2, + "constraint_list_get_tvars": 3, + "ParentExistConstrainedTVars": 4, + "ParentUnconstrainedExistQVars": 2, + "apply_rec_subst_to_tvar_list": 4, + "ActualExistentialTypes": 2, + "ExtraTypeInfoVarsMCAs": 2, + "ExtraTypeInfoVars": 2, + "ExtraTypeClassVars.": 1, + "bound": 1, + "Attributes": 2, + "ProcExtraArgs": 2, + "MaybeTraceRuntimeCond": 2, + "Impl": 14, + "foreign_arg_var": 1, + "CanOptAwayUnnamed": 11, + "polymorphism_process_foreign_proc_args": 3, + "ExtraArgs": 5, + "pragma_foreign_code_impl": 4, + "foreign_arg": 1, + "PredTypeVarSet": 8, + "UnivCs": 4, + "ExistCs": 4, + "UnivVars0": 2, + "get_constrained_vars": 2, + "UnivConstrainedVars": 2, + "ExistVars0": 2, + "ExistConstrainedVars": 2, + "PredTypeVars0": 2, + "PredTypeVars1": 2, + "PredTypeVars2": 2, + "PredTypeVars": 3, + "foreign_proc_add_typeclass_info": 4, + "ExistTypeClassArgInfos": 2, + "UnivTypeClassArgInfos": 2, + "TypeClassArgInfos": 2, + "list.filter": 1, + "X": 9, + "semidet": 2, + "ExistUnconstrainedVars": 2, + "UnivUnconstrainedVars": 2, + "foreign_proc_add_typeinfo": 4, + "ExistTypeArgInfos": 2, + "UnivTypeArgInfos": 2, + "TypeInfoArgInfos": 2, + "ArgInfos": 2, + "TypeInfoTypes": 2, + "type_info_type": 1, + "UnivTypes": 2, + "ExistTypes": 2, + "OrigArgTypes": 2, + "make_foreign_args": 1, + "tvarset": 3, + "box_policy": 2, + "Constraint": 2, + "MaybeArgName": 7, + "native_if_possible": 2, + "SymName": 4, + "sym_name_to_string_sep": 1, + "TypeVarNames": 2, + "underscore_and_tvar_name": 3, + "string.append_list": 1, + "ConstraintVarName": 3, + "foreign_code_does_not_use_variable": 4, + "TVar": 4, + "varset.search_name": 1, + "TypeVarName": 2, + "C_VarName": 3, + "VarName": 2, + "foreign_code_uses_variable": 1, + "TVarName": 2, + "TVarName0": 1, + "TVarName0.": 1, + "cache_maps": 3, + "case": 4, + "Case0": 2, + "Case": 2, + "MainConsId": 2, + "OtherConsIds": 2, + "PredExistQVars": 2, + "PredKindMap": 3, + "varset.is_empty": 1, + "PredToParentTypeRenaming": 6, + "ParentTVars": 4, + "apply_variable_renaming_to_prog_constraints": 1, + "ParentClassContext": 2, + "ParentUnivConstraints": 3, + "ParentExistConstraints": 3, + "ParentUnivConstrainedTVars": 2, + "ParentUnconstrainedTVars0": 2, + "ParentUnconstrainedTVars1": 2, + "ParentUnconstrainedTVars": 3, + "ParentUnconstrainedUnivTVars": 3, + "ParentUnconstrainedExistTVars": 2, + "NumUnivConstraints": 2, + "ActualUnivConstraints": 2, + "ActualExistQVarTypes": 2, + "prog_type.type_list_to_var_list": 1, + "ActualExistQVars0": 2, + "ActualExistQVars": 2, + "ExtraUnivClassVarsMCAs": 2, + "ExtraUnivClassGoals": 2, + "ExtraUnivClassVars": 2, + "ExtraExistClassVars": 2, + "ExtraExistClassGoals": 2, + "ActualUnconstrainedUnivTypes": 2, + "ExtraUnivTypeInfoVarsMCAs": 2, + "ExtraUnivTypeInfoGoals": 2, + "ExtraUnivTypeInfoVars": 2, + "ActualUnconstrainedExistTypes": 2, + "ExtraExistTypeInfoVarsMCAs": 2, + "ExtraExistTypeInfoGoals": 2, + "ExtraExistTypeInfoVars": 2, + "CalleePredInfo": 2, + "CalleeProcInfo": 3, + "CallArgs0": 3, + "BuiltinState": 2, + "TVarSet0": 2, + "ActualArgTypes0": 3, + "PredTVarSet": 2, + "_PredExistQVars": 1, + "CalleeHeadVars": 2, + "proc_info_get_rtti_varmaps": 1, + "CalleeRttiVarMaps": 2, + "NCallArgs0": 2, + "NPredArgs": 2, + "NExtraArgs": 3, + "OrigPredArgTypes0": 2, + "list.take": 1, + "CalleeExtraHeadVars0": 2, + "OrigPredArgTypes": 2, + "CalleeExtraHeadVars": 2, + "TVarSet": 2, + "PredToParentRenaming": 3, + "OrigParentArgTypes": 2, + "ParentToActualTSubst": 2, + "GetTypeInfoTypes": 2, + "ProgVar": 2, + "TypeInfoType": 2, + "rtti_varmaps_var_info": 1, + "VarInfo": 4, + "type_info_var": 1, + "typeclass_info_var": 1, + "non_rtti_var": 1, + "PredTypeInfoTypes": 2, + "ParentTypeInfoTypes": 2, + "apply_rec_subst_to_type_list": 1, + "ActualTypeInfoTypes": 2, + "Ctxt": 2, + "ExtraArgsConstArgs": 2, + "CallArgs": 2, + "NonLocals1": 2, + "CallGoalExpr": 2, + "CallGoal": 2, + "rot13_concise.": 1, + "state": 3, + "alphabet": 3, + "cycle": 4, + "rot_n": 2, + "Char": 12, + "RotChar": 8, + "char_to_string": 1, + "CharString": 2, + "if": 15, + "sub_string_search": 1, + "Index": 3, + "then": 3, + "NewIndex": 2, + "mod": 1, + "index_det": 1, + "else": 8, + "rot13": 11, + "read_char": 1, + "Res": 8, + "ok": 3, + "print": 3, + "ErrorCode": 4, + "error_message": 1, + "ErrorMessage": 4, + "stderr_stream": 1, + "StdErr": 8, + "nl": 1, + "rot13_ralph.": 1, + "io__state": 4, + "io__read_byte": 1, + "Result": 4, + "io__write_byte": 1, + "ErrNo": 2, + "io__error_message": 2, + "z": 1, + "Rot13": 2, + "<": 14, + "rem": 1, + "rot13_verbose.": 1, + "rot13a/2": 1, + "table": 1, + "alphabetic": 2, + "characters": 1, + "their": 1, + "equivalents": 1, + "fails": 1, + "input": 1, + "not": 7, + "rot13a": 55, + "rot13/2": 1, + "Applies": 1, + "algorithm": 1, + "a": 10, + "character.": 1, + "TmpChar": 2, + "io__read_char": 1, + "io__write_char": 1, + "io__stderr_stream": 1, + "io__write_string": 2, + "io__nl": 1, + "store.": 1, + "typeclass": 1, + "store": 52, + "T": 52, + "where": 8, + "S": 133, + "instance": 4, + "io.state": 3, + "store.init": 2, + "generic_mutvar": 15, + "io_mutvar": 1, + "store_mutvar": 1, + "store.new_mutvar": 1, + "store.copy_mutvar": 1, + "store.get_mutvar": 1, + "store.set_mutvar": 1, + "<=>": 5, + "new_cyclic_mutvar": 2, + "Func": 4, + "Mutvar": 23, + "Create": 1, + "new": 25, + "variable": 1, + "whose": 2, + "initialized": 2, + "with": 5, + "returned": 1, + "from": 1, + "specified": 1, + "function": 3, + "The": 2, + "argument": 6, + "passed": 2, + "mutvar": 6, + "itself": 4, + "has": 4, + "yet": 1, + "been": 1, + "safe": 2, + "because": 1, + "does": 3, + "get": 2, + "so": 3, + "it": 1, + "can": 1, + "t": 5, + "examine": 1, + "uninitialized": 1, + "predicate": 1, + "useful": 1, + "creating": 1, + "self": 1, + "referential": 1, + "values": 1, + "such": 2, + "as": 5, + "circular": 1, + "linked": 1, + "lists": 1, + "For": 1, + "example": 1, + "clist": 2, + "node": 1, + "store.new_cyclic_mutvar": 1, + "generic_ref": 20, + "io_ref": 1, + "store_ref": 1, + "store.new_ref": 1, + "store.ref_functor": 1, + "store.arg_ref": 1, + "ArgT": 4, + "store.new_arg_ref": 3, + "store.set_ref": 1, + "store.set_ref_value": 1, + "store.copy_ref_value": 1, + "store.extract_ref_value": 1, + "Nasty": 1, + "performance": 2, + "hacks": 1, + "WARNING": 1, + "use": 1, + "of": 10, + "these": 1, + "procedures": 2, + "dangerous": 1, + "Use": 1, + "them": 1, + "last": 1, + "resort": 1, + "critical": 1, + "and": 6, + "shows": 1, + "that": 2, + "using": 1, + "versions": 1, + "bottleneck": 1, + "These": 1, + "may": 1, + "vanish": 1, + "future": 1, + "Mercury": 1, + "unsafe_arg_ref": 1, + "same": 2, + "arg_ref": 12, + "unsafe_new_arg_ref": 1, + "new_arg_ref": 1, + "except": 1, + "they": 4, + "doesn": 1, + "check": 1, + "errors": 1, + "don": 3, + "work": 3, + "no_tag": 1, + "types": 3, + "exactly": 2, + "one": 2, + "functor": 2, + "which": 2, + "arguments": 2, + "occupy": 1, + "word": 2, + "other": 1, + "functors.": 1, + "store.unsafe_arg_ref": 1, + "store.unsafe_new_arg_ref": 1, + "implementation": 1, + "require": 1, + "just": 1, + "real": 1, + "representation": 1, + "pragma": 41, + "foreign_type": 10, + "MR_Word": 24, + "can_pass_as_mercury_type": 5, + "equality": 5, + "store_equal": 7, + "comparison": 5, + "store_compare": 7, + "int32": 1, + "Java": 12, + "Erlang": 3, + "attempt": 2, + "two": 2, + "stores": 2, + "comparison_result": 1, + "compare": 1, + "Mutvars": 1, + "references": 1, + "are": 1, + "each": 1, + "represented": 1, + "pointer": 1, + "single": 1, + "on": 1, + "heap": 1, + "private_builtin.ref": 2, + "ref": 2, + "store.do_init": 6, + "foreign_proc": 28, + "_S0": 16, + "will_not_call_mercury": 28, + "will_not_modify_trail": 7, + "new_mutvar": 5, + "Val": 45, + "S0": 23, + "get_mutvar": 5, + "set_mutvar": 5, + "_S": 12, + "copy_mutvar": 1, + "Copy": 2, + "Value": 4, + "store.unsafe_new_uninitialized_mutvar": 1, + "unsafe_new_uninitialized_mutvar": 4, + "MR_offset_incr_hp_msg": 5, + "MR_SIZE_SLOT_SIZE": 10, + "1": 5, + "MR_ALLOC_ID": 5, + "2": 2, + "MR_define_size_slot": 5, + "0": 2, + "object": 21, + "MutVar": 4, + "Store": 5, + "apply": 1, + "Ref": 41, + "foreign_code": 2, + "public": 17, + "class": 4, + "Object": 9, + "referenced": 4, + "obj": 7, + "Specific": 2, + "field": 20, + "or": 2, + "null": 8, + "specify": 2, + "GetFields": 2, + "return": 6, + "fields": 3, + "any": 2, + "particular": 2, + "order": 2, + "really": 2, + "usable": 2, + "System": 1, + "Reflection": 1, + "FieldInfo": 1, + "Constructors": 2, + "init": 8, + "setField": 4, + "Set": 2, + "according": 2, + "given": 2, + "index": 2, + "void": 4, + "GetType": 1, + "reference": 4, + "getValue": 4, + "GetValue": 1, + "Update": 2, + "setValue": 2, + "SetValue": 1, + "static": 1, + "lang": 28, + "getDeclaredFields": 2, + "reflect": 1, + "Field": 5, + "try": 3, + "getClass": 1, + "catch": 11, + "SecurityException": 1, + "se": 1, + "throw": 11, + "RuntimeException": 11, + "Security": 1, + "manager": 1, + "denied": 1, + "access": 3, + "ArrayIndexOutOfBoundsException": 1, + "e": 13, + "No": 1, + "Exception": 3, + "Unable": 3, + "getMessage": 3, + "IllegalAccessException": 2, + "inaccessible": 2, + "IllegalArgumentException": 2, + "mismatch": 2, + "NullPointerException": 2, + "new_ref": 4, + "ets": 3, + "insert": 1, + "copy_ref_value": 1, + "unsafe_ref_value": 6, + "store.unsafe_ref_value": 1, + "lookup": 1, + "ref_functor": 1, + "canonicalize": 1, + "foreign_decl": 1, + "include": 4, + "mercury_type_info": 1, + "h": 4, + "mercury_heap": 1, + "mercury_misc": 1, + "MR_fatal_error": 5, + "mercury_deconstruct": 1, + "MR_arg": 3, + "ArgNum": 7, + "ArgRef": 22, + "may_not_duplicate": 1, + "MR_TypeInfo": 10, + "arg_type_info": 6, + "exp_arg_type_info": 6, + "MR_DuArgLocn": 2, + "arg_locn": 9, + "TypeInfo_for_T": 2, + "TypeInfo_for_ArgT": 2, + "MR_save_transient_registers": 2, + "MR_NONCANON_ABORT": 2, + "number": 2, + "range": 2, + "MR_compare_type_info": 2, + "MR_COMPARE_EQUAL": 2, + "wrong": 2, + "MR_restore_transient_registers": 2, + "NULL": 2, + "MR_arg_bits": 2, + "store.ref/2": 3, + "MR_arg_value": 2, + "C#": 6, + "store.Ref": 8, + "Ref.getValue": 6, + "*arg_ref": 1, + "*arg_locn": 1, + "&": 7, + "&&": 1, + "ValRef": 1, + "Ref.setValue": 3, + "ValRef.getValue": 2, + "*Ptr": 2, + "Ptr": 4, + "MR_strip_tag": 2, + "Arg": 6 + }, "Monkey": { "Strict": 1, "sample": 1, @@ -31854,6 +43852,509 @@ "&": 1, "c": 1 }, + "Moocode": { + "@program": 29, + "toy": 3, + "wind": 1, + "this.wound": 8, + "+": 39, + ";": 505, + "player": 2, + "tell": 1, + "(": 600, + "this.name": 4, + ")": 593, + "player.location": 1, + "announce": 1, + "player.name": 1, + ".": 30, + "while": 15, + "read": 1, + "endwhile": 14, + "I": 1, + "M": 1, + "P": 1, + "O": 1, + "R": 1, + "T": 2, + "A": 1, + "N": 1, + "The": 2, + "following": 2, + "code": 43, + "cannot": 1, + "be": 1, + "used": 1, + "as": 28, + "is.": 1, + "You": 1, + "will": 1, + "need": 1, + "to": 1, + "rewrite": 1, + "functionality": 1, + "that": 3, + "is": 6, + "not": 2, + "present": 1, + "in": 43, + "your": 1, + "server/core.": 1, + "most": 1, + "straight": 1, + "-": 98, + "forward": 1, + "target": 7, + "other": 1, + "than": 1, + "Stunt/Improvise": 1, + "a": 12, + "server/core": 1, + "provides": 1, + "map": 5, + "datatype": 1, + "and": 1, + "anonymous": 1, + "objects.": 1, + "Installation": 1, + "my": 1, + "server": 1, + "uses": 1, + "the": 4, + "object": 1, + "numbers": 1, + "#36819": 1, + "MOOcode": 4, + "Experimental": 2, + "Language": 2, + "Package": 2, + "#36820": 1, + "Changelog": 1, + "#36821": 1, + "Dictionary": 1, + "#36822": 1, + "Compiler": 2, + "#38128": 1, + "Syntax": 4, + "Tree": 1, + "Pretty": 1, + "Printer": 1, + "#37644": 1, + "Tokenizer": 2, + "Prototype": 25, + "#37645": 1, + "Parser": 2, + "#37648": 1, + "Symbol": 2, + "#37649": 1, + "Literal": 1, + "#37650": 1, + "Statement": 8, + "#37651": 1, + "Operator": 11, + "#37652": 1, + "Control": 1, + "Flow": 1, + "#37653": 1, + "Assignment": 2, + "#38140": 1, + "Compound": 1, + "#38123": 1, + "Prefix": 1, + "#37654": 1, + "Infix": 1, + "#37655": 1, + "Name": 1, + "#37656": 1, + "Bracket": 1, + "#37657": 1, + "Brace": 1, + "#37658": 1, + "If": 1, + "#38119": 1, + "For": 1, + "#38120": 1, + "Loop": 1, + "#38126": 1, + "Fork": 1, + "#38127": 1, + "Try": 1, + "#37659": 1, + "Invocation": 1, + "#37660": 1, + "Verb": 1, + "Selector": 2, + "#37661": 1, + "Property": 1, + "#38124": 1, + "Error": 1, + "Catching": 1, + "#38122": 1, + "Positional": 1, + "#38141": 1, + "From": 1, + "#37662": 1, + "Utilities": 1, + "#36823": 1, + "Tests": 4, + "#36824": 1, + "#37646": 1, + "#37647": 1, + "parent": 1, + "plastic.tokenizer_proto": 4, + "_": 4, + "_ensure_prototype": 4, + "application/x": 27, + "moocode": 27, + "typeof": 11, + "this": 114, + "OBJ": 3, + "||": 19, + "raise": 23, + "E_INVARG": 3, + "_ensure_instance": 7, + "ANON": 2, + "plastic.compiler": 3, + "_lookup": 2, + "private": 1, + "{": 112, + "name": 9, + "}": 112, + "args": 26, + "if": 90, + "value": 73, + "this.variable_map": 3, + "[": 99, + "]": 102, + "E_RANGE": 17, + "return": 61, + "else": 45, + "tostr": 51, + "random": 3, + "this.reserved_names": 1, + "endif": 93, + "compile": 1, + "source": 32, + "options": 3, + "tokenizer": 6, + "this.plastic.tokenizer_proto": 2, + "create": 16, + "parser": 89, + "this.plastic.parser_proto": 2, + "compiler": 2, + "try": 2, + "statements": 13, + "except": 2, + "ex": 4, + "ANY": 3, + ".tokenizer.row": 1, + "endtry": 2, + "for": 31, + "statement": 29, + "statement.type": 10, + "@source": 3, + "p": 82, + "@compiler": 1, + "endfor": 31, + "ticks_left": 4, + "<": 13, + "seconds_left": 4, + "&&": 39, + "suspend": 4, + "statement.value": 20, + "elseif": 41, + "_generate": 1, + "isa": 21, + "this.plastic.sign_operator_proto": 1, + "|": 9, + "statement.first": 18, + "statement.second": 13, + "this.plastic.control_flow_statement_proto": 1, + "first": 22, + "statement.id": 3, + "this.plastic.if_statement_proto": 1, + "s": 47, + "respond_to": 9, + "@code": 28, + "@this": 13, + "i": 29, + "length": 11, + "LIST": 6, + "this.plastic.for_statement_proto": 1, + "statement.subtype": 2, + "this.plastic.loop_statement_proto": 1, + "prefix": 4, + "this.plastic.fork_statement_proto": 1, + "this.plastic.try_statement_proto": 1, + "x": 9, + "@x": 3, + "join": 6, + "this.plastic.assignment_operator_proto": 1, + "statement.first.type": 1, + "res": 19, + "rest": 3, + "v": 17, + "statement.first.value": 1, + "v.type": 2, + "v.first": 2, + "v.second": 1, + "this.plastic.bracket_operator_proto": 1, + "statement.third": 4, + "this.plastic.brace_operator_proto": 1, + "this.plastic.invocation_operator_proto": 1, + "@a": 2, + "statement.second.type": 2, + "this.plastic.property_selector_operator_proto": 1, + "this.plastic.error_catching_operator_proto": 1, + "second": 18, + "this.plastic.literal_proto": 1, + "toliteral": 1, + "this.plastic.positional_symbol_proto": 1, + "this.plastic.prefix_operator_proto": 3, + "this.plastic.infix_operator_proto": 1, + "this.plastic.traditional_ternary_operator_proto": 1, + "this.plastic.name_proto": 1, + "plastic.printer": 2, + "_print": 4, + "indent": 4, + "result": 7, + "item": 2, + "@result": 2, + "E_PROPNF": 1, + "print": 1, + "instance": 59, + "instance.row": 1, + "instance.column": 1, + "instance.source": 1, + "advance": 16, + "this.token": 21, + "this.source": 3, + "row": 23, + "this.row": 2, + "column": 63, + "this.column": 2, + "eol": 5, + "block_comment": 6, + "inline_comment": 4, + "loop": 14, + "len": 3, + "continue": 16, + "next_two": 4, + "column..column": 1, + "c": 44, + "break": 6, + "re": 1, + "not.": 1, + "Worse": 1, + "*": 4, + "valid": 2, + "error": 6, + "like": 4, + "E_PERM": 4, + "treated": 2, + "literal": 2, + "an": 2, + "invalid": 2, + "E_FOO": 1, + "variable.": 1, + "Any": 1, + "starts": 1, + "with": 1, + "characters": 1, + "*now*": 1, + "but": 1, + "errors": 1, + "are": 1, + "errors.": 1, + "*/": 1, + "<=>": 8, + "z": 4, + "col1": 6, + "mark": 2, + "start": 2, + "1": 13, + "9": 4, + "col2": 4, + "chars": 21, + "index": 2, + "E_": 1, + "token": 24, + "type": 9, + "this.errors": 1, + "col1..col2": 2, + "toobj": 1, + "float": 4, + "0": 1, + "cc": 1, + "e": 1, + "tofloat": 1, + "toint": 1, + "esc": 1, + "q": 1, + "col1..column": 1, + "plastic.parser_proto": 3, + "@options": 1, + "instance.tokenizer": 1, + "instance.symbols": 1, + "plastic": 1, + "this.plastic": 1, + "symbol": 65, + "plastic.name_proto": 1, + "plastic.literal_proto": 1, + "plastic.operator_proto": 10, + "plastic.prefix_operator_proto": 1, + "plastic.error_catching_operator_proto": 3, + "plastic.assignment_operator_proto": 1, + "plastic.compound_assignment_operator_proto": 5, + "plastic.traditional_ternary_operator_proto": 2, + "plastic.infix_operator_proto": 13, + "plastic.sign_operator_proto": 2, + "plastic.bracket_operator_proto": 1, + "plastic.brace_operator_proto": 1, + "plastic.control_flow_statement_proto": 3, + "plastic.if_statement_proto": 1, + "plastic.for_statement_proto": 1, + "plastic.loop_statement_proto": 2, + "plastic.fork_statement_proto": 1, + "plastic.try_statement_proto": 1, + "plastic.from_statement_proto": 2, + "plastic.verb_selector_operator_proto": 2, + "plastic.property_selector_operator_proto": 2, + "plastic.invocation_operator_proto": 1, + "id": 14, + "bp": 3, + "proto": 4, + "nothing": 1, + "this.plastic.symbol_proto": 2, + "this.symbols": 4, + "clone": 2, + "this.token.type": 1, + "this.token.value": 1, + "this.token.eol": 1, + "operator": 1, + "variable": 1, + "identifier": 1, + "keyword": 1, + "Unexpected": 1, + "end": 2, + "Expected": 1, + "t": 1, + "call": 1, + "nud": 2, + "on": 1, + "@definition": 1, + "new": 4, + "pop": 4, + "delete": 1, + "plastic.utilities": 6, + "suspend_if_necessary": 4, + "parse_map_sequence": 1, + "separator": 6, + "infix": 3, + "terminator": 6, + "symbols": 7, + "ids": 6, + "@ids": 2, + "push": 3, + "@symbol": 2, + ".id": 13, + "key": 7, + "expression": 19, + "@map": 1, + "parse_list_sequence": 2, + "list": 3, + "@list": 1, + "validate_scattering_pattern": 1, + "pattern": 5, + "state": 8, + "element": 1, + "element.type": 3, + "element.id": 2, + "element.first.type": 2, + "children": 4, + "node": 3, + "node.value": 1, + "@children": 1, + "match": 1, + "root": 2, + "keys": 3, + "matches": 3, + "stack": 4, + "next": 2, + "top": 5, + "@stack": 2, + "top.": 1, + "@matches": 1, + "plastic.symbol_proto": 2, + "opts": 2, + "instance.id": 1, + "instance.value": 1, + "instance.bp": 1, + "k": 3, + "instance.": 1, + "parents": 3, + "ancestor": 2, + "ancestors": 1, + "property": 1, + "properties": 1, + "this.type": 8, + "this.first": 8, + "import": 8, + "this.second": 7, + "left": 2, + "this.third": 3, + "sequence": 2, + "led": 4, + "this.bp": 2, + "second.type": 2, + "make_identifier": 4, + "first.id": 1, + "parser.symbols": 2, + "reserve_keyword": 2, + "this.plastic.utilities": 1, + "third": 4, + "third.id": 2, + "second.id": 1, + "std": 1, + "reserve_statement": 1, + "types": 7, + ".type": 1, + "target.type": 3, + "target.value": 3, + "target.id": 4, + "temp": 4, + "temp.id": 1, + "temp.first.id": 1, + "temp.first.type": 2, + "temp.second.type": 1, + "temp.first": 2, + "imports": 5, + "import.type": 2, + "@imports": 2, + "parser.plastic.invocation_operator_proto": 1, + "temp.type": 1, + "parser.plastic.name_proto": 2, + "temp.first.value": 1, + "temp.second": 1, + "first.type": 1, + "parser.imports": 2, + "import.id": 2, + "parser.plastic.assignment_operator_proto": 1, + "result.type": 1, + "result.first": 1, + "result.second": 1, + "@verb": 1, + "do_the_work": 3, + "none": 1, + "object_utils": 1, + "this.location": 3, + "room": 1, + "announce_all": 2, + "continue_msg": 1, + "fork": 1, + "endfork": 1, + "wind_down_msg": 1 + }, "MoonScript": { "types": 2, "require": 5, @@ -32128,6 +44629,40 @@ "arg_list": 1, "Value": 1 }, + "MTML": { + "<$mt:Var>": 15, + "name=": 19, + "value=": 9, + "": 1, + "op=": 8, + "setvar=": 9, + "": 1, + "<": 2, + "a": 1, + "href": 1, + "<$mt:CategoryLabel>": 1, + "remove_html=": 1, + "": 1, + "": 1, + "": 1, + "function=": 1, + "": 1, + "gt=": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 2, + "from=": 2, + "to=": 2, + "div": 1, + "class": 1, + "col_num": 1, + "": 2, + "": 1 + }, "Nemerle": { "using": 1, "System.Console": 1, @@ -35469,6 +48004,756 @@ "indexPathWithIndexes": 1, "indexAtPosition": 2 }, + "Objective-C++": { + "#include": 26, + "": 1, + "": 1, + "#if": 10, + "(": 612, + "defined": 1, + "OBJC_API_VERSION": 2, + ")": 610, + "&&": 12, + "static": 16, + "inline": 3, + "IMP": 4, + "method_setImplementation": 2, + "Method": 2, + "m": 3, + "i": 29, + "{": 151, + "oi": 2, + "-": 175, + "method_imp": 2, + ";": 494, + "return": 149, + "}": 148, + "#endif": 19, + "namespace": 1, + "WebCore": 1, + "ENABLE": 10, + "DRAG_SUPPORT": 7, + "const": 16, + "double": 1, + "EventHandler": 30, + "TextDragDelay": 1, + "RetainPtr": 4, + "": 4, + "&": 21, + "currentNSEventSlot": 6, + "DEFINE_STATIC_LOCAL": 1, + "event": 30, + "NSEvent": 21, + "*EventHandler": 2, + "currentNSEvent": 13, + ".get": 1, + "class": 14, + "CurrentEventScope": 14, + "WTF_MAKE_NONCOPYABLE": 1, + "public": 1, + "*": 34, + "private": 1, + "m_savedCurrentEvent": 3, + "#ifndef": 3, + "NDEBUG": 2, + "m_event": 3, + "*event": 11, + "ASSERT": 13, + "bool": 26, + "wheelEvent": 5, + "Page*": 7, + "page": 33, + "m_frame": 24, + "if": 104, + "false": 40, + "scope": 6, + "PlatformWheelEvent": 2, + "chrome": 8, + "platformPageClient": 4, + "handleWheelEvent": 2, + "wheelEvent.isAccepted": 1, + "PassRefPtr": 2, + "": 1, + "currentKeyboardEvent": 1, + "[": 268, + "NSApp": 5, + "currentEvent": 2, + "]": 266, + "switch": 4, + "type": 10, + "case": 25, + "NSKeyDown": 4, + "PlatformKeyboardEvent": 6, + "platformEvent": 2, + "platformEvent.disambiguateKeyDownEvent": 1, + "RawKeyDown": 1, + "KeyboardEvent": 2, + "create": 3, + "document": 6, + "defaultView": 2, + "NSKeyUp": 3, + "default": 3, + "keyEvent": 2, + "BEGIN_BLOCK_OBJC_EXCEPTIONS": 13, + "||": 18, + "END_BLOCK_OBJC_EXCEPTIONS": 13, + "void": 18, + "focusDocumentView": 1, + "FrameView*": 7, + "frameView": 4, + "view": 28, + "NSView": 14, + "*documentView": 1, + "documentView": 2, + "focusNSView": 1, + "focusController": 1, + "setFocusedFrame": 1, + "passWidgetMouseDownEventToWidget": 3, + "MouseEventWithHitTestResults": 7, + "RenderObject*": 2, + "target": 6, + "targetNode": 3, + "renderer": 7, + "isWidget": 2, + "passMouseDownEventToWidget": 3, + "toRenderWidget": 3, + "widget": 18, + "RenderWidget*": 1, + "renderWidget": 2, + "lastEventIsMouseUp": 2, + "*currentEventAfterHandlingMouseDown": 1, + "currentEventAfterHandlingMouseDown": 3, + "NSLeftMouseUp": 3, + "timestamp": 8, + "Widget*": 3, + "pWidget": 2, + "RefPtr": 1, + "": 1, + "LOG_ERROR": 1, + "true": 29, + "platformWidget": 6, + "*nodeView": 1, + "nodeView": 9, + "superview": 5, + "*view": 4, + "hitTest": 2, + "convertPoint": 2, + "locationInWindow": 4, + "fromView": 3, + "nil": 25, + "client": 3, + "firstResponder": 1, + "clickCount": 8, + "<=>": 1, + "1": 1, + "acceptsFirstResponder": 1, + "needsPanelToBecomeKey": 1, + "makeFirstResponder": 1, + "wasDeferringLoading": 3, + "defersLoading": 1, + "setDefersLoading": 2, + "m_sendingEventToSubview": 24, + "*outerView": 1, + "getOuterView": 1, + "beforeMouseDown": 1, + "outerView": 2, + "widget.get": 2, + "mouseDown": 2, + "afterMouseDown": 1, + "m_mouseDownView": 5, + "m_mouseDownWasInSubframe": 7, + "m_mousePressed": 2, + "findViewInSubviews": 3, + "*superview": 1, + "*target": 1, + "NSEnumerator": 1, + "*e": 1, + "subviews": 1, + "objectEnumerator": 1, + "*subview": 1, + "while": 4, + "subview": 3, + "e": 1, + "nextObject": 1, + "mouseDownViewIfStillGood": 3, + "*mouseDownView": 1, + "mouseDownView": 3, + "topFrameView": 3, + "*topView": 1, + "topView": 2, + "eventLoopHandleMouseDragged": 1, + "mouseDragged": 2, + "//": 7, + "eventLoopHandleMouseUp": 1, + "mouseUp": 2, + "passSubframeEventToSubframe": 4, + "Frame*": 5, + "subframe": 13, + "HitTestResult*": 2, + "hoveredNode": 5, + "NSLeftMouseDragged": 1, + "NSOtherMouseDragged": 1, + "NSRightMouseDragged": 1, + "dragController": 1, + "didInitiateDrag": 1, + "NSMouseMoved": 2, + "eventHandler": 6, + "handleMouseMoveEvent": 3, + "currentPlatformMouseEvent": 8, + "NSLeftMouseDown": 3, + "Node*": 1, + "node": 3, + "isFrameView": 2, + "handleMouseReleaseEvent": 3, + "originalNSScrollViewScrollWheel": 4, + "_nsScrollViewScrollWheelShouldRetainSelf": 3, + "selfRetainingNSScrollViewScrollWheel": 3, + "NSScrollView": 2, + "SEL": 2, + "nsScrollViewScrollWheelShouldRetainSelf": 2, + "isMainThread": 3, + "setNSScrollViewScrollWheelShouldRetainSelf": 3, + "shouldRetain": 2, + "method": 2, + "class_getInstanceMethod": 1, + "objc_getRequiredClass": 1, + "@selector": 4, + "scrollWheel": 2, + "reinterpret_cast": 1, + "": 1, + "*self": 1, + "selector": 2, + "shouldRetainSelf": 3, + "self": 70, + "retain": 1, + "release": 1, + "passWheelEventToWidget": 1, + "NSView*": 1, + "static_cast": 1, + "": 1, + "frame": 3, + "NSScrollWheel": 1, + "v": 6, + "loader": 1, + "resetMultipleFormSubmissionProtection": 1, + "handleMousePressEvent": 2, + "int": 36, + "%": 2, + "handleMouseDoubleClickEvent": 1, + "else": 11, + "sendFakeEventsAfterWidgetTracking": 1, + "*initiatingEvent": 1, + "eventType": 5, + "initiatingEvent": 22, + "*fakeEvent": 1, + "fakeEvent": 6, + "mouseEventWithType": 2, + "location": 3, + "modifierFlags": 6, + "windowNumber": 6, + "context": 6, + "eventNumber": 3, + "pressure": 3, + "postEvent": 3, + "atStart": 3, + "YES": 6, + "keyEventWithType": 1, + "characters": 3, + "charactersIgnoringModifiers": 2, + "isARepeat": 2, + "keyCode": 2, + "window": 1, + "convertScreenToBase": 1, + "mouseLocation": 1, + "mouseMoved": 2, + "frameHasPlatformWidget": 4, + "passMousePressEventToSubframe": 1, + "mev": 6, + "mev.event": 3, + "passMouseMoveEventToSubframe": 1, + "m_mouseDownMayStartDrag": 1, + "passMouseReleaseEventToSubframe": 1, + "PlatformMouseEvent": 5, + "*windowView": 1, + "windowView": 2, + "CONTEXT_MENUS": 2, + "sendContextMenuEvent": 2, + "eventMayStartDrag": 2, + "eventActivatedView": 1, + "m_activationEventNumber": 1, + "event.eventNumber": 1, + "": 1, + "createDraggingClipboard": 1, + "NSPasteboard": 2, + "*pasteboard": 1, + "pasteboardWithName": 1, + "NSDragPboard": 1, + "pasteboard": 2, + "declareTypes": 1, + "NSArray": 3, + "array": 2, + "owner": 15, + "ClipboardMac": 1, + "Clipboard": 1, + "DragAndDrop": 1, + "ClipboardWritable": 1, + "tabsToAllFormControls": 1, + "KeyboardEvent*": 1, + "KeyboardUIMode": 1, + "keyboardUIMode": 5, + "handlingOptionTab": 4, + "isKeyboardOptionTab": 1, + "KeyboardAccessTabsToLinks": 2, + "KeyboardAccessFull": 1, + "needsKeyboardEventDisambiguationQuirks": 2, + "Document*": 1, + "applicationIsSafari": 1, + "url": 2, + ".protocolIs": 2, + "Settings*": 1, + "settings": 5, + "DASHBOARD_SUPPORT": 1, + "usesDashboardBackwardCompatibilityMode": 1, + "unsigned": 2, + "accessKeyModifiers": 1, + "AXObjectCache": 1, + "accessibilityEnhancedUserInterfaceEnabled": 1, + "CtrlKey": 2, + "|": 3, + "AltKey": 1, + "#import": 3, + "": 1, + "": 1, + "#ifdef": 6, + "OODEBUG": 1, + "#define": 1, + "OODEBUG_SQL": 4, + "OOOODatabase": 1, + "OODB": 1, + "NSString": 25, + "*kOOObject": 1, + "@": 28, + "*kOOInsert": 1, + "*kOOUpdate": 1, + "*kOOExecSQL": 1, + "#pragma": 5, + "mark": 5, + "OORecord": 3, + "abstract": 1, + "superclass": 1, + "for": 14, + "records": 1, + "@implementation": 7, + "+": 55, + "id": 19, + "record": 18, + "OO_AUTORETURNS": 2, + "OO_AUTORELEASE": 3, + "alloc": 11, + "init": 4, + "insert": 7, + "*record": 4, + "insertWithParent": 1, + "parent": 10, + "OODatabase": 26, + "sharedInstance": 37, + "copyJoinKeysFrom": 1, + "to": 6, + "delete": 4, + "update": 4, + "indate": 4, + "upsert": 4, + "commit": 6, + "rollback": 5, + "setNilValueForKey": 1, + "key": 2, + "OOReference": 2, + "": 1, + "zeroForNull": 4, + "NSNumber": 4, + "numberWithInt": 1, + "setValue": 1, + "forKey": 1, + "OOArray": 16, + "": 14, + "select": 21, + "intoClass": 11, + "joinFrom": 10, + "cOOString": 15, + "sql": 21, + "selectRecordsRelatedTo": 1, + "importFrom": 1, + "OOFile": 4, + "file": 2, + "delimiter": 4, + "delim": 4, + "rows": 2, + "OOMetaData": 21, + "import": 1, + "file.string": 1, + "insertArray": 3, + "BOOL": 11, + "exportTo": 1, + "file.save": 1, + "export": 1, + "bindToView": 1, + "OOView": 2, + "delegate": 4, + "bindRecord": 1, + "toView": 1, + "updateFromView": 1, + "updateRecord": 1, + "description": 6, + "*metaData": 14, + "metaDataForClass": 3, + "hack": 1, + "required": 2, + "where": 1, + "contains": 1, + "a": 9, + "field": 1, + "avoid": 1, + "recursion": 1, + "OOStringArray": 6, + "ivars": 5, + "<<": 2, + "metaData": 26, + "encode": 3, + "dictionaryWithValuesForKeys": 3, + "@end": 14, + "OOAdaptor": 6, + "all": 3, + "methods": 1, + "by": 1, + "objsql": 1, + "access": 2, + "database": 12, + "@interface": 6, + "NSObject": 1, + "sqlite3": 1, + "*db": 1, + "sqlite3_stmt": 1, + "*stmt": 1, + "struct": 5, + "_str_link": 5, + "*next": 2, + "char": 9, + "str": 7, + "*strs": 1, + "OO_UNSAFE": 1, + "*owner": 3, + "initPath": 5, + "path": 9, + "prepare": 4, + "bindCols": 5, + "cOOStringArray": 3, + "columns": 7, + "values": 29, + "cOOValueDictionary": 2, + "startingAt": 5, + "pno": 13, + "bindNulls": 8, + "bindResultsIntoInstancesOfClass": 4, + "Class": 9, + "recordClass": 16, + "sqlite_int64": 2, + "lastInsertRowID": 2, + "NSData": 3, + "OOExtras": 9, + "initWithDescription": 1, + "is": 2, + "the": 5, + "low": 1, + "level": 1, + "interface": 1, + "particular": 2, + "": 1, + "sharedInstanceForPath": 2, + "OODocument": 1, + ".path": 1, + "OONil": 1, + "OO_RELEASE": 6, + "exec": 10, + "fmt": 9, + "...": 3, + "va_list": 3, + "argp": 12, + "va_start": 3, + "*sql": 5, + "initWithFormat": 3, + "arguments": 3, + "va_end": 3, + "objects": 4, + "deleteArray": 2, + "object": 13, + "commitTransaction": 3, + "super": 3, + "adaptor": 1, + "registerSubclassesOf": 1, + "recordSuperClass": 2, + "numClasses": 5, + "objc_getClassList": 2, + "NULL": 4, + "*classes": 2, + "malloc": 2, + "sizeof": 2, + "": 1, + "viewClasses": 4, + "classNames": 4, + "scan": 1, + "registered": 2, + "classes": 12, + "relevant": 1, + "subclasses": 1, + "c": 14, + "<": 5, + "superClass": 5, + "class_getName": 4, + "class_getSuperclass": 1, + "respondsToSelector": 2, + "ooTableSql": 1, + "tableMetaDataForClass": 8, + "break": 6, + "delay": 1, + "creation": 1, + "views": 1, + "until": 1, + "after": 1, + "tables": 1, + "": 1, + "in": 9, + "order": 1, + "free": 3, + "Register": 1, + "list": 1, + "of": 2, + "before": 1, + "using": 2, + "them": 2, + "so": 2, + "can": 1, + "determine": 1, + "relationships": 1, + "between": 1, + "registerTableClassesNamed": 1, + "tableClass": 2, + "NSBundle": 1, + "mainBundle": 1, + "classNamed": 1, + "Send": 1, + "any": 2, + "SQL": 1, + "Sql": 1, + "format": 1, + "string": 1, + "escape": 1, + "Any": 1, + "results": 3, + "returned": 1, + "are": 1, + "placed": 1, + "as": 1, + "an": 1, + "dictionary": 1, + "results.": 1, + "*/": 1, + "errcode": 12, + "OOString": 6, + "stringForSql": 2, + "*aColumnName": 1, + "**results": 1, + "allKeys": 1, + "objectAtIndex": 1, + "OOValueDictionary": 5, + "joinValues": 4, + "sharedColumns": 5, + "*parentMetaData": 1, + "parentMetaData": 2, + "naturalJoinTo": 1, + "joinableColumns": 1, + "whereClauseFor": 2, + "qualifyNulls": 2, + "NO": 3, + "ooOrderBy": 2, + "OOFormat": 5, + "NSLog": 4, + "*joinValues": 1, + "*adaptor": 7, + "": 1, + "tablesRelatedByNaturalJoinFrom": 1, + "tablesWithNaturalJoin": 5, + "**tablesWithNaturalJoin": 1, + "*childMetaData": 1, + "tableMetaDataByClassName": 3, + "prepareSql": 1, + "toTable": 1, + "childMetaData": 1, + "OODictionary": 2, + "": 1, + "tmpResults": 1, + "kOOExecSQL": 1, + "*exec": 2, + "OOWarn": 9, + "errmsg": 5, + "continue": 3, + "OORef": 2, + "": 1, + "*values": 3, + "kOOObject": 3, + "isInsert": 4, + "kOOInsert": 1, + "isUpdate": 5, + "kOOUpdate": 2, + "newValues": 3, + "changedCols": 4, + "*name": 4, + "*newValues": 1, + "name": 9, + "isEqual": 1, + "tableName": 4, + "columns/": 1, + "nchanged": 4, + "*object": 1, + "lastSQL": 4, + "**changedCols": 1, + "quote": 2, + "commaQuote": 2, + "": 1, + "commited": 2, + "updateCount": 2, + "transaction": 2, + "updated": 2, + "NSMutableDictionary": 1, + "*d": 1, + "*transaction": 1, + "d": 2, + "": 1, + "OO_ARC": 1, + "boxed": 1, + "valueForKey": 1, + "pointerValue": 1, + "setValuesForKeysWithDictionary": 2, + "decode": 2, + "count": 1, + "className": 3, + "createTableSQL": 2, + "*idx": 1, + "indexes": 1, + "idx": 2, + "implements": 1, + ".directory": 1, + ".mkdir": 1, + "sqlite3_open": 1, + "db": 8, + "SQLITE_OK": 6, + "*path": 1, + "sqlite3_prepare_v2": 1, + "stmt": 20, + "sqlite3_errmsg": 3, + "bindValue": 2, + "value": 26, + "asParameter": 2, + "OODEBUG_BIND": 1, + "OONull": 3, + "sqlite3_bind_null": 1, + "OOSQL_THREAD_SAFE_BUT_USES_MORE_MEMORY": 1, + "isKindOfClass": 3, + "sqlite3_bind_text": 2, + "UTF8String": 1, + "SQLITE_STATIC": 3, + "#else": 1, + "len": 4, + "lengthOfBytesUsingEncoding": 1, + "NSUTF8StringEncoding": 3, + "*str": 2, + "next": 3, + "strs": 6, + "getCString": 1, + "maxLength": 1, + "encoding": 2, + "sqlite3_bind_blob": 1, + "bytes": 5, + "length": 4, + "*type": 1, + "objCType": 1, + "sqlite3_bind_int": 1, + "intValue": 3, + "sqlite3_bind_int64": 1, + "longLongValue": 1, + "sqlite3_bind_double": 1, + "doubleValue": 1, + "*columns": 1, + "valuesForNextRow": 2, + "ncols": 2, + "sqlite3_column_count": 1, + "sqlite3_column_name": 1, + "sqlite3_column_type": 2, + "SQLITE_NULL": 1, + "SQLITE_INTEGER": 1, + "initWithLongLong": 1, + "sqlite3_column_int64": 1, + "SQLITE_FLOAT": 1, + "initWithDouble": 1, + "sqlite3_column_double": 1, + "SQLITE_TEXT": 1, + "*bytes": 2, + "sqlite3_column_text": 1, + "NSMutableString": 1, + "initWithBytes": 2, + "sqlite3_column_bytes": 2, + "SQLITE_BLOB": 1, + "sqlite3_column_blob": 1, + "out": 4, + "awakeFromDB": 4, + "instancesRespondToSelector": 1, + "sqlite3_step": 1, + "SQLITE_ROW": 1, + "SQLITE_DONE": 1, + "out.alloc": 1, + "sqlite3_changes": 1, + "sqlite3_finalize": 1, + "sqlite3_last_insert_rowid": 1, + "dealloc": 1, + "sqlite3_close": 1, + "OO_DEALLOC": 1, + "instances": 1, + "represent": 1, + "table": 1, + "and": 2, + "it": 2, + "s": 2, + "l": 1, + "C": 1, + "S": 1, + "I": 1, + "L": 1, + "q": 1, + "Q": 1, + "f": 1, + "_": 2, + "tag": 1, + "A": 2, + "<'>": 1, + "iptr": 4, + "*optr": 1, + "unhex": 2, + "*iptr": 1, + "*16": 1, + "hex": 1, + "initWithBytesNoCopy": 1, + "optr": 1, + "freeWhenDone": 1, + "stringValue": 4, + "charValue": 1, + "shortValue": 1, + "OOReplace": 2, + "reformat": 4, + "NSDictionary": 2, + "__IPHONE_OS_VERSION_MIN_REQUIRED": 1, + "UISwitch": 2, + "text": 1, + "self.on": 1 + }, "OCaml": { "{": 11, "shared": 1, @@ -36060,6 +49345,278 @@ "there": 1, "it": 1 }, + "Ox": { + "#include": 2, + "Kapital": 4, + "(": 119, + "L": 2, + "const": 4, + "N": 5, + "entrant": 8, + "exit": 2, + "KP": 14, + ")": 119, + "{": 22, + "StateVariable": 1, + ";": 91, + "this.entrant": 1, + "this.exit": 1, + "this.KP": 1, + "actual": 2, + "Kbar*vals/": 1, + "-": 31, + "upper": 3, + "log": 2, + ".Inf": 2, + "}": 22, + "Transit": 1, + "FeasA": 2, + "decl": 3, + "ent": 5, + "CV": 7, + "stayout": 3, + "[": 25, + "]": 25, + "exit.pos": 1, + "tprob": 5, + "sigu": 2, + "SigU": 2, + "if": 5, + "v": 2, + "&&": 1, + "return": 10, + "<0>": 1, + "ones": 1, + "probn": 2, + "Kbe": 2, + "/sigu": 1, + "Kb0": 2, + "+": 14, + "Kb2": 2, + "*upper": 1, + "/": 1, + "vals": 1, + "tprob.*": 1, + "zeros": 4, + ".*stayout": 1, + "FirmEntry": 6, + "Run": 1, + "Initialize": 3, + "GenerateSample": 2, + "BDP": 2, + "BayesianDP": 1, + "Rust": 1, + "Reachable": 2, + "sige": 2, + "new": 19, + "StDeviations": 1, + "<0.3,0.3>": 1, + "LaggedAction": 1, + "d": 2, + "array": 1, + "Kparams": 1, + "Positive": 4, + "Free": 1, + "Kb1": 1, + "Determined": 1, + "EndogenousStates": 1, + "K": 3, + "KN": 1, + "SetDelta": 1, + "Probability": 1, + "kcoef": 3, + "ecost": 3, + "Negative": 1, + "CreateSpaces": 1, + "Volume": 3, + "LOUD": 1, + "EM": 4, + "ValueIteration": 1, + "//": 17, + "Solve": 1, + "data": 4, + "DataSet": 1, + "Simulate": 1, + "DataN": 1, + "DataT": 1, + "FALSE": 1, + "Print": 1, + "ImaiJainChing": 1, + "delta": 1, + "*CV": 2, + "Utility": 1, + "u": 2, + "ent*CV": 1, + "*AV": 1, + "|": 1, + "ParallelObjective": 1, + "obj": 18, + "DONOTUSECLIENT": 2, + "isclass": 1, + "obj.p2p": 2, + "oxwarning": 1, + "obj.L": 1, + "P2P": 2, + "ObjClient": 4, + "ObjServer": 7, + "this.obj": 2, + "Execute": 4, + "basetag": 2, + "STOP_TAG": 1, + "iml": 1, + "obj.NvfuncTerms": 2, + "Nparams": 6, + "obj.nstruct": 2, + "Loop": 2, + "nxtmsgsz": 2, + "//free": 1, + "param": 1, + "length": 1, + "is": 1, + "no": 2, + "greater": 1, + "than": 1, + "QUIET": 2, + "println": 2, + "ID": 2, + "Server": 1, + "Recv": 1, + "ANY_TAG": 1, + "//receive": 1, + "the": 1, + "ending": 1, + "parameter": 1, + "vector": 1, + "Encode": 3, + "Buffer": 8, + "//encode": 1, + "it.": 1, + "Decode": 1, + "obj.nfree": 1, + "obj.cur.V": 1, + "vfunc": 2, + "CstrServer": 3, + "SepServer": 3, + "Lagrangian": 1, + "rows": 1, + "obj.cur": 1, + "Vec": 1, + "obj.Kvar.v": 1, + "imod": 1, + "Tag": 1, + "obj.K": 1, + "TRUE": 1, + "obj.Kvar": 1, + "PDF": 1, + "*": 5, + "nldge": 1, + "ParticleLogLikeli": 1, + "it": 5, + "ip": 1, + "mss": 3, + "mbas": 1, + "ms": 8, + "my": 4, + "mx": 7, + "vw": 7, + "vwi": 4, + "dws": 3, + "mhi": 3, + "mhdet": 2, + "loglikeli": 4, + "mData": 4, + "vxm": 1, + "vxs": 1, + "mxm": 1, + "<": 4, + "mxsu": 1, + "mxsl": 1, + "time": 2, + "timeall": 1, + "timeran": 1, + "timelik": 1, + "timefun": 1, + "timeint": 1, + "timeres": 1, + "GetData": 1, + "m_asY": 1, + "sqrt": 1, + "*M_PI": 1, + "m_cY": 1, + "determinant": 2, + "m_mMSbE.": 2, + "covariance": 2, + "invert": 2, + "of": 2, + "measurement": 1, + "shocks": 1, + "m_vSss": 1, + "m_cPar": 4, + "m_cS": 1, + "start": 1, + "particles": 2, + "m_vXss": 1, + "m_cX": 1, + "steady": 1, + "state": 3, + "and": 1, + "policy": 2, + "init": 1, + "likelihood": 1, + "//timeall": 1, + "timer": 3, + "for": 2, + "sizer": 1, + "rann": 1, + "m_cSS": 1, + "m_mSSbE": 1, + "noise": 1, + "fg": 1, + "&": 2, + "transition": 1, + "prior": 1, + "as": 1, + "proposal": 1, + "m_oApprox.FastInterpolate": 1, + "interpolate": 1, + "fy": 1, + "m_cMS": 1, + "evaluate": 1, + "importance": 1, + "weights": 2, + "observation": 1, + "error": 1, + "exp": 2, + "outer": 1, + "/mhdet": 2, + "sumr": 1, + "my*mhi": 1, + ".*my": 1, + ".": 3, + ".NaN": 1, + "can": 1, + "happen": 1, + "extrem": 1, + "sumc": 1, + "or": 1, + "extremely": 1, + "wrong": 1, + "parameters": 1, + "dws/m_cPar": 1, + "loglikelihood": 1, + "contribution": 1, + "//timelik": 1, + "/100": 1, + "//time": 1, + "resample": 1, + "vw/dws": 1, + "selection": 1, + "step": 1, + "in": 1, + "c": 1, + "on": 1, + "normalized": 1 + }, "Oxygene": { "": 1, "DefaultTargets=": 1, @@ -36152,6 +49709,69 @@ "": 1, "": 1 }, + "Pan": { + "object": 1, + "template": 1, + "pantest": 1, + ";": 32, + "xFF": 1, + "e": 2, + "-": 2, + "E10": 1, + "variable": 4, + "TEST": 2, + "to_string": 1, + "(": 8, + ")": 8, + "+": 2, + "value": 1, + "undef": 1, + "null": 1, + "error": 1, + "include": 1, + "{": 5, + "}": 5, + "pkg_repl": 2, + "PKG_ARCH_DEFAULT": 1, + "function": 1, + "show_things_view_for_stuff": 1, + "thing": 2, + "ARGV": 1, + "[": 2, + "]": 2, + "foreach": 1, + "i": 1, + "mything": 2, + "STUFF": 1, + "if": 1, + "return": 2, + "true": 2, + "else": 1, + "SELF": 1, + "false": 2, + "HERE": 1, + "<<": 1, + "EOF": 2, + "This": 1, + "example": 1, + "demonstrates": 1, + "an": 1, + "in": 1, + "line": 1, + "heredoc": 1, + "style": 1, + "config": 1, + "file": 1, + "main": 1, + "awesome": 1, + "small": 1, + "#This": 1, + "should": 1, + "be": 1, + "highlighted": 1, + "normally": 1, + "again.": 1 + }, "Parrot Assembly": { "SHEBANG#!parrot": 1, ".pcc_sub": 1, @@ -36353,29 +49973,29 @@ "package": 14, "App": 131, "Ack": 136, - ";": 1185, - "use": 76, - "warnings": 16, - "strict": 16, + ";": 1193, + "use": 83, + "warnings": 18, + "strict": 18, "File": 54, "Next": 27, "Plugin": 2, "Basic": 10, - "head1": 31, - "NAME": 5, - "-": 860, + "head1": 36, + "NAME": 6, + "-": 868, "A": 2, "container": 1, - "for": 78, + "for": 83, "functions": 2, - "the": 131, + "the": 143, "ack": 38, "program": 6, "VERSION": 15, "Version": 1, - "cut": 27, + "cut": 28, "our": 34, - "COPYRIGHT": 6, + "COPYRIGHT": 7, "BEGIN": 7, "{": 1121, "}": 1134, @@ -36392,8 +50012,8 @@ "is_cygwin": 6, "is_windows": 12, "Spec": 13, - "(": 919, - ")": 917, + "(": 925, + ")": 923, "Glob": 4, "Getopt": 6, "Long": 6, @@ -36408,27 +50028,27 @@ "actionscript": 2, "[": 159, "qw": 35, - "as": 33, + "as": 37, "mxml": 2, "]": 155, "ada": 4, "adb": 2, "ads": 2, "asm": 4, - "s": 34, + "s": 35, "batch": 2, "bat": 2, "cmd": 2, "binary": 3, "q": 5, "Binary": 2, - "files": 41, + "files": 42, "defined": 54, - "by": 11, - "Perl": 6, + "by": 16, + "Perl": 9, "T": 2, "op": 2, - "default": 16, + "default": 19, "off": 4, "tt": 4, "tt2": 2, @@ -36454,11 +50074,11 @@ "xslt": 2, "ent": 2, "while": 31, - "my": 401, + "my": 404, "type": 69, "exts": 6, "each": 14, - "if": 272, + "if": 276, "ref": 33, "ext": 14, "@": 38, @@ -36466,7 +50086,7 @@ "_": 101, "mk": 2, "mak": 2, - "not": 53, + "not": 54, "t": 18, "p": 9, "STDIN": 2, @@ -36475,36 +50095,36 @@ "/MSWin32/": 2, "quotemeta": 5, "catfile": 4, - "SYNOPSIS": 5, - "If": 14, - "you": 33, - "want": 5, - "to": 86, + "SYNOPSIS": 6, + "If": 15, + "you": 44, + "want": 7, + "to": 95, "know": 4, - "about": 3, + "about": 4, "F": 24, "": 13, - "see": 4, - "file": 40, - "itself.": 2, + "see": 5, + "file": 49, + "itself.": 3, "No": 4, "user": 4, "serviceable": 1, "parts": 1, "inside.": 1, - "is": 62, - "all": 22, - "that": 27, + "is": 69, + "all": 23, + "that": 33, "should": 6, "this.": 1, "FUNCTIONS": 1, - "head2": 32, + "head2": 34, "read_ackrc": 4, "Reads": 1, "contents": 2, - "of": 55, + "of": 64, ".ackrc": 1, - "and": 76, + "and": 85, "returns": 4, "arguments.": 1, "sub": 225, @@ -36522,7 +50142,7 @@ "&&": 83, "e": 20, "open": 7, - "or": 47, + "or": 49, "die": 38, "@lines": 21, "/./": 2, @@ -36537,11 +50157,11 @@ "return": 157, "get_command_line_options": 4, "Gets": 3, - "command": 13, + "command": 14, "line": 20, "arguments": 2, "does": 10, - "specific": 1, + "specific": 2, "tweaking.": 1, "opt": 291, "pager": 19, @@ -36564,9 +50184,9 @@ "column": 4, "#": 99, "ignore": 7, - "this": 18, + "this": 22, "option": 7, - "it": 25, + "it": 28, "handled": 2, "beforehand": 2, "f": 25, @@ -36598,7 +50218,7 @@ "print_version_statement": 2, "exit": 16, "show_help": 3, - "@_": 41, + "@_": 43, "show_help_types": 2, "require": 12, "Pod": 4, @@ -36610,7 +50230,7 @@ "wanted": 4, "no//": 2, "must": 5, - "be": 30, + "be": 36, "later": 2, "exists": 19, "else": 53, @@ -36645,7 +50265,7 @@ "uniq": 4, "@uniq": 2, "sort": 8, - "a": 81, + "a": 85, "<=>": 2, "b": 6, "keys": 15, @@ -36656,24 +50276,24 @@ "Go": 1, "through": 6, "look": 2, - "I": 67, + "I": 68, "<--type-set>": 1, "foo=": 1, "bar": 3, "<--type-add>": 1, "xml=": 1, - ".": 121, + ".": 125, "Remove": 1, "them": 5, - "add": 8, + "add": 9, "supported": 1, "filetypes": 8, "i.e.": 2, "into": 6, - "etc.": 1, + "etc.": 3, "@typedef": 8, "td": 6, - "set": 11, + "set": 12, "Builtin": 4, "cannot": 4, "changed.": 4, @@ -36681,7 +50301,7 @@ "delete_type": 5, "Type": 2, "exist": 4, - "creating": 2, + "creating": 3, "with": 26, "...": 2, "unless": 39, @@ -36693,7 +50313,7 @@ "internal": 1, "structures": 1, "containing": 5, - "information": 1, + "information": 2, "type_wanted.": 1, "Internal": 2, "error": 4, @@ -36702,18 +50322,18 @@ "Standard": 1, "filter": 12, "pass": 1, - "L": 18, + "L": 34, "": 1, "descend_filter.": 1, - "It": 2, + "It": 3, "true": 3, "directory": 8, - "any": 3, + "any": 4, "ones": 1, "we": 7, "ignore.": 1, "path": 28, - "This": 24, + "This": 27, "removes": 1, "trailing": 1, "separator": 4, @@ -36729,18 +50349,18 @@ "For": 5, "example": 5, "": 1, - "The": 20, + "The": 22, "filetype": 1, - "will": 7, - "C": 48, + "will": 9, + "C": 56, "": 1, - "can": 26, + "can": 30, "skipped": 2, - "something": 2, + "something": 3, "avoid": 1, "searching": 6, "even": 4, - "under": 4, + "under": 5, "a.": 1, "constant": 2, "TEXT": 16, @@ -36750,7 +50370,7 @@ "lc_basename": 8, "lc": 5, "r": 14, - "B": 75, + "B": 76, "header": 17, "SHEBANG#!#!": 2, "ruby": 3, @@ -36784,7 +50404,7 @@ "_get_thpppt": 3, "print": 35, "_bar": 3, - "<<": 6, + "<<": 10, "&": 22, "*I": 2, "g": 7, @@ -36794,13 +50414,13 @@ "#I": 6, "#7": 4, "results.": 2, - "on": 24, - "when": 17, - "used": 11, + "on": 25, + "when": 18, + "used": 12, "interactively": 6, - "no": 21, + "no": 22, "Print": 6, - "between": 3, + "between": 4, "results": 8, "different": 2, "files.": 6, @@ -36829,7 +50449,7 @@ "pipe": 4, "finding": 2, "Only": 7, - "found": 9, + "found": 11, "without": 3, "searching.": 2, "PATTERN": 8, @@ -36841,13 +50461,13 @@ "lexically.": 3, "invert": 2, "Print/search": 2, - "handle": 2, - "do": 11, + "handle": 3, + "do": 12, "g/": 2, "G.": 2, "show": 3, "Show": 2, - "which": 6, + "which": 7, "has.": 2, "inclusion/exclusion": 2, "All": 4, @@ -36883,7 +50503,7 @@ "@before": 16, "before_starts_at_line": 10, "after": 18, - "number": 3, + "number": 4, "still": 4, "res": 59, "next_text": 8, @@ -36948,10 +50568,10 @@ "print_count0": 2, "filetypes_supported_set": 9, "True/False": 1, - "are": 24, + "are": 25, "print_files": 4, "iter": 23, - "returned": 2, + "returned": 3, "iterator": 3, "<$regex>": 1, "<$one>": 1, @@ -36959,7 +50579,7 @@ "first.": 1, "<$ors>": 1, "<\"\\n\">": 1, - "defines": 1, + "defines": 2, "what": 14, "filename.": 1, "print_files_with_matches": 4, @@ -37029,24 +50649,24 @@ "pipe.": 1, "exit_from_ack": 5, "Exit": 1, - "application": 10, + "application": 15, "correct": 1, "code.": 2, "otherwise": 2, "handed": 1, - "in": 29, + "in": 36, "argument.": 1, "rc": 11, "LICENSE": 3, "Copyright": 2, "Andy": 2, "Lester.": 2, - "free": 3, + "free": 4, "software": 3, - "redistribute": 3, - "and/or": 3, - "modify": 3, - "terms": 3, + "redistribute": 4, + "and/or": 4, + "modify": 4, + "terms": 4, "Artistic": 2, "License": 2, "v2.0.": 2, @@ -37062,8 +50682,8 @@ "unspecified": 1, "fib": 4, "N": 2, - "SEE": 3, - "ALSO": 3, + "SEE": 4, + "ALSO": 4, "": 1, "SHEBANG#!perl": 5, "MAIN": 1, @@ -37084,7 +50704,7 @@ "Resource": 5, "file_matching": 2, "check_regex": 2, - "like": 12, + "like": 13, "finder": 1, "options": 7, "FILE...": 1, @@ -37103,7 +50723,7 @@ "By": 2, "prints": 2, "also": 7, - "would": 3, + "would": 5, "actually": 1, "let": 1, "take": 5, @@ -37121,12 +50741,12 @@ "specified": 3, "line.": 4, "default.": 2, - "item": 42, + "item": 44, "": 11, "paths": 3, "included": 1, "search.": 1, - "entire": 2, + "entire": 3, "matched": 1, "against": 1, "shell": 4, @@ -37135,7 +50755,7 @@ "<-w>": 2, "<-v>": 3, "<-Q>": 4, - "apply": 2, + "apply": 3, "relative": 1, "convenience": 1, "shortcut": 2, @@ -37181,7 +50801,7 @@ "include": 1, "<--ignore-dir=data>": 1, "<--noignore-dir>": 1, - "allows": 2, + "allows": 4, "normally": 1, "perhaps": 1, "research": 1, @@ -37193,17 +50813,17 @@ "": 1, "NOT": 1, "supported.": 1, - "You": 3, - "need": 3, + "You": 4, + "need": 5, "specify": 1, "<--ignore-dir=foo>": 1, - "then": 3, + "then": 4, "foo": 6, "taken": 1, "account": 1, "explicitly": 1, "": 2, - "file.": 2, + "file.": 3, "Multiple": 1, "<--line>": 1, "comma": 1, @@ -37244,9 +50864,9 @@ "they": 1, "expression.": 1, "Highlighting": 1, - "work": 1, + "work": 3, "though": 1, - "so": 3, + "so": 4, "highlight": 1, "seeing": 1, "tail": 1, @@ -37259,9 +50879,9 @@ "usual": 1, "newline.": 1, "dealing": 1, - "contain": 2, + "contain": 3, "whitespace": 1, - "e.g.": 1, + "e.g.": 2, "html": 1, "xargs": 2, "rm": 1, @@ -37282,7 +50902,7 @@ "<--smart-case>": 1, "<--no-smart-case>": 1, "strings": 1, - "contains": 1, + "contains": 2, "uppercase": 1, "characters.": 1, "similar": 1, @@ -37293,7 +50913,7 @@ "<--sort-files>": 1, "Sorts": 1, "Use": 6, - "your": 13, + "your": 20, "listings": 1, "deterministic": 1, "runs": 1, @@ -37307,7 +50927,7 @@ "Bill": 1, "Cat": 1, "logo.": 1, - "Note": 4, + "Note": 5, "exact": 1, "spelling": 1, "<--thpppppt>": 1, @@ -37316,7 +50936,7 @@ "perl": 8, "php": 2, "python": 1, - "looks": 1, + "looks": 2, "location.": 1, "variable": 1, "specifies": 1, @@ -37360,7 +50980,7 @@ "See": 1, "": 1, "specifications.": 1, - "such": 5, + "such": 6, "": 1, "": 1, "": 1, @@ -37373,7 +50993,7 @@ "understands": 1, "sequences.": 1, "never": 1, - "back": 3, + "back": 4, "ACK": 2, "OTHER": 1, "TOOLS": 1, @@ -37396,8 +51016,8 @@ "Phil": 1, "Jackson": 1, "put": 1, - "together": 1, - "an": 11, + "together": 2, + "an": 16, "": 1, "extension": 1, "": 1, @@ -37410,13 +51030,13 @@ "Code": 1, "greater": 1, "normal": 1, - "code": 7, + "code": 8, "<$?=256>": 1, "": 1, "backticks.": 1, "errors": 1, "used.": 1, - "at": 3, + "at": 4, "least": 1, "returned.": 1, "DEBUGGING": 1, @@ -37438,7 +51058,7 @@ "big": 1, "codesets": 1, "more": 2, - "create": 2, + "create": 3, "tree": 2, "ideal": 1, "sending": 1, @@ -37485,7 +51105,7 @@ "tips": 1, "here.": 1, "FAQ": 1, - "Why": 2, + "Why": 3, "isn": 1, "doesn": 8, "behavior": 3, @@ -37507,17 +51127,17 @@ "those": 2, "well": 2, "returning": 1, - "things": 1, + "things": 2, "great": 1, "did": 1, "replace": 3, "read": 6, "only.": 1, - "has": 2, + "has": 3, "perfectly": 1, "good": 2, "way": 2, - "using": 2, + "using": 5, "<-p>": 1, "<-n>": 1, "switches.": 1, @@ -37532,7 +51152,7 @@ "<.xyz>": 1, "already": 2, "program/package": 1, - "called": 3, + "called": 4, "ack.": 2, "Yes": 1, "know.": 1, @@ -37587,7 +51207,7 @@ "hash": 11, "badkey": 1, "caller": 2, - "start": 6, + "start": 7, "dh": 4, "opendir": 1, "@newfiles": 5, @@ -37597,7 +51217,7 @@ "catdir": 3, "closedir": 1, "": 1, - "these": 1, + "these": 4, "updated": 1, "update": 1, "message": 1, @@ -37632,7 +51252,7 @@ "seek": 4, "readline": 1, "nexted": 3, - "CGI": 5, + "CGI": 6, "Fast": 3, "XML": 2, "Hash": 11, @@ -37681,6 +51301,113 @@ "Foo": 11, "Bar": 1, "@array": 1, + "pod": 1, + "Catalyst": 10, + "PSGI": 10, + "How": 1, + "": 3, + "specification": 3, + "interface": 1, + "web": 8, + "servers": 2, + "based": 2, + "applications": 2, + "frameworks.": 1, + "supports": 1, + "writing": 1, + "portable": 1, + "run": 1, + "various": 2, + "methods": 4, + "standalone": 1, + "server": 2, + "mod_perl": 3, + "FastCGI": 2, + "": 3, + "implementation": 1, + "running": 1, + "applications.": 1, + "Engine": 1, + "XXXX": 1, + "classes": 2, + "environments": 1, + "been": 1, + "changed": 1, + "done": 2, + "implementing": 1, + "possible": 2, + "manually": 2, + "": 1, + "root": 1, + "application.": 1, + "write": 2, + "own": 4, + ".psgi": 7, + "Writing": 2, + "alternate": 1, + "": 1, + "extensions": 1, + "implement": 2, + "": 1, + "": 1, + "": 1, + "simplest": 1, + "<.psgi>": 1, + "": 1, + "TestApp": 5, + "app": 2, + "psgi_app": 3, + "middleware": 2, + "components": 2, + "automatically": 2, + "": 1, + "applied": 1, + "psgi": 2, + "yourself.": 2, + "Details": 1, + "below.": 1, + "Additional": 1, + "": 1, + "What": 1, + "generates": 2, + "": 1, + "setting": 2, + "wrapped": 1, + "": 1, + "some": 1, + "engine": 1, + "fixes": 1, + "uniform": 1, + "behaviour": 2, + "contained": 1, + "over": 2, + "": 1, + "": 1, + "override": 1, + "providing": 2, + "none": 1, + "call": 2, + "MyApp": 1, + "Thus": 1, + "functionality": 1, + "ll": 1, + "An": 1, + "apply_default_middlewares": 2, + "method": 8, + "supplied": 1, + "wrap": 1, + "middlewares": 1, + "means": 3, + "auto": 1, + "generated": 1, + "": 1, + "": 1, + "AUTHORS": 2, + "Contributors": 1, + "Catalyst.pm": 1, + "library": 2, + "software.": 1, + "same": 2, "Plack": 25, "_001": 1, "HTTP": 16, @@ -37693,7 +51420,6 @@ "Escape": 6, "_deprecated": 8, "alt": 1, - "method": 7, "carp": 2, "croak": 3, "required": 2, @@ -37782,7 +51508,6 @@ "_make_upload": 2, "__END__": 2, "Portable": 2, - "PSGI": 6, "app_or_middleware": 1, "req": 28, "finalize": 5, @@ -37792,19 +51517,14 @@ "API": 2, "objects": 2, "across": 1, - "web": 5, - "server": 1, "environments.": 1, "CAVEAT": 1, "module": 2, "intended": 1, - "middleware": 1, "developers": 3, "framework": 2, "rather": 2, - "Writing": 1, "directly": 1, - "possible": 1, "recommended": 1, "yet": 1, "too": 1, @@ -37822,7 +51542,6 @@ "PSGI.": 1, "METHODS": 2, "Some": 1, - "methods": 3, "earlier": 1, "versions": 1, "deprecated": 1, @@ -37860,7 +51579,6 @@ "Unlike": 1, "": 1, "allow": 1, - "setting": 1, "modifying": 1, "@values": 1, "@params": 1, @@ -37885,7 +51603,6 @@ "": 1, "": 1, "store": 1, - "means": 2, "plain": 2, "": 1, "scalars": 1, @@ -37899,7 +51616,6 @@ "dispatch": 1, "route": 1, "actions": 1, - "based": 1, "sure": 1, "": 1, "virtual": 1, @@ -37907,7 +51623,6 @@ "how": 1, "mounted.": 1, "hosted": 1, - "mod_perl": 1, "scripts": 1, "multiplexed": 1, "tools": 1, @@ -37924,7 +51639,6 @@ "": 1, "empty.": 1, "older": 1, - "call": 1, "instead.": 1, "Cookie": 2, "handling": 1, @@ -37942,10 +51656,8 @@ "Simple": 1, "longer": 1, "have": 2, - "write": 1, "wacky": 1, "simply": 1, - "AUTHORS": 1, "Tatsuhiko": 2, "Miyagawa": 2, "Kazuhiro": 1, @@ -37954,8 +51666,6 @@ "Matsuno": 2, "": 1, "": 1, - "library": 1, - "same": 1, "Util": 3, "Accessor": 1, "status": 17, @@ -38021,7 +51731,6 @@ "response": 5, "psgi_handler": 1, "API.": 1, - "over": 1, "Sets": 2, "gets": 2, "": 1, @@ -39743,6 +53452,2094 @@ "right": 1, "L": 2 }, + "Propeller Spin": { + "{": 26, + "*****************************************": 4, + "*": 143, + "x4": 4, + "Keypad": 1, + "Reader": 1, + "v1.0": 4, + "Author": 8, + "Beau": 2, + "Schwabe": 2, + "Copyright": 10, + "(": 356, + "c": 33, + ")": 356, + "Parallax": 10, + "See": 10, + "end": 12, + "of": 108, + "file": 9, + "for": 70, + "terms": 9, + "use.": 9, + "}": 26, + "Operation": 2, + "This": 3, + "object": 7, + "uses": 2, + "a": 72, + "capacitive": 1, + "PIN": 1, + "approach": 1, + "to": 191, + "reading": 1, + "the": 136, + "keypad.": 1, + "To": 3, + "do": 26, + "so": 11, + "ALL": 2, + "pins": 26, + "are": 18, + "made": 2, + "LOW": 2, + "and": 95, + "an": 12, + "OUTPUT": 2, + "I/O": 3, + "pins.": 1, + "Then": 1, + "set": 42, + "INPUT": 2, + "state.": 1, + "At": 1, + "this": 26, + "point": 21, + "only": 63, + "one": 4, + "pin": 18, + "is": 51, + "HIGH": 3, + "at": 26, + "time.": 2, + "If": 2, + "closed": 1, + "then": 5, + "will": 12, + "be": 46, + "read": 29, + "on": 12, + "input": 2, + "otherwise": 1, + "returned.": 1, + "The": 17, + "keypad": 4, + "decoding": 1, + "routine": 1, + "requires": 3, + "two": 6, + "subroutines": 1, + "returns": 6, + "entire": 1, + "matrix": 1, + "into": 19, + "single": 2, + "WORD": 1, + "variable": 1, + "indicating": 1, + "which": 16, + "buttons": 2, + "pressed.": 1, + "Multiple": 1, + "button": 2, + "presses": 1, + "allowed": 1, + "with": 8, + "understanding": 1, + "that": 10, + "BOX": 2, + "entries": 1, + "can": 4, + "confused.": 1, + "An": 1, + "example": 3, + "entry...": 1, + "or": 43, + "#": 97, + "etc.": 1, + "where": 2, + "any": 15, + "pressed": 3, + "evaluate": 1, + "non": 3, + "as": 8, + "being": 2, + "even": 1, + "when": 3, + "they": 2, + "not.": 1, + "There": 1, + "no": 7, + "danger": 1, + "physical": 1, + "electrical": 1, + "damage": 1, + "s": 16, + "just": 2, + "way": 1, + "sensing": 1, + "method": 2, + "happens": 1, + "work.": 1, + "Schematic": 1, + "No": 2, + "resistors": 4, + "capacitors.": 1, + "connections": 1, + "directly": 1, + "from": 21, + "Clear": 2, + "value": 51, + "ReadRow": 4, + "Shift": 3, + "left": 12, + "by": 17, + "preset": 1, + "P0": 2, + "P7": 2, + "LOWs": 1, + "dira": 3, + "[": 35, + "]": 34, + "make": 16, + "INPUTSs": 1, + "...": 5, + "now": 3, + "act": 1, + "like": 4, + "tiny": 1, + "capacitors": 1, + "outa": 2, + "n": 4, + "Pin": 1, + "OUTPUT...": 1, + "Make": 1, + ";": 2, + "charge": 10, + "+": 759, + "ina": 3, + "Pn": 1, + "remain": 1, + "discharged": 1, + "DAT": 7, + "TERMS": 9, + "OF": 49, + "USE": 19, + "MIT": 9, + "License": 9, + "Permission": 9, + "hereby": 9, + "granted": 9, + "free": 10, + "person": 9, + "obtaining": 9, + "copy": 21, + "software": 9, + "associated": 11, + "documentation": 9, + "files": 9, + "deal": 9, + "in": 53, + "Software": 28, + "without": 19, + "restriction": 9, + "including": 9, + "limitation": 9, + "rights": 9, + "use": 19, + "modify": 9, + "merge": 9, + "publish": 9, + "distribute": 9, + "sublicense": 9, + "and/or": 9, + "sell": 9, + "copies": 18, + "permit": 9, + "persons": 9, + "whom": 9, + "furnished": 9, + "subject": 9, + "following": 9, + "conditions": 9, + "above": 11, + "copyright": 9, + "notice": 18, + "permission": 9, + "shall": 9, + "included": 9, + "all": 14, + "substantial": 9, + "portions": 9, + "Software.": 9, + "THE": 59, + "SOFTWARE": 19, + "IS": 10, + "PROVIDED": 9, + "WITHOUT": 10, + "WARRANTY": 10, + "ANY": 20, + "KIND": 10, + "EXPRESS": 10, + "OR": 70, + "IMPLIED": 10, + "INCLUDING": 10, + "BUT": 10, + "NOT": 11, + "LIMITED": 10, + "TO": 10, + "WARRANTIES": 10, + "MERCHANTABILITY": 10, + "FITNESS": 10, + "FOR": 20, + "A": 21, + "PARTICULAR": 10, + "PURPOSE": 10, + "AND": 10, + "NONINFRINGEMENT.": 10, + "IN": 40, + "NO": 10, + "EVENT": 10, + "SHALL": 10, + "AUTHORS": 10, + "COPYRIGHT": 10, + "HOLDERS": 10, + "BE": 10, + "LIABLE": 10, + "CLAIM": 10, + "DAMAGES": 10, + "OTHER": 20, + "LIABILITY": 10, + "WHETHER": 10, + "AN": 10, + "ACTION": 10, + "CONTRACT": 10, + "TORT": 10, + "OTHERWISE": 10, + "ARISING": 10, + "FROM": 10, + "OUT": 10, + "CONNECTION": 10, + "WITH": 10, + "DEALINGS": 10, + "SOFTWARE.": 10, + "****************************************": 4, + "Debug_Lcd": 1, + "v1.2": 2, + "Authors": 1, + "Jon": 2, + "Williams": 2, + "Jeff": 2, + "Martin": 2, + "Inc.": 8, + "Debugging": 1, + "wrapper": 1, + "Serial_Lcd": 1, + "-": 486, + "March": 1, + "Updated": 4, + "conform": 1, + "Propeller": 3, + "initialization": 2, + "standards.": 1, + "v1.1": 8, + "April": 1, + "consistency.": 1, + "OBJ": 2, + "lcd": 2, + "number": 27, + "string": 8, + "conversion": 1, + "PUB": 63, + "init": 2, + "baud": 2, + "lines": 24, + "okay": 11, + "Initializes": 1, + "serial": 1, + "LCD": 4, + "true": 6, + "if": 53, + "parameters": 19, + "lcd.init": 1, + "finalize": 1, + "Finalizes": 1, + "frees": 6, + "floats": 1, + "lcd.finalize": 1, + "putc": 1, + "txbyte": 2, + "Send": 1, + "byte": 27, + "terminal": 4, + "lcd.putc": 1, + "str": 3, + "strAddr": 2, + "Print": 15, + "zero": 10, + "terminated": 4, + "lcd.str": 8, + "dec": 3, + "signed": 4, + "decimal": 5, + "num.dec": 1, + "decf": 1, + "width": 9, + "Prints": 2, + "space": 1, + "padded": 2, + "fixed": 1, + "field": 4, + "num.decf": 1, + "decx": 1, + "digits": 23, + "negative": 2, + "num.decx": 1, + "hex": 3, + "hexadecimal": 4, + "num.hex": 1, + "ihex": 1, + "indicated": 2, + "num.ihex": 1, + "bin": 3, + "binary": 4, + "num.bin": 1, + "ibin": 1, + "%": 162, + "num.ibin": 1, + "cls": 1, + "Clears": 2, + "moves": 1, + "cursor": 9, + "home": 4, + "position": 9, + "lcd.cls": 1, + "Moves": 2, + "lcd.home": 1, + "gotoxy": 1, + "col": 9, + "line": 33, + "col/line": 1, + "lcd.gotoxy": 1, + "clrln": 1, + "lcd.clrln": 1, + "type": 4, + "Selects": 1, + "off": 8, + "blink": 4, + "lcd.cursor": 1, + "display": 23, + "status": 15, + "Controls": 1, + "visibility": 1, + "false": 7, + "hide": 1, + "contents": 3, + "clearing": 1, + "lcd.displayOn": 1, + "else": 3, + "lcd.displayOff": 1, + "custom": 2, + "char": 2, + "chrDataAddr": 3, + "Installs": 1, + "character": 6, + "map": 1, + "address": 16, + "definition": 9, + "array": 1, + "lcd.custom": 1, + "backLight": 1, + "Enable": 1, + "disable": 7, + "backlight": 1, + "affects": 1, + "backlit": 1, + "models": 1, + "lcd.backLight": 1, + "***************************************": 12, + "Graphics": 3, + "Driver": 4, + "Chip": 7, + "Gracey": 7, + "Theory": 1, + "cog": 39, + "launched": 1, + "processes": 1, + "commands": 1, + "via": 5, + "routines.": 1, + "Points": 1, + "arcs": 1, + "sprites": 1, + "text": 9, + "polygons": 1, + "rasterized": 1, + "specified": 1, + "stretch": 1, + "memory": 2, + "serves": 1, + "generic": 1, + "bitmap": 15, + "buffer.": 1, + "displayed": 1, + "TV.SRC": 1, + "VGA.SRC": 1, + "driver.": 3, + "GRAPHICS_DEMO.SRC": 1, + "usage": 1, + "example.": 1, + "CON": 4, + "#1": 47, + "_setup": 1, + "_color": 2, + "_width": 2, + "_plot": 2, + "_line": 2, + "_arc": 2, + "_vec": 2, + "_vecarc": 2, + "_pix": 1, + "_pixarc": 1, + "_text": 2, + "_textarc": 1, + "_textmode": 2, + "_fill": 1, + "_loop": 5, + "VAR": 10, + "long": 122, + "command": 7, + "bitmap_base": 7, + "pixel": 40, + "data": 47, + "slices": 3, + "text_xs": 1, + "text_ys": 1, + "text_sp": 1, + "text_just": 1, + "font": 3, + "pointer": 14, + "same": 7, + "instances": 1, + "stop": 9, + "cognew": 4, + "@loop": 1, + "@command": 1, + "Stop": 6, + "graphics": 4, + "driver": 17, + "cogstop": 3, + "setup": 3, + "x_tiles": 9, + "y_tiles": 9, + "x_origin": 2, + "y_origin": 2, + "base_ptr": 3, + "|": 22, + "bases_ptr": 3, + "slices_ptr": 1, + "Set": 5, + "x": 112, + "tiles": 19, + "x16": 7, + "pixels": 14, + "each": 11, + "y": 80, + "relative": 2, + "center": 10, + "base": 6, + "setcommand": 13, + "write": 36, + "bases": 2, + "<<": 70, + "retain": 2, + "high": 7, + "level": 5, + "bitmap_longs": 1, + "clear": 5, + "dest_ptr": 2, + "Copy": 1, + "double": 2, + "buffered": 1, + "flicker": 5, + "destination": 1, + "color": 39, + "bit": 35, + "pattern": 2, + "code": 3, + "bits": 29, + "@colors": 2, + "&": 21, + "determine": 2, + "shape/width": 2, + "w": 8, + "F": 18, + "pixel_width": 1, + "pixel_passes": 2, + "@w": 1, + "update": 7, + "new": 6, + "repeat": 18, + "i": 24, + "p": 8, + "E": 7, + "r": 4, + "<": 14, + "colorwidth": 1, + "plot": 17, + "Plot": 3, + "@x": 6, + "Draw": 7, + "endpoint": 1, + "arc": 21, + "xr": 7, + "yr": 7, + "angle": 23, + "anglestep": 2, + "steps": 9, + "arcmode": 2, + "radii": 3, + "initial": 6, + "FFF": 3, + "..359.956": 3, + "step": 9, + "leaves": 1, + "between": 4, + "points": 2, + "vec": 1, + "vecscale": 5, + "vecangle": 5, + "vecdef_ptr": 5, + "vector": 12, + "sprite": 14, + "scale": 7, + "rotation": 3, + "Vector": 2, + "word": 212, + "length": 4, + "vecarc": 2, + "pix": 3, + "pixrot": 3, + "pixdef_ptr": 3, + "mirror": 1, + "Pixel": 1, + "justify": 4, + "draw": 5, + "textarc": 1, + "string_ptr": 6, + "justx": 2, + "justy": 3, + "it": 8, + "may": 6, + "necessary": 1, + "call": 44, + ".finish": 1, + "immediately": 1, + "afterwards": 1, + "prevent": 1, + "subsequent": 1, + "clobbering": 1, + "drawn": 1, + "@justx": 1, + "@x_scale": 1, + "get": 30, + "half": 2, + "min": 4, + "max": 6, + "pmin": 1, + "round/square": 1, + "corners": 1, + "y2": 7, + "x2": 6, + "fill": 3, + "pmax": 2, + "triangle": 3, + "sides": 1, + "polygon": 1, + "tri": 2, + "x3": 4, + "y3": 5, + "y4": 1, + "x1": 5, + "y1": 7, + "xy": 1, + "solid": 1, + "/": 27, + "finish": 2, + "Wait": 2, + "current": 3, + "insure": 2, + "safe": 1, + "manually": 1, + "manipulate": 1, + "while": 5, + "primitives": 1, + "xa0": 53, + "start": 16, + "ya1": 3, + "ya2": 1, + "ya3": 2, + "ya4": 40, + "ya5": 3, + "ya6": 21, + "ya7": 9, + "ya8": 19, + "ya9": 5, + "yaA": 18, + "yaB": 4, + "yaC": 12, + "yaD": 4, + "yaE": 1, + "yaF": 1, + "xb0": 19, + "yb1": 2, + "yb2": 1, + "yb3": 4, + "yb4": 15, + "yb5": 2, + "yb6": 7, + "yb7": 3, + "yb8": 20, + "yb9": 5, + "ybA": 8, + "ybB": 1, + "ybC": 32, + "ybD": 1, + "ybE": 1, + "ybF": 1, + "ax1": 11, + "radius": 2, + "ay2": 23, + "ay3": 6, + "ay4": 4, + "a0": 8, + "a2": 1, + "farc": 41, + "another": 7, + "arc/line": 1, + "Round": 1, + "recipes": 1, + "C": 11, + "D": 18, + "fline": 88, + "xa2": 48, + "xb2": 26, + "xa1": 8, + "xb1": 2, + "more": 90, + "xa3": 8, + "xb3": 6, + "xb4": 35, + "a9": 3, + "ax2": 30, + "ay1": 10, + "a7": 2, + "aE": 1, + "aC": 2, + ".": 2, + "aF": 4, + "aD": 3, + "aB": 2, + "xa4": 13, + "a8": 8, + "@": 1, + "a4": 3, + "B": 15, + "H": 1, + "J": 1, + "L": 5, + "N": 1, + "P": 6, + "R": 3, + "T": 5, + "aA": 5, + "V": 7, + "X": 4, + "Z": 1, + "b": 1, + "d": 2, + "f": 2, + "h": 2, + "j": 2, + "l": 2, + "t": 10, + "v": 1, + "z": 4, + "delta": 10, + "bullet": 1, + "fx": 1, + "*************************************": 2, + "org": 2, + "loop": 14, + "rdlong": 16, + "t1": 139, + "par": 20, + "wz": 21, + "arguments": 1, + "mov": 154, + "t2": 90, + "t3": 10, + "#8": 14, + "arg": 3, + "arg0": 12, + "add": 92, + "d0": 11, + "#4": 8, + "djnz": 24, + "wrlong": 6, + "dx": 20, + "dy": 15, + "arg1": 3, + "ror": 4, + "#16": 6, + "jump": 1, + "jumps": 6, + "color_": 1, + "plot_": 2, + "arc_": 2, + "vecarc_": 1, + "pixarc_": 1, + "textarc_": 2, + "fill_": 1, + "setup_": 1, + "xlongs": 4, + "xorigin": 2, + "yorigin": 4, + "arg3": 12, + "basesptr": 4, + "arg5": 6, + "jmp": 24, + "#loop": 9, + "width_": 1, + "pwidth": 3, + "passes": 3, + "#plotd": 3, + "line_": 1, + "#linepd": 2, + "arg7": 6, + "#3": 7, + "cmp": 16, + "exit": 5, + "px": 14, + "py": 11, + "mode": 7, + "if_z": 11, + "#plotp": 3, + "test": 38, + "arg4": 5, + "iterations": 1, + "vecdef": 1, + "rdword": 10, + "t7": 8, + "add/sub": 1, + "to/from": 1, + "t6": 7, + "sumc": 4, + "#multiply": 2, + "round": 1, + "up": 4, + "/2": 1, + "lsb": 1, + "shr": 24, + "t4": 7, + "if_nc": 15, + "h8000": 5, + "wc": 57, + "if_c": 37, + "xwords": 1, + "ywords": 1, + "xxxxxxxx": 2, + "save": 1, + "actual": 4, + "sy": 5, + "rdbyte": 3, + "origin": 1, + "adjust": 4, + "neg": 2, + "sub": 12, + "arg2": 7, + "sumnc": 7, + "if_nz": 18, + "yline": 1, + "sx": 4, + "#0": 20, + "next": 16, + "#2": 15, + "shl": 21, + "t5": 4, + "xpixel": 2, + "rol": 1, + "muxc": 5, + "pcolor": 5, + "color1": 2, + "color2": 2, + "@string": 1, + "#arcmod": 1, + "text_": 1, + "chr": 4, + "done": 3, + "scan": 7, + "tjz": 8, + "def": 2, + "extract": 4, + "_0001_1": 1, + "#fontb": 3, + "textsy": 2, + "starting": 1, + "_0011_0": 1, + "#11": 1, + "#arcd": 1, + "#fontxy": 1, + "advance": 2, + "textsx": 3, + "_0111_0": 1, + "setd_ret": 1, + "fontxy_ret": 1, + "ret": 17, + "fontb": 1, + "multiply": 8, + "fontb_ret": 1, + "textmode_": 1, + "textsp": 2, + "da": 1, + "db": 1, + "db2": 1, + "linechange": 1, + "lines_minus_1": 1, + "right": 9, + "fractions": 1, + "pre": 1, + "increment": 1, + "counter": 1, + "yloop": 2, + "integers": 1, + "base0": 17, + "base1": 10, + "sar": 8, + "cmps": 3, + "out": 24, + "range": 2, + "ylongs": 6, + "skip": 5, + "mins": 1, + "mask": 3, + "mask0": 8, + "#5": 2, + "ready": 10, + "count": 4, + "mask1": 6, + "bits0": 6, + "bits1": 5, + "pass": 5, + "not": 6, + "full": 3, + "longs": 15, + "deltas": 1, + "linepd": 1, + "wr": 2, + "direction": 2, + "abs": 1, + "dominant": 2, + "axis": 1, + "last": 6, + "ratio": 1, + "xloop": 1, + "linepd_ret": 1, + "plotd": 1, + "wide": 3, + "bounds": 2, + "#plotp_ret": 2, + "#7": 2, + "store": 1, + "writes": 1, + "pair": 1, + "account": 1, + "special": 1, + "case": 5, + "andn": 7, + "slice": 7, + "shift0": 1, + "colorize": 1, + "upper": 2, + "subx": 1, + "#wslice": 1, + "offset": 14, + "Get": 2, + "args": 5, + "move": 2, + "using": 1, + "first": 9, + "arg6": 1, + "arcmod_ret": 1, + "arg2/t4": 1, + "arg4/t6": 1, + "arcd": 1, + "#setd": 1, + "#polarx": 1, + "Polar": 1, + "cartesian": 1, + "polarx": 1, + "sine_90": 2, + "sine": 7, + "quadrant": 3, + "nz": 3, + "negate": 2, + "table": 9, + "sine_table": 1, + "shift": 7, + "final": 3, + "sine/cosine": 1, + "integer": 2, + "negnz": 3, + "sine_180": 1, + "shifted": 1, + "multiplier": 3, + "product": 1, + "Defined": 1, + "constants": 2, + "hFFFFFFFF": 1, + "FFFFFFFF": 1, + "fontptr": 1, + "Undefined": 2, + "temps": 1, + "res": 89, + "pointers": 2, + "slicesptr": 1, + "line/plot": 1, + "coordinates": 1, + "Inductive": 1, + "Sensor": 1, + "Demo": 1, + "Test": 2, + "Circuit": 1, + "pF": 1, + "K": 4, + "M": 1, + "FPin": 2, + "SDF": 1, + "sigma": 3, + "feedback": 2, + "SDI": 1, + "GND": 4, + "Coils": 1, + "Wire": 1, + "used": 9, + "was": 2, + "GREEN": 2, + "about": 4, + "gauge": 1, + "Coke": 3, + "Can": 3, + "form": 7, + "MHz": 16, + "BIC": 1, + "pen": 1, + "How": 1, + "does": 2, + "work": 2, + "Note": 1, + "reported": 2, + "resonate": 5, + "frequency": 18, + "LC": 8, + "frequency.": 2, + "Instead": 1, + "voltage": 5, + "produced": 1, + "circuit": 5, + "clipped.": 1, + "In": 2, + "below": 4, + "When": 1, + "you": 5, + "apply": 1, + "small": 1, + "specific": 1, + "near": 1, + "uncommon": 1, + "measure": 1, + "times": 3, + "amount": 1, + "applying": 1, + "circuit.": 1, + "through": 1, + "diode": 2, + "basically": 1, + "feeds": 1, + "divide": 3, + "divider": 1, + "...So": 1, + "order": 1, + "see": 2, + "ADC": 2, + "sweep": 2, + "result": 6, + "output": 11, + "needs": 1, + "generate": 1, + "Volts": 1, + "ground.": 1, + "drop": 1, + "across": 1, + "since": 1, + "sensitive": 1, + "works": 1, + "after": 2, + "divider.": 1, + "typical": 1, + "magnitude": 1, + "applied": 2, + "might": 1, + "look": 2, + "something": 1, + "*****": 4, + "...With": 1, + "looks": 1, + "X****": 1, + "...The": 1, + "denotes": 1, + "location": 1, + "reason": 1, + "slightly": 1, + "reasons": 1, + "really.": 1, + "lazy": 1, + "I": 1, + "didn": 1, + "acts": 1, + "dead": 1, + "short.": 1, + "situation": 1, + "exactly": 1, + "great": 1, + "gr.start": 2, + "gr.setup": 2, + "FindResonateFrequency": 1, + "DisplayInductorValue": 2, + "Freq.Synth": 1, + "FValue": 1, + "ADC.SigmaDelta": 1, + "@FTemp": 1, + "gr.clear": 1, + "gr.copy": 2, + "display_base": 2, + "Option": 2, + "Start": 6, + "*********************************************": 2, + "Frequency": 1, + "LowerFrequency": 2, + "*100/": 1, + "UpperFrequency": 1, + "gr.colorwidth": 4, + "gr.plot": 3, + "gr.line": 3, + "FTemp/1024": 1, + "Finish": 1, + "PS/2": 1, + "Keyboard": 1, + "v1.0.1": 2, + "REVISION": 2, + "HISTORY": 2, + "/15/2006": 2, + "Tool": 1, + "par_tail": 1, + "key": 4, + "buffer": 4, + "head": 1, + "par_present": 1, + "states": 1, + "par_keys": 1, + "******************************************": 2, + "entry": 1, + "movd": 10, + "#_dpin": 1, + "masks": 1, + "dmask": 4, + "_dpin": 3, + "cmask": 2, + "_cpin": 2, + "reset": 14, + "parameter": 14, + "_head": 6, + "_present/_states": 1, + "dlsb": 2, + "stat": 6, + "Update": 1, + "_head/_present/_states": 1, + "#1*4": 1, + "scancode": 2, + "state": 2, + "#receive": 1, + "AA": 1, + "extended": 1, + "if_nc_and_z": 2, + "F0": 3, + "unknown": 2, + "ignore": 2, + "#newcode": 1, + "_states": 2, + "set/clear": 1, + "#_states": 1, + "reg": 5, + "muxnc": 5, + "cmpsub": 4, + "shift/ctrl/alt/win": 1, + "pairs": 1, + "E0": 1, + "handle": 1, + "scrlock/capslock/numlock": 1, + "_000": 5, + "_locks": 5, + "#29": 1, + "change": 3, + "configure": 3, + "flag": 5, + "leds": 3, + "check": 5, + "shift1": 1, + "if_nz_and_c": 4, + "#@shift1": 1, + "@table": 1, + "#look": 1, + "alpha": 1, + "considering": 1, + "capslock": 1, + "if_nz_and_nc": 1, + "xor": 8, + "flags": 1, + "alt": 1, + "room": 1, + "valid": 2, + "enter": 1, + "FF": 3, + "#11*4": 1, + "wrword": 1, + "F3": 1, + "keyboard": 3, + "lock": 1, + "#transmit": 2, + "rev": 1, + "rcl": 2, + "_present": 2, + "#update": 1, + "Lookup": 2, + "perform": 2, + "lookup": 1, + "movs": 9, + "#table": 1, + "#27": 1, + "#rand": 1, + "Transmit": 1, + "pull": 2, + "clock": 4, + "low": 5, + "napshr": 3, + "#13": 3, + "#18": 2, + "release": 1, + "transmit_bit": 1, + "#wait_c0": 2, + "_d2": 1, + "wcond": 3, + "c1": 2, + "c0d0": 2, + "wait": 6, + "until": 3, + "#wait": 2, + "#receive_ack": 1, + "ack": 1, + "error": 1, + "#reset": 2, + "transmit_ret": 1, + "receive": 1, + "receive_bit": 1, + "pause": 1, + "us": 1, + "#nap": 1, + "_d3": 1, + "#receive_bit": 1, + "align": 1, + "isolate": 1, + "look_ret": 1, + "receive_ack_ret": 1, + "receive_ret": 1, + "wait_c0": 1, + "c0": 1, + "timeout": 1, + "ms": 4, + "wloop": 1, + "required": 4, + "_d4": 1, + "replaced": 1, + "c0/c1/c0d0/c1d1": 1, + "if_never": 1, + "replacements": 1, + "#wloop": 3, + "if_c_or_nz": 1, + "c1d1": 1, + "if_nc_or_z": 1, + "nap": 5, + "scales": 1, + "time": 7, + "snag": 1, + "cnt": 2, + "elapses": 1, + "nap_ret": 1, + "F9": 1, + "F5": 1, + "D2": 1, + "F1": 2, + "D1": 1, + "F12": 1, + "F10": 1, + "D7": 1, + "F6": 1, + "D3": 1, + "Tab": 2, + "Alt": 2, + "F3F2": 1, + "q": 1, + "Win": 2, + "Space": 2, + "Apps": 1, + "Power": 1, + "Sleep": 1, + "EF2F": 1, + "CapsLock": 1, + "Enter": 3, + "WakeUp": 1, + "BackSpace": 1, + "C5E1": 1, + "C0E4": 1, + "Home": 1, + "Insert": 1, + "C9EA": 1, + "Down": 1, + "E5": 1, + "Right": 1, + "C2E8": 1, + "Esc": 1, + "DF": 2, + "F11": 1, + "EC": 1, + "PageDn": 1, + "ED": 1, + "PrScr": 1, + "C6E9": 1, + "ScrLock": 1, + "D6": 1, + "Uninitialized": 3, + "_________": 5, + "Key": 1, + "Codes": 1, + "keypress": 1, + "keystate": 2, + "E0..FF": 1, + "AS": 1, + "TV": 9, + "May": 2, + "tile": 41, + "size": 5, + "enable": 5, + "efficient": 2, + "tv_mode": 2, + "NTSC": 11, + "lntsc": 3, + "cycles": 4, + "per": 4, + "sync": 10, + "fpal": 2, + "_433_618": 2, + "PAL": 10, + "spal": 3, + "colortable": 7, + "inside": 2, + "tvptr": 3, + "starts": 4, + "available": 4, + "@entry": 3, + "Assembly": 2, + "language": 2, + "Entry": 2, + "tasks": 6, + "#10": 2, + "Superfield": 2, + "_mode": 7, + "interlace": 20, + "vinv": 2, + "hsync": 5, + "waitvid": 3, + "burst": 2, + "sync_high2": 2, + "task": 2, + "section": 4, + "undisturbed": 2, + "black": 2, + "visible": 7, + "vb": 2, + "leftmost": 1, + "_vt": 3, + "vertical": 29, + "expand": 3, + "vert": 1, + "vscl": 12, + "hb": 2, + "horizontal": 21, + "hx": 5, + "colors": 18, + "screen": 13, + "video": 7, + "repoint": 2, + "hf": 2, + "linerot": 5, + "field1": 4, + "unless": 2, + "invisible": 8, + "if_z_eq_c": 1, + "#hsync": 1, + "vsync": 4, + "pulses": 2, + "vsync1": 2, + "#sync_low1": 1, + "hhalf": 2, + "field2": 1, + "#superfield": 1, + "Blank": 1, + "Horizontal": 1, + "pal": 2, + "toggle": 1, + "phaseflip": 4, + "phasemask": 2, + "sync_scale1": 1, + "blank": 2, + "hsync_ret": 1, + "vsync_high": 1, + "#sync_high1": 1, + "Tasks": 1, + "performed": 1, + "sections": 1, + "during": 2, + "back": 8, + "porch": 9, + "load": 3, + "#_enable": 1, + "_pins": 4, + "_enable": 2, + "#disabled": 2, + "break": 6, + "return": 15, + "later": 6, + "rd": 1, + "#wtab": 1, + "ltab": 1, + "#ltab": 1, + "CLKFREQ": 10, + "cancel": 1, + "_broadcast": 4, + "m8": 3, + "jmpret": 5, + "taskptr": 3, + "taskret": 4, + "ctra": 5, + "pll": 5, + "fcolor": 4, + "#divide": 2, + "vco": 3, + "movi": 3, + "_111": 1, + "ctrb": 4, + "limit": 4, + "m128": 2, + "_100": 1, + "within": 5, + "_001": 1, + "frqb": 2, + "swap": 2, + "broadcast/baseband": 1, + "strip": 3, + "chroma": 19, + "baseband": 18, + "_auralcog": 1, + "_hx": 4, + "consider": 2, + "lineadd": 4, + "lineinc": 3, + "/160": 2, + "loaded": 3, + "#9": 2, + "FC": 2, + "_colors": 2, + "colorreg": 3, + "d6": 3, + "colorloop": 1, + "keep": 2, + "loading": 2, + "m1": 4, + "multiply_ret": 2, + "Disabled": 2, + "try": 2, + "again": 2, + "reload": 1, + "_000_000": 6, + "d0s1": 1, + "F0F0F0F0": 1, + "pins0": 1, + "_01110000_00001111_00000111": 1, + "pins1": 1, + "_11110111_01111111_01110111": 1, + "sync_high1": 1, + "_101010_0101": 1, + "NTSC/PAL": 2, + "metrics": 1, + "tables": 1, + "wtab": 1, + "sntsc": 3, + "lpal": 3, + "hrest": 2, + "vvis": 2, + "vrep": 2, + "_8A": 1, + "_AA": 1, + "sync_scale2": 1, + "_00000000_01_10101010101010_0101": 1, + "m2": 1, + "Parameter": 4, + "/non": 4, + "tccip": 3, + "_screen": 3, + "@long": 2, + "_ht": 2, + "_ho": 2, + "fit": 2, + "contiguous": 1, + "tv_status": 4, + "off/on": 3, + "tv_pins": 5, + "ntsc/pal": 3, + "tv_screen": 5, + "tv_ht": 5, + "tv_hx": 5, + "expansion": 8, + "tv_ho": 5, + "tv_broadcast": 4, + "aural": 13, + "fm": 6, + "preceding": 2, + "copied": 2, + "your": 2, + "code.": 2, + "After": 2, + "setting": 2, + "variables": 3, + "@tv_status": 3, + "All": 2, + "reloaded": 2, + "superframe": 2, + "allowing": 2, + "live": 2, + "changes.": 2, + "minimize": 2, + "correlate": 2, + "changes": 3, + "tv_status.": 1, + "Experimentation": 2, + "optimize": 2, + "some": 3, + "parameters.": 2, + "descriptions": 2, + "sets": 3, + "indicate": 2, + "disabled": 3, + "tv_enable": 2, + "requirement": 2, + "currently": 4, + "outputting": 4, + "driven": 2, + "reduces": 2, + "power": 3, + "_______": 2, + "select": 9, + "group": 7, + "_0111": 6, + "broadcast": 19, + "_1111": 6, + "_0000": 4, + "active": 3, + "top": 10, + "nibble": 4, + "bottom": 5, + "signal": 8, + "arranged": 3, + "attach": 1, + "ohm": 10, + "resistor": 4, + "sum": 7, + "/560/1100": 2, + "subcarrier": 3, + "network": 1, + "visual": 1, + "carrier": 1, + "selects": 4, + "x32": 6, + "tileheight": 4, + "controls": 4, + "mixing": 2, + "mix": 2, + "black/white": 2, + "composite": 1, + "progressive": 2, + "less": 5, + "good": 5, + "motion": 2, + "interlaced": 5, + "doubles": 1, + "format": 1, + "ticks": 11, + "must": 18, + "least": 14, + "_318_180": 1, + "_579_545": 1, + "Hz": 5, + "_734_472": 1, + "itself": 1, + "words": 5, + "define": 10, + "tv_vt": 3, + "has": 4, + "bitfields": 2, + "colorset": 2, + "ptr": 5, + "pixelgroup": 2, + "colorset*": 2, + "pixelgroup**": 2, + "ppppppppppcccc00": 2, + "colorsets": 4, + "four": 8, + "**": 2, + "pixelgroups": 2, + "": 5, + "tv_colors": 2, + "fields": 2, + "values": 2, + "luminance": 2, + "modulation": 4, + "adds/subtracts": 1, + "beware": 1, + "modulated": 1, + "produce": 1, + "saturated": 1, + "toggling": 1, + "levels": 1, + "because": 1, + "abruptly": 1, + "rather": 1, + "against": 1, + "white": 2, + "background": 1, + "best": 1, + "appearance": 1, + "_____": 6, + "practical": 2, + "/30": 1, + "factor": 4, + "sure": 4, + "||": 5, + "than": 5, + "tv_vx": 2, + "tv_vo": 2, + "pos/neg": 4, + "centered": 2, + "image": 2, + "shifts": 4, + "right/left": 2, + "up/down": 2, + "____________": 1, + "expressed": 1, + "ie": 1, + "channel": 1, + "_250_000": 2, + "modulator": 2, + "turned": 2, + "saves": 2, + "broadcasting": 1, + "___________": 1, + "tv_auralcog": 1, + "supply": 1, + "selected": 1, + "bandwidth": 2, + "KHz": 3, + "vary": 1, + "Terminal": 1, + "instead": 1, + "minimum": 2, + "x_scale": 4, + "x_spacing": 4, + "normal": 1, + "x_chr": 2, + "y_chr": 5, + "y_scale": 3, + "y_spacing": 3, + "y_offset": 2, + "x_limit": 2, + "x_screen": 1, + "y_limit": 3, + "y_screen": 4, + "y_max": 3, + "y_screen_bytes": 2, + "y_scroll": 2, + "y_scroll_longs": 4, + "y_clear": 2, + "y_clear_longs": 2, + "paramcount": 1, + "ccinp": 1, + "tv_hc": 1, + "cells": 1, + "cell": 1, + "@bitmap": 1, + "FC0": 1, + "gr.textmode": 1, + "gr.width": 1, + "tv.stop": 2, + "gr.stop": 1, + "schemes": 1, + "tab": 3, + "gr.color": 1, + "gr.text": 1, + "@c": 1, + "gr.finish": 2, + "newline": 3, + "strsize": 2, + "_000_000_000": 2, + "//": 4, + "elseif": 2, + "lookupz": 2, + "..": 4, + "PRI": 1, + "longmove": 2, + "longfill": 2, + "tvparams": 1, + "tvparams_pins": 1, + "_0101": 1, + "vc": 1, + "vx": 2, + "vo": 1, + "auralcog": 1, + "color_schemes": 1, + "BC_6C_05_02": 1, + "E_0D_0C_0A": 1, + "E_6D_6C_6A": 1, + "BE_BD_BC_BA": 1, + "Text": 1, + "x13": 2, + "cols": 5, + "rows": 4, + "screensize": 4, + "lastrow": 2, + "tv_count": 2, + "row": 4, + "tv": 2, + "basepin": 3, + "setcolors": 2, + "@palette": 1, + "@tv_params": 1, + "@screen": 3, + "tv.start": 1, + "stringptr": 3, + "k": 1, + "Output": 1, + "backspace": 1, + "spaces": 1, + "follows": 4, + "Y": 2, + "others": 1, + "printable": 1, + "characters": 1, + "wordfill": 2, + "print": 2, + "A..": 1, + "other": 1, + "colorptr": 2, + "fore": 3, + "Override": 1, + "default": 1, + "palette": 2, + "list": 1, + "scroll": 1, + "hc": 1, + "ho": 1, + "dark": 2, + "blue": 3, + "BB": 1, + "yellow": 1, + "brown": 1, + "cyan": 3, + "red": 2, + "pink": 1, + "VGA": 8, + "vga_mode": 3, + "vgaptr": 3, + "hv": 5, + "bcolor": 3, + "#colortable": 2, + "#blank_line": 3, + "nobl": 1, + "_vx": 1, + "nobp": 1, + "nofp": 1, + "#blank_hsync": 1, + "front": 4, + "vf": 1, + "nofl": 1, + "#tasks": 1, + "before": 1, + "_vs": 2, + "except": 1, + "#blank_vsync": 1, + "#field": 1, + "superfield": 1, + "blank_vsync": 1, + "h2": 2, + "if_c_and_nz": 1, + "blank_hsync": 1, + "_hf": 1, + "invisble": 1, + "_hb": 1, + "#hv": 1, + "blank_hsync_ret": 1, + "blank_line_ret": 1, + "blank_vsync_ret": 1, + "_status": 1, + "#paramcount": 1, + "directions": 1, + "_rate": 3, + "pllmin": 1, + "_011": 1, + "rate": 6, + "hvbase": 5, + "frqa": 3, + "vmask": 1, + "hmask": 1, + "vcfg": 2, + "colormask": 1, + "waitcnt": 3, + "#entry": 1, + "Initialized": 1, + "lowest": 1, + "pllmax": 1, + "*16": 1, + "m4": 1, + "tihv": 1, + "_hd": 1, + "_hs": 1, + "_vd": 1, + "underneath": 1, + "BF": 1, + "___": 1, + "/1/2": 1, + "off/visible/invisible": 1, + "vga_enable": 3, + "pppttt": 1, + "vga_colors": 2, + "vga_vt": 6, + "vga_vx": 4, + "vga_vo": 4, + "vga_hf": 2, + "vga_hb": 2, + "vga_vf": 2, + "vga_vb": 2, + "tick": 2, + "@vga_status": 1, + "vga_status.": 1, + "__________": 4, + "vga_status": 1, + "________": 3, + "vga_pins": 1, + "monitors": 1, + "allows": 1, + "polarity": 1, + "respectively": 1, + "vga_screen": 1, + "vga_ht": 3, + "care": 1, + "suggested": 1, + "bits/pins": 3, + "green": 1, + "bit/pin": 1, + "signals": 1, + "connect": 3, + "RED": 1, + "BLUE": 1, + "connector": 3, + "always": 2, + "HSYNC": 1, + "VSYNC": 1, + "______": 14, + "vga_hx": 3, + "vga_ho": 2, + "equal": 1, + "vga_hd": 2, + "exceed": 1, + "vga_vd": 2, + "recommended": 2, + "vga_hs": 1, + "vga_vs": 1, + "vga_rate": 2, + "should": 1, + "Vocal": 2, + "Tract": 2, + "October": 1, + "synthesizes": 1, + "human": 1, + "vocal": 10, + "tract": 12, + "real": 2, + "It": 1, + "MHz.": 1, + "controlled": 1, + "reside": 1, + "parent": 1, + "aa": 2, + "ga": 5, + "gp": 2, + "vp": 3, + "vr": 1, + "f1": 4, + "f2": 1, + "f3": 3, + "f4": 2, + "na": 2, + "nf": 2, + "fa": 2, + "ff": 2, + "values.": 2, + "Before": 1, + "were": 1, + "interpolation": 1, + "shy": 1, + "frame": 12, + "makes": 1, + "behave": 1, + "sensibly": 1, + "gaps.": 1, + "frame_buffers": 2, + "bytes": 2, + "frame_longs": 3, + "frame_bytes": 1, + "...must": 1, + "dira_": 3, + "dirb_": 1, + "ctra_": 1, + "ctrb_": 3, + "frqa_": 3, + "cnt_": 1, + "many": 1, + "...contiguous": 1, + "tract_ptr": 3, + "pos_pin": 7, + "neg_pin": 6, + "fm_offset": 5, + "positive": 1, + "also": 1, + "enabled": 2, + "generation": 2, + "_500_000": 1, + "Remember": 1, + "duty": 2, + "Ready": 1, + "clkfreq": 2, + "Launch": 1, + "@attenuation": 1, + "Reset": 1, + "buffers": 1, + "@index": 1, + "constant": 3, + "frame_buffer_longs": 2, + "set_attenuation": 1, + "master": 2, + "attenuation": 3, + "initially": 2, + "set_pace": 2, + "percentage": 3, + "pace": 3, + "go": 1, + "Queue": 1, + "transition": 1, + "over": 2, + "Load": 1, + "bytemove": 1, + "@frames": 1, + "index": 5, + "Increment": 1, + "Returns": 4, + "queue": 2, + "useful": 2, + "checking": 1, + "would": 1, + "have": 1, + "frames": 2, + "empty": 2, + "detecting": 1, + "finished": 1, + "sample_ptr": 1, + "receives": 1, + "audio": 1, + "samples": 1, + "updated": 1, + "@sample": 1, + "aural_id": 1, + "id": 2, + "executing": 1, + "algorithm": 1, + "connecting": 1, + "Initialization": 1, + "reserved": 3, + "clear_cnt": 1, + "#2*15": 1, + "hub": 1, + "minst": 3, + "d0s0": 3, + "mult_ret": 1, + "antilog_ret": 1, + "assemble": 1, + "cordic": 4, + "reserves": 2, + "cstep": 1, + "instruction": 2, + "prepare": 1, + "cnt_value": 3, + "cnt_ticks": 3, + "Loop": 1, + "sample": 2, + "period": 1, + "cycle": 1, + "driving": 1, + "h80000000": 2, + "White": 1, + "noise": 3, + "source": 2, + "lfsr": 1, + "lfsr_taps": 2, + "Aspiration": 1, + "vibrato": 3, + "vphase": 2, + "glottal": 2, + "pitch": 5, + "mesh": 1, + "tune": 2, + "convert": 1, + "log": 2, + "phase": 2, + "gphase": 3, + "formant2": 2, + "rotate": 2, + "f2x": 3, + "f2y": 3, + "#cordic": 2, + "formant4": 2, + "f4x": 3, + "f4y": 3, + "subtract": 1, + "nx": 4, + "negated": 1, + "nasal": 2, + "amplitude": 3, + "#mult": 1, + "fphase": 4, + "frication": 2, + "#sine": 1, + "Handle": 1, + "frame_ptr": 6, + "past": 1, + "miscellaneous": 2, + "frame_index": 3, + "stepsize": 2, + "step_size": 5, + "h00FFFFFF": 2, + "final1": 2, + "finali": 2, + "iterate": 3, + "aa..ff": 4, + "accurate": 1, + "accumulation": 1, + "step_acc": 3, + "set2": 3, + "#par_curr": 1, + "set3": 2, + "#par_next": 1, + "set4": 3, + "#par_step": 1, + "#24": 1, + "par_curr": 3, + "absolute": 1, + "msb": 2, + "nr": 1, + "mult": 2, + "par_step": 1, + "frame_cnt": 2, + "step1": 2, + "stepi": 1, + "stepframe": 1, + "#frame_bytes": 1, + "par_next": 2, + "Math": 1, + "Subroutines": 1, + "Antilog": 1, + "whole": 2, + "fraction": 1, + "antilog": 2, + "FFEA0000": 1, + "h00000FFE": 2, + "insert": 2, + "leading": 1, + "Scaled": 1, + "unsigned": 3, + "h00001000": 2, + "negc": 1, + "Multiply": 1, + "#15": 1, + "mult_step": 1, + "Cordic": 1, + "degree": 1, + "#cordic_steps": 1, + "gets": 1, + "assembled": 1, + "cordic_dx": 1, + "incremented": 1, + "cordic_a": 1, + "cordic_delta": 2, + "linear": 1, + "register": 1, + "B901476": 1, + "greater": 1, + "h40000000": 1, + "h01000000": 1, + "FFFFFF": 1, + "h00010000": 1, + "h0000D000": 1, + "D000": 1, + "h00007000": 1, + "FFE": 1, + "h00000800": 1, + "registers": 2, + "startup": 2, + "Data": 1, + "zeroed": 1, + "cleared": 1, + "f1x": 1, + "f1y": 1, + "f3x": 1, + "f3y": 1, + "aspiration": 1, + "***": 1, + "mult_steps": 1, + "assembly": 1, + "area": 1, + "w/ret": 1, + "cordic_ret": 1 + }, "Protocol Buffer": { "package": 1, "tutorial": 1, @@ -39777,34 +55574,464 @@ "AddressBook": 1, "person": 1 }, + "PureScript": { + "module": 4, + "Control.Arrow": 1, + "where": 20, + "import": 32, + "Data.Tuple": 3, + "class": 4, + "Arrow": 5, + "a": 46, + "arr": 10, + "forall": 26, + "b": 49, + "c.": 3, + "(": 111, + "-": 88, + "c": 17, + ")": 115, + "first": 4, + "d.": 2, + "Tuple": 21, + "d": 6, + "instance": 12, + "arrowFunction": 1, + "f": 28, + "second": 3, + "Category": 3, + "swap": 4, + "b.": 1, + "x": 26, + "y": 2, + "infixr": 3, + "***": 2, + "&&": 3, + "&": 3, + ".": 2, + "g": 4, + "ArrowZero": 1, + "zeroArrow": 1, + "<+>": 2, + "ArrowPlus": 1, + "Data.Foreign": 2, + "Foreign": 12, + "..": 1, + "ForeignParser": 29, + "parseForeign": 6, + "parseJSON": 3, + "ReadForeign": 11, + "read": 10, + "prop": 3, + "Prelude": 3, + "Data.Array": 3, + "Data.Either": 1, + "Data.Maybe": 3, + "Data.Traversable": 2, + "foreign": 6, + "data": 3, + "*": 1, + "fromString": 2, + "String": 13, + "Either": 6, + "readPrimType": 5, + "a.": 6, + "readMaybeImpl": 2, + "Maybe": 5, + "readPropImpl": 2, + "showForeignImpl": 2, + "showForeign": 1, + "Prelude.Show": 1, + "show": 5, + "p": 11, + "json": 2, + "monadForeignParser": 1, + "Prelude.Monad": 1, + "return": 6, + "_": 7, + "Right": 9, + "case": 9, + "of": 9, + "Left": 8, + "err": 8, + "applicativeForeignParser": 1, + "Prelude.Applicative": 1, + "pure": 1, + "<*>": 2, + "<$>": 8, + "functorForeignParser": 1, + "Prelude.Functor": 1, + "readString": 1, + "readNumber": 1, + "Number": 1, + "readBoolean": 1, + "Boolean": 1, + "readArray": 1, + "[": 5, + "]": 5, + "let": 4, + "arrayItem": 2, + "i": 2, + "result": 4, + "+": 30, + "in": 2, + "xs": 3, + "traverse": 2, + "zip": 1, + "range": 1, + "length": 3, + "readMaybe": 1, + "<<": 4, + "<": 13, + "Just": 7, + "Nothing": 7, + "Data.Map": 1, + "Map": 26, + "empty": 6, + "singleton": 5, + "insert": 10, + "lookup": 8, + "delete": 9, + "alter": 8, + "toList": 10, + "fromList": 3, + "union": 3, + "map": 8, + "qualified": 1, + "as": 1, + "P": 1, + "concat": 3, + "Data.Foldable": 2, + "foldl": 4, + "k": 108, + "v": 57, + "Leaf": 15, + "|": 9, + "Branch": 27, + "{": 25, + "key": 13, + "value": 8, + "left": 15, + "right": 14, + "}": 26, + "eqMap": 1, + "P.Eq": 11, + "m1": 6, + "m2": 6, + "P.": 11, + "/": 1, + "P.not": 1, + "showMap": 1, + "P.Show": 3, + "m": 6, + "P.show": 1, + "v.": 11, + "P.Ord": 9, + "b@": 6, + "k1": 16, + "b.left": 9, + "b.right": 8, + "findMinKey": 5, + "glue": 4, + "minKey": 3, + "root": 2, + "b.key": 1, + "b.value": 2, + "v1": 3, + "v2.": 1, + "v2": 2, + "ReactiveJQueryTest": 1, + "flip": 2, + "Control.Monad": 1, + "Control.Monad.Eff": 1, + "Control.Monad.JQuery": 1, + "Control.Reactive": 1, + "Control.Reactive.JQuery": 1, + "head": 2, + "Data.Monoid": 1, + "Debug.Trace": 1, + "Global": 1, + "parseInt": 1, + "main": 1, + "do": 4, + "personDemo": 2, + "todoListDemo": 1, + "greet": 1, + "firstName": 2, + "lastName": 2, + "Create": 3, + "new": 1, + "reactive": 1, + "variables": 1, + "to": 3, + "hold": 1, + "the": 3, + "user": 1, + "readRArray": 1, + "insertRArray": 1, + "text": 5, + "completed": 2, + "paragraph": 2, + "display": 2, + "next": 1, + "task": 4, + "nextTaskLabel": 3, + "create": 2, + "append": 2, + "nextTask": 2, + "toComputedArray": 2, + "toComputed": 2, + "bindTextOneWay": 2, + "counter": 3, + "counterLabel": 3, + "rs": 2, + "cs": 2, + "<->": 1, + "if": 1, + "then": 1, + "else": 1, + "entry": 1, + "entry.completed": 1 + }, "Python": { - "from": 34, + "xspacing": 4, + "#": 28, + "How": 2, + "far": 1, + "apart": 1, + "should": 1, + "each": 1, + "horizontal": 1, + "location": 1, + "be": 1, + "spaced": 1, + "maxwaves": 3, + "total": 1, + "of": 5, + "waves": 1, + "to": 5, + "add": 1, + "together": 1, + "theta": 3, + "amplitude": 3, + "[": 165, + "]": 165, + "Height": 1, + "wave": 2, + "dx": 8, + "yvalues": 7, + "def": 87, + "setup": 2, + "(": 850, + ")": 861, + "size": 5, + "frameRate": 1, + "colorMode": 1, + "RGB": 1, + "w": 2, + "width": 1, + "+": 51, + "for": 69, + "i": 13, + "in": 91, + "range": 5, + "amplitude.append": 1, + "random": 2, + "period": 2, + "many": 1, + "pixels": 1, + "before": 1, + "the": 6, + "repeats": 1, + "dx.append": 1, + "TWO_PI": 1, + "/": 26, + "*": 38, + "_": 6, + "yvalues.append": 1, + "draw": 2, + "background": 2, + "calcWave": 2, + "renderWave": 2, + "len": 11, + "j": 7, + "x": 34, + "if": 160, + "%": 33, + "sin": 1, + "else": 33, + "cos": 1, + "noStroke": 2, + "fill": 2, + "ellipseMode": 1, + "CENTER": 1, + "v": 19, + "enumerate": 2, + "ellipse": 1, + "height": 1, + "import": 55, + "os": 2, + "sys": 3, + "json": 1, + "c4d": 1, + "c4dtools": 1, + "itertools": 1, + "from": 36, + "c4d.modules": 1, + "graphview": 1, + "as": 14, + "gv": 1, + "c4dtools.misc": 1, + "graphnode": 1, + "res": 3, + "importer": 1, + "c4dtools.prepare": 1, + "__file__": 1, + "__res__": 1, + "settings": 2, + "c4dtools.helpers.Attributor": 2, + "{": 27, + "res.file": 3, + "}": 27, + "align_nodes": 2, + "nodes": 11, + "mode": 5, + "spacing": 7, + "r": 9, + "modes": 3, + "not": 69, + "return": 68, + "raise": 23, + "ValueError": 6, + ".join": 4, + "get_0": 12, + "lambda": 6, + "x.x": 1, + "get_1": 4, + "x.y": 1, + "set_0": 6, + "setattr": 16, + "set_1": 4, + "graphnode.GraphNode": 1, + "n": 6, + "nodes.sort": 1, + "key": 6, + "n.position": 1, + "midpoint": 3, + "graphnode.find_nodes_mid": 1, + "first_position": 2, + ".position": 1, + "new_positions": 2, + "prev_offset": 6, + "node": 2, + "position": 12, + "node.position": 2, + "-": 36, + "node.size": 1, + "<": 2, + "new_positions.append": 1, + "bbox_size": 2, + "bbox_size_2": 2, + "itertools.izip": 1, + "align_nodes_shortcut": 3, + "master": 2, + "gv.GetMaster": 1, + "root": 3, + "master.GetRoot": 1, + "graphnode.find_selected_nodes": 1, + "master.AddUndo": 1, + "c4d.EventAdd": 1, + "True": 25, + "class": 19, + "XPAT_Options": 3, + "defaults": 1, + "__init__": 7, + "self": 113, + "filename": 12, + "None": 92, + "super": 4, + ".__init__": 3, + "self.load": 1, + "load": 1, + "is": 31, + "settings.options_filename": 2, + "os.path.isfile": 1, + "self.dict_": 2, + "self.defaults.copy": 2, + "with": 2, + "open": 2, + "fp": 4, + "self.dict_.update": 1, + "json.load": 1, + "self.save": 1, + "save": 2, + "values": 15, + "dict": 4, + "k": 7, + "self.dict_.iteritems": 1, + "self.defaults": 1, + "json.dump": 1, + "XPAT_OptionsDialog": 2, + "c4d.gui.GeDialog": 1, + "CreateLayout": 1, + "self.LoadDialogResource": 1, + "res.DLG_OPTIONS": 1, + "InitValues": 1, + "self.SetLong": 2, + "res.EDT_HSPACE": 2, + "options.hspace": 3, + "res.EDT_VSPACE": 2, + "options.vspace": 3, + "Command": 1, + "id": 2, + "msg": 1, + "res.BTN_SAVE": 1, + "self.GetLong": 2, + "options.save": 1, + "self.Close": 1, + "XPAT_Command_OpenOptionsDialog": 2, + "c4dtools.plugins.Command": 3, + "self._dialog": 4, + "@property": 2, + "dialog": 1, + "PLUGIN_ID": 3, + "PLUGIN_NAME": 3, + "res.string.XPAT_COMMAND_OPENOPTIONSDIALOG": 1, + "PLUGIN_HELP": 3, + "res.string.XPAT_COMMAND_OPENOPTIONSDIALOG_HELP": 1, + "Execute": 3, + "doc": 3, + "self.dialog.Open": 1, + "c4d.DLG_TYPE_MODAL": 1, + "XPAT_Command_AlignHorizontal": 1, + "res.string.XPAT_COMMAND_ALIGNHORIZONTAL": 1, + "PLUGIN_ICON": 2, + "res.string.XPAT_COMMAND_ALIGNHORIZONTAL_HELP": 1, + "XPAT_Command_AlignVertical": 1, + "res.string.XPAT_COMMAND_ALIGNVERTICAL": 1, + "res.string.XPAT_COMMAND_ALIGNVERTICAL_HELP": 1, + "options": 4, + "__name__": 3, + "c4dtools.plugins.main": 1, "__future__": 2, - "import": 47, "unicode_literals": 1, "copy": 1, - "sys": 2, "functools": 1, "update_wrapper": 2, "future_builtins": 1, "zip": 8, "django.db.models.manager": 1, - "#": 13, "Imported": 1, - "to": 4, "register": 1, "signal": 1, "handler.": 1, "django.conf": 1, - "settings": 1, "django.core.exceptions": 1, - "(": 719, "ObjectDoesNotExist": 2, "MultipleObjectsReturned": 2, "FieldError": 4, "ValidationError": 8, "NON_FIELD_ERRORS": 3, - ")": 730, "django.core": 1, "validators": 1, "django.db.models.fields": 1, @@ -39834,8 +56061,6 @@ "get_model": 3, "django.utils.translation": 1, "ugettext_lazy": 1, - "as": 11, - "_": 5, "django.utils.functional": 1, "curry": 6, "django.utils.encoding": 1, @@ -39844,54 +56069,37 @@ "django.utils.text": 1, "get_text_list": 2, "capfirst": 6, - "class": 14, "ModelBase": 4, "type": 6, - "def": 68, "__new__": 2, "cls": 32, "name": 39, "bases": 6, "attrs": 7, "super_new": 3, - "super": 2, ".__new__": 1, "parents": 8, - "[": 152, "b": 11, - "for": 59, - "in": 79, - "if": 145, "isinstance": 11, - "]": 152, - "not": 64, - "return": 57, "module": 6, "attrs.pop": 2, "new_class": 9, - "{": 25, - "}": 25, "attr_meta": 5, - "None": 86, "abstract": 3, "getattr": 30, "False": 28, "meta": 12, - "else": 30, "base_meta": 2, - "is": 29, "model_module": 1, "sys.modules": 1, "new_class.__module__": 1, "kwargs": 9, "model_module.__name__.split": 1, - "-": 30, "new_class.add_to_class": 7, "**kwargs": 9, "subclass_exception": 3, "tuple": 3, "x.DoesNotExist": 1, - "x": 22, "hasattr": 11, "and": 35, "x._meta.abstract": 2, @@ -39917,7 +56125,6 @@ "attrs.items": 1, "new_fields": 2, "new_class._meta.local_fields": 3, - "+": 37, "new_class._meta.local_many_to_many": 2, "new_class._meta.virtual_fields": 1, "field_names": 5, @@ -39928,15 +56135,12 @@ "parent": 5, "parent._meta.abstract": 1, "parent._meta.fields": 1, - "raise": 22, "TypeError": 4, - "%": 32, "continue": 10, "new_class._meta.setup_proxy": 1, "new_class._meta.concrete_model": 2, "base._meta.concrete_model": 2, "o2o_map": 3, - "dict": 3, "f.rel.to": 1, "original_base": 1, "parent_fields": 3, @@ -39950,7 +56154,6 @@ "attr_name": 3, "base._meta.module_name": 1, "auto_created": 1, - "True": 20, "parent_link": 1, "new_class._meta.parents": 1, "copy.deepcopy": 2, @@ -39975,7 +56178,6 @@ "add_to_class": 1, "value": 9, "value.contribute_to_class": 1, - "setattr": 14, "_prepare": 1, "opts": 5, "cls._meta": 3, @@ -39994,7 +56196,6 @@ "opts.order_with_respect_to.rel.to": 1, "cls.__doc__": 3, "cls.__name__": 1, - ".join": 3, "f.attname": 5, "opts.fields": 1, "cls.get_absolute_url": 3, @@ -40003,8 +56204,6 @@ "sender": 5, "ModelState": 2, "object": 6, - "__init__": 5, - "self": 100, "db": 2, "self.db": 1, "self.adding": 1, @@ -40017,7 +56216,6 @@ "args": 8, "self._state": 1, "args_len": 2, - "len": 9, "self._meta.fields": 5, "IndexError": 2, "fields_iter": 4, @@ -40038,7 +56236,6 @@ "property": 2, "AttributeError": 1, "pass": 4, - ".__init__": 1, "signals.post_init.send": 1, "instance": 5, "__repr__": 2, @@ -40077,12 +56274,10 @@ "serializable_value": 1, "field_name": 8, "self._meta.get_field_by_name": 1, - "save": 1, "force_insert": 7, "force_update": 10, "using": 30, "update_fields": 23, - "ValueError": 5, "frozenset": 2, "field.primary_key": 1, "non_model_fields": 2, @@ -40111,13 +56306,11 @@ "manager.using": 3, ".filter": 7, ".exists": 1, - "values": 13, "f.pre_save": 1, "rows": 3, "._update": 1, "meta.order_with_respect_to": 2, "order_value": 2, - "*": 33, ".count": 1, "self._order": 1, "fields": 12, @@ -40177,8 +56370,6 @@ "self._perform_unique_checks": 1, "date_errors": 1, "self._perform_date_checks": 1, - "k": 4, - "v": 11, "date_errors.items": 1, "errors.setdefault": 3, ".extend": 2, @@ -40216,7 +56407,6 @@ "model_class._meta": 2, "qs.exclude": 2, "qs.exists": 2, - "key": 5, ".append": 2, "self.unique_error_message": 1, "_perform_date_checks": 1, @@ -40238,7 +56428,6 @@ "field.error_messages": 1, "field_labels": 4, "map": 1, - "lambda": 1, "full_clean": 1, "self.clean_fields": 1, "e": 13, @@ -40260,15 +56449,11 @@ "ordered_obj._meta.order_with_respect_to.rel.field_name": 2, "order_name": 4, "ordered_obj._meta.order_with_respect_to.name": 2, - "i": 7, - "j": 2, - "enumerate": 1, "ordered_obj.objects.filter": 2, ".update": 1, "_order": 1, "pk_name": 3, "ordered_obj._meta.pk.name": 1, - "r": 3, ".values": 1, "##############################################": 2, "func": 2, @@ -40297,8 +56482,6 @@ "decorate": 2, "based": 1, "views": 1, - "the": 5, - "of": 3, "as_view": 1, ".": 1, "However": 1, @@ -40334,6 +56517,22 @@ "meth": 5, "request.method.lower": 1, "request.method": 2, + "P3D": 1, + "lights": 1, + "camera": 1, + "mouseY": 1, + "eyeX": 1, + "eyeY": 1, + "eyeZ": 1, + "centerX": 1, + "centerY": 1, + "centerZ": 1, + "upX": 1, + "upY": 1, + "upZ": 1, + "box": 1, + "stroke": 1, + "line": 3, "google.protobuf": 4, "descriptor": 1, "_descriptor": 1, @@ -40349,7 +56548,6 @@ "_PERSON": 3, "_descriptor.Descriptor": 1, "full_name": 2, - "filename": 1, "file": 1, "containing_type": 2, "_descriptor.FieldDescriptor": 1, @@ -40363,7 +56561,6 @@ "enum_type": 1, "is_extension": 1, "extension_scope": 1, - "options": 3, "extensions": 1, "nested_types": 1, "enum_types": 1, @@ -40377,13 +56574,11 @@ "_reflection.GeneratedProtocolMessageType": 1, "SHEBANG#!python": 4, "print": 39, - "os": 1, "main": 4, "usage": 3, "string": 1, "command": 4, "sys.argv": 2, - "<": 1, "sys.exit": 1, "printDelimiter": 4, "get": 1, @@ -40406,7 +56601,6 @@ "os.walk": 1, ".next": 1, "os.path.isdir": 1, - "__name__": 2, "argparse": 1, "matplotlib.pyplot": 1, "pl": 1, @@ -40419,7 +56613,6 @@ "S": 4, "phif": 7, "U": 10, - "/": 23, "_parse_args": 2, "V": 12, "np.genfromtxt": 8, @@ -40516,7 +56709,6 @@ "phi": 5, "c": 3, "a*x": 1, - "dx": 6, "d**": 2, "dy": 4, "dx_err": 3, @@ -40708,7 +56900,6 @@ "uri.partition": 1, "self.arguments": 2, "supports_http_1_1": 1, - "@property": 1, "cookies": 1, "self._cookies": 3, "Cookie.SimpleCookie": 1, @@ -40720,10 +56911,8 @@ "get_ssl_certificate": 1, "self.connection.stream.socket.getpeercert": 1, "ssl.SSLError": 1, - "n": 3, "_valid_ip": 1, "ip": 2, - "res": 2, "socket.getaddrinfo": 1, "socket.AF_UNSPEC": 1, "socket.SOCK_STREAM": 1, @@ -40733,36 +56922,133 @@ "socket.EAI_NONAME": 1 }, "R": { - "SHEBANG#!Rscript": 1, + "df.residual.mira": 1, + "<": 46, + "-": 53, + "function": 18, + "(": 219, + "object": 12, + "...": 4, + ")": 220, + "{": 58, + "fit": 2, + "analyses": 1, + "[": 23, + "]": 24, + "return": 8, + "df.residual": 2, + "}": 58, + "df.residual.lme": 1, + "fixDF": 1, + "df.residual.mer": 1, + "sum": 1, + "object@dims": 1, + "*": 2, + "c": 11, + "+": 4, + "df.residual.default": 1, + "q": 3, + "df": 3, + "if": 19, + "is.null": 8, + "mk": 2, + "try": 3, + "coef": 1, + "silent": 3, + "TRUE": 14, + "mn": 2, + "f": 9, + "fitted": 1, + "inherits": 6, + "|": 3, + "NULL": 2, + "n": 3, + "ifelse": 1, + "is.data.frame": 1, + "is.matrix": 1, + "nrow": 1, + "length": 3, + "k": 3, + "max": 1, + "SHEBANG#!Rscript": 2, + "#": 45, + "MedianNorm": 2, + "data": 13, + "geomeans": 3, + "<->": 1, + "exp": 1, + "rowMeans": 1, + "log": 5, + "apply": 2, + "2": 1, + "cnts": 2, + "median": 1, + "library": 1, + "print_usage": 2, + "file": 4, + "stderr": 1, + "cat": 1, + "spec": 2, + "matrix": 3, + "byrow": 3, + "ncol": 3, + "opt": 23, + "getopt": 1, + "help": 1, + "stdout": 1, + "status": 1, + "height": 7, + "out": 4, + "res": 6, + "width": 7, + "ylim": 7, + "read.table": 1, + "header": 1, + "sep": 4, + "quote": 1, + "nsamp": 8, + "dim": 1, + "outfile": 4, + "sprintf": 2, + "png": 2, + "h": 13, + "hist": 4, + "plot": 7, + "FALSE": 9, + "mids": 4, + "density": 4, + "type": 3, + "col": 4, + "rainbow": 4, + "main": 2, + "xlab": 2, + "ylab": 2, + "for": 4, + "i": 6, + "in": 8, + "lines": 6, + "devnum": 2, + "dev.off": 2, + "size.factors": 2, + "data.matrix": 1, + "data.norm": 3, + "t": 1, + "x": 3, + "/": 1, "ParseDates": 2, - "<": 12, - "-": 12, - "function": 3, - "(": 29, - "lines": 4, - ")": 29, - "{": 3, "dates": 3, - "matrix": 2, "unlist": 2, - "strsplit": 2, - "ncol": 2, - "byrow": 2, - "TRUE": 3, + "strsplit": 3, "days": 2, - "[": 4, - "]": 4, "times": 2, "hours": 2, "all.days": 2, - "c": 2, "all.hours": 2, "data.frame": 1, "Day": 2, "factor": 2, "levels": 2, "Hour": 2, - "}": 3, "Main": 2, "system": 1, "intern": 1, @@ -40773,8 +57059,6 @@ "ggplot": 1, "aes": 2, "y": 1, - "x": 1, - "+": 2, "geom_point": 1, "size": 1, "Freq": 1, @@ -40782,11 +57066,214 @@ "range": 1, "ggsave": 1, "filename": 1, - "plot": 1, - "width": 1, - "height": 1, "hello": 2, "print": 1, + "module": 25, + "code": 21, + "available": 1, + "via": 1, + "the": 16, + "environment": 4, + "like": 1, + "it": 3, + "returns.": 1, + "@param": 2, + "an": 1, + "identifier": 1, + "specifying": 1, + "full": 1, + "path": 9, + "search": 5, + "see": 1, + "Details": 1, + "even": 1, + "attach": 11, + "is": 7, + "optionally": 1, + "attached": 2, + "to": 9, + "of": 2, + "current": 2, + "scope": 1, + "defaults": 1, + ".": 7, + "However": 1, + "interactive": 2, + "invoked": 1, + "directly": 1, + "from": 5, + "terminal": 1, + "only": 1, + "i.e.": 1, + "not": 4, + "within": 1, + "modules": 4, + "import.attach": 1, + "can": 3, + "be": 8, + "set": 2, + "or": 1, + "depending": 1, + "on": 2, + "user": 1, + "s": 2, + "preference.": 1, + "attach_operators": 3, + "causes": 1, + "emph": 3, + "operators": 3, + "by": 2, + "default": 1, + "path.": 1, + "Not": 1, + "attaching": 1, + "them": 1, + "therefore": 1, + "drastically": 1, + "limits": 1, + "a": 6, + "usefulness.": 1, + "Modules": 1, + "are": 4, + "searched": 1, + "options": 1, + "priority.": 1, + "The": 5, + "directory": 1, + "always": 1, + "considered": 1, + "first.": 1, + "That": 1, + "local": 3, + "./a.r": 1, + "will": 2, + "loaded.": 1, + "Module": 1, + "names": 2, + "fully": 1, + "qualified": 1, + "refer": 1, + "nested": 1, + "paths.": 1, + "See": 1, + "import": 5, + "executed": 1, + "global": 1, + "effect": 1, + "same.": 1, + "When": 1, + "used": 2, + "globally": 1, + "inside": 1, + "newly": 2, + "outside": 1, + "nor": 1, + "other": 2, + "which": 3, + "might": 1, + "loaded": 4, + "@examples": 1, + "@seealso": 3, + "reload": 3, + "@export": 2, + "substitute": 2, + "stopifnot": 3, + "missing": 1, + "&&": 2, + "module_name": 7, + "getOption": 1, + "else": 4, + "class": 4, + "module_path": 15, + "find_module": 1, + "stop": 1, + "attr": 2, + "message": 1, + "containing_modules": 3, + "module_init_files": 1, + "mapply": 1, + "do_import": 4, + "mod_ns": 5, + "as.character": 3, + "module_parent": 8, + "parent.frame": 2, + "mod_env": 7, + "exhibit_namespace": 3, + "identical": 2, + ".GlobalEnv": 2, + "name": 10, + "environmentName": 2, + "parent.env": 4, + "export_operators": 2, + "invisible": 1, + "is_module_loaded": 1, + "get_loaded_module": 1, + "namespace": 13, + "structure": 3, + "new.env": 1, + "parent": 9, + ".BaseNamespaceEnv": 1, + "paste": 3, + "source": 3, + "chdir": 1, + "envir": 5, + "cache_module": 1, + "exported_functions": 2, + "lsf.str": 2, + "list2env": 2, + "sapply": 2, + "get": 2, + "ops": 2, + "is_predefined": 2, + "%": 2, + "is_op": 2, + "prefix": 3, + "||": 1, + "grepl": 1, + "Filter": 1, + "op_env": 4, + "cache.": 1, + "@note": 1, + "Any": 1, + "references": 1, + "remain": 1, + "unchanged": 1, + "and": 5, + "files": 1, + "would": 1, + "have": 1, + "happened": 1, + "without": 1, + "unload": 2, + "should": 2, + "production": 1, + "code.": 1, + "does": 1, + "currently": 1, + "detach": 1, + "environments.": 1, + "Reload": 1, + "given": 1, + "Remove": 1, + "cache": 1, + "forcing": 1, + "reload.": 1, + "reloaded": 1, + "reference": 1, + "unloaded": 1, + "still": 1, + "work.": 1, + "Reloading": 1, + "primarily": 1, + "useful": 1, + "testing": 1, + "during": 1, + "module_ref": 3, + "rm": 1, + "list": 1, + ".loaded_modules": 1, + "whatnot.": 1, + "assign": 1, "##polyg": 1, "vector": 2, "##numpoints": 1, @@ -40801,7 +57288,57 @@ "spsample": 1, "polyg": 1, "numpoints": 1, - "type": 1 + "docType": 1, + "package": 5, + "scholar": 6, + "alias": 2, + "title": 1, + "reads": 1, + "url": 2, + "http": 2, + "//scholar.google.com": 1, + "Dates": 1, + "citation": 2, + "counts": 1, + "estimated": 1, + "determined": 1, + "automatically": 1, + "computer": 1, + "program.": 1, + "Use": 1, + "at": 2, + "your": 1, + "own": 1, + "risk.": 1, + "description": 1, + "provides": 1, + "functions": 3, + "extract": 1, + "Google": 2, + "Scholar.": 1, + "There": 1, + "also": 1, + "convenience": 1, + "comparing": 1, + "multiple": 1, + "scholars": 1, + "predicting": 1, + "index": 1, + "scores": 1, + "based": 1, + "past": 1, + "publication": 1, + "records.": 1, + "note": 1, + "A": 1, + "complementary": 1, + "Scholar": 1, + "found": 1, + "//biostat.jhsph.edu/": 1, + "jleek/code/googleCite.r": 1, + "was": 1, + "developed": 1, + "independently.": 1 }, "Racket": { ";": 3, @@ -41220,12 +57757,398 @@ "purpose.": 1 }, "Rebol": { - "REBOL": 1, - "[": 3, - "]": 3, - "hello": 2, + "REBOL": 5, + "[": 54, + "System": 1, + "Title": 2, + "Rights": 1, + "{": 8, + "Copyright": 1, + "Technologies": 2, + "is": 4, + "a": 2, + "trademark": 1, + "of": 1, + "}": 8, + "License": 2, + "Licensed": 1, + "under": 1, + "the": 3, + "Apache": 1, + "Version": 1, + "See": 1, + "http": 1, + "//www.apache.org/licenses/LICENSE": 1, + "-": 26, + "Purpose": 1, + "These": 1, + "are": 2, + "used": 3, + "to": 2, + "define": 1, + "natives": 1, + "and": 2, + "actions.": 1, + "Bind": 1, + "attributes": 1, + "for": 4, + "this": 1, + "block": 5, + "BIND_SET": 1, + "SHALLOW": 1, + "]": 61, + ";": 19, + "Special": 1, + "as": 1, + "spec": 3, + "datatype": 2, + "test": 1, + "functions": 1, + "(": 30, + "e.g.": 1, + "time": 2, + ")": 33, + "value": 1, + "any": 1, + "type": 1, + "The": 1, + "native": 5, + "function": 3, + "must": 1, + "be": 1, + "defined": 1, + "first.": 1, + "This": 1, + "special": 1, + "boot": 1, + "created": 1, + "manually": 1, + "within": 1, + "C": 1, + "code.": 1, + "Creates": 2, + "internal": 2, + "usage": 2, + "only": 2, + ".": 4, + "no": 3, + "check": 2, + "required": 2, + "we": 2, + "know": 2, + "it": 2, + "correct": 2, + "action": 2, + "Rebol": 4, + "re": 20, + "func": 5, + "s": 5, + "/i": 1, + "rejoin": 1, + "compose": 1, + "either": 1, + "i": 1, + "little": 1, + "helper": 1, + "standard": 1, + "grammar": 1, + "regex": 2, + "date": 6, + "naive": 1, + "string": 1, + "|": 22, + "S": 3, + "*": 7, + "<(?:[^^\\>": 1, + "d": 3, + "+": 6, + "/": 5, + "@": 1, + "%": 2, + "A": 3, + "F": 1, + "url": 1, + "PR_LITERAL": 10, + "string_url": 1, + "email": 1, + "string_email": 1, + "binary": 1, + "binary_base_two": 1, + "binary_base_sixty_four": 1, + "binary_base_sixteen": 1, + "re/i": 2, + "issue": 1, + "string_issue": 1, + "values": 1, + "value_date": 1, + "value_time": 1, + "tuple": 1, + "value_tuple": 1, + "pair": 1, + "value_pair": 1, + "number": 2, + "PR": 1, + "Za": 2, + "z0": 2, + "<[=>": 1, + "rebol": 1, + "red": 1, + "/system": 1, + "world": 1, + "topaz": 1, + "true": 1, + "false": 1, + "yes": 1, + "on": 1, + "off": 1, + "none": 1, + "#": 1, + "hello": 8, + "print": 4, + "author": 1 + }, + "Red": { + "Red": 3, + "[": 111, + "Title": 2, + "Author": 1, + "]": 114, + "File": 1, + "%": 2, + "console.red": 1, + "Tabs": 1, + "Rights": 1, + "License": 2, + "{": 11, + "Distributed": 1, + "under": 1, + "the": 3, + "Boost": 1, + "Software": 1, + "Version": 1, + "See": 1, + "https": 1, + "//github.com/dockimbel/Red/blob/master/BSL": 1, + "-": 74, + "License.txt": 1, + "}": 11, + "Purpose": 2, + "Language": 2, + "http": 2, + "//www.red": 2, + "lang.org/": 2, + "#system": 1, + "global": 1, + "#either": 3, + "OS": 3, + "MacOSX": 2, + "History": 1, + "library": 1, + "cdecl": 3, + "add": 2, + "history": 2, + ";": 31, + "Add": 1, + "line": 9, + "to": 2, + "history.": 1, + "c": 7, + "string": 10, + "rl": 4, + "insert": 3, + "wrapper": 2, "func": 1, - "print": 1 + "count": 3, + "integer": 16, + "key": 3, + "return": 10, + "Windows": 2, + "system/platform": 1, + "ret": 5, + "AttachConsole": 1, + "if": 2, + "zero": 3, + "print": 5, + "halt": 2, + "SetConsoleTitle": 1, + "as": 4, + "string/rs": 1, + "head": 1, + "str": 4, + "bind": 1, + "tab": 3, + "input": 2, + "routine": 1, + "prompt": 3, + "/local": 1, + "len": 1, + "buffer": 4, + "string/load": 1, + "+": 1, + "length": 1, + "free": 1, + "byte": 3, + "ptr": 14, + "SET_RETURN": 1, + "(": 6, + ")": 4, + "delimiters": 1, + "function": 6, + "block": 3, + "list": 1, + "copy": 2, + "none": 1, + "foreach": 1, + "case": 2, + "escaped": 2, + "no": 2, + "in": 2, + "comment": 2, + "switch": 3, + "#": 8, + "mono": 3, + "mode": 3, + "cnt/1": 1, + "red": 1, + "eval": 1, + "code": 3, + "load/all": 1, + "unless": 1, + "tail": 1, + "set/any": 1, + "not": 1, + "script/2": 1, + "do": 2, + "skip": 1, + "script": 1, + "quit": 2, + "init": 1, + "console": 2, + "Console": 1, + "alpha": 1, + "version": 3, + "only": 1, + "ASCII": 1, + "supported": 1, + "Red/System": 1, + "#include": 1, + "../common/FPU": 1, + "configuration.reds": 1, + "C": 1, + "types": 1, + "#define": 2, + "time": 2, + "long": 2, + "clock": 1, + "date": 1, + "alias": 2, + "struct": 5, + "second": 1, + "minute": 1, + "hour": 1, + "day": 1, + "month": 1, + "year": 1, + "Since": 1, + "weekday": 1, + "since": 1, + "Sunday": 1, + "yearday": 1, + "daylight": 1, + "saving": 1, + "Negative": 1, + "unknown": 1, + "#import": 1, + "LIBC": 1, + "file": 1, + "Error": 1, + "handling": 1, + "form": 1, + "error": 5, + "Return": 1, + "description.": 1, + "Print": 1, + "standard": 1, + "output.": 1, + "Memory": 1, + "management": 1, + "make": 1, + "Allocate": 1, + "filled": 1, + "memory.": 1, + "chunks": 1, + "size": 5, + "binary": 4, + "resize": 1, + "Resize": 1, + "memory": 2, + "allocation.": 1, + "JVM": 6, + "reserved0": 1, + "int": 6, + "reserved1": 1, + "reserved2": 1, + "DestroyJavaVM": 1, + "JNICALL": 5, + "vm": 5, + "jint": 5, + "AttachCurrentThread": 1, + "penv": 3, + "p": 3, + "args": 2, + "DetachCurrentThread": 1, + "GetEnv": 1, + "AttachCurrentThreadAsDaemon": 1, + "just": 2, + "some": 2, + "datatypes": 1, + "for": 1, + "testing": 1, + "#some": 1, + "hash": 1, + "FF0000": 3, + "FF000000": 2, + "with": 4, + "instead": 1, + "of": 1, + "space": 2, + "/wAAAA": 1, + "/wAAA": 2, + "A": 2, + "inside": 2, + "char": 1, + "bla": 2, + "ff": 1, + "foo": 3, + "numbers": 1, + "which": 1, + "interpreter": 1, + "path": 1, + "h": 1, + "#if": 1, + "type": 1, + "exe": 1, + "push": 3, + "system/stack/frame": 2, + "save": 1, + "previous": 1, + "frame": 2, + "pointer": 2, + "system/stack/top": 1, + "@@": 1, + "reposition": 1, + "after": 1, + "catch": 1, + "flag": 1, + "CATCH_ALL": 1, + "exceptions": 1, + "root": 1, + "barrier": 1, + "keep": 1, + "stack": 1, + "aligned": 1, + "on": 1, + "bit": 1 }, "RMarkdown": { "Some": 1, @@ -42841,6 +59764,53 @@ "running_threads2": 2, "port2.recv": 1 }, + "SAS": { + "libname": 1, + "source": 1, + "data": 6, + "work.working_copy": 5, + ";": 22, + "set": 3, + "source.original_file.sas7bdat": 1, + "run": 6, + "if": 2, + "Purge": 1, + "then": 2, + "delete": 1, + "ImportantVariable": 1, + ".": 1, + "MissingFlag": 1, + "proc": 2, + "surveyselect": 1, + "work.data": 1, + "out": 2, + "work.boot": 2, + "method": 1, + "urs": 1, + "reps": 1, + "seed": 2, + "sampsize": 1, + "outhits": 1, + "samplingunit": 1, + "Site": 1, + "PROC": 1, + "MI": 1, + "work.bootmi": 2, + "nimpute": 1, + "round": 1, + "By": 2, + "Replicate": 2, + "VAR": 1, + "Variable1": 2, + "Variable2": 2, + "logistic": 1, + "descending": 1, + "_Imputation_": 1, + "model": 1, + "Outcome": 1, + "/": 1, + "risklimits": 1 + }, "Sass": { "blue": 7, "#3bbfce": 2, @@ -44077,6 +61047,585 @@ "foodforthought.jpg": 1, "name##*fo": 1 }, + "ShellSession": { + "echo": 2, + "FOOBAR": 2, + "Hello": 2, + "World": 2, + "gem": 4, + "install": 4, + "nokogiri": 6, + "...": 4, + "Building": 2, + "native": 2, + "extensions.": 2, + "This": 4, + "could": 2, + "take": 2, + "a": 4, + "while...": 2, + "checking": 1, + "for": 4, + "libxml/parser.h...": 1, + "***": 2, + "extconf.rb": 1, + "failed": 1, + "Could": 2, + "not": 2, + "create": 1, + "Makefile": 1, + "due": 1, + "to": 3, + "some": 1, + "reason": 2, + "probably": 1, + "lack": 1, + "of": 2, + "necessary": 1, + "libraries": 1, + "and/or": 1, + "headers.": 1, + "Check": 1, + "the": 2, + "mkmf.log": 1, + "file": 1, + "more": 1, + "details.": 1, + "You": 1, + "may": 1, + "need": 1, + "configuration": 1, + "options.": 1, + "brew": 2, + "tap": 2, + "homebrew/dupes": 1, + "Cloning": 1, + "into": 1, + "remote": 3, + "Counting": 1, + "objects": 3, + "done.": 4, + "Compressing": 1, + "%": 5, + "(": 6, + "/591": 1, + ")": 6, + "Total": 1, + "delta": 2, + "reused": 1, + "Receiving": 1, + "/1034": 1, + "KiB": 1, + "|": 1, + "bytes/s": 1, + "Resolving": 1, + "deltas": 1, + "/560": 1, + "Checking": 1, + "connectivity...": 1, + "done": 1, + "Warning": 1, + "homebrew/dupes/lsof": 1, + "over": 1, + "mxcl/master/lsof": 1, + "Tapped": 1, + "formula": 4, + "apple": 1, + "-": 12, + "gcc42": 1, + "Downloading": 1, + "http": 2, + "//r.research.att.com/tools/gcc": 1, + "darwin11.pkg": 1, + "########################################################################": 1, + "Caveats": 1, + "NOTE": 1, + "provides": 1, + "components": 1, + "that": 1, + "were": 1, + "removed": 1, + "from": 3, + "XCode": 2, + "in": 2, + "release.": 1, + "There": 1, + "is": 2, + "no": 1, + "this": 1, + "if": 1, + "you": 1, + "are": 1, + "using": 1, + "version": 1, + "prior": 1, + "contains": 1, + "compilers": 2, + "built": 2, + "Apple": 1, + "s": 1, + "GCC": 1, + "sources": 1, + "build": 1, + "available": 1, + "//opensource.apple.com/tarballs/gcc": 1, + "All": 1, + "have": 1, + "suffix.": 1, + "A": 1, + "GFortran": 1, + "compiler": 1, + "also": 1, + "included.": 1, + "Summary": 1, + "/usr/local/Cellar/apple": 1, + "gcc42/4.2.1": 1, + "files": 1, + "M": 1, + "seconds": 1, + "v": 1, + "Fetching": 1, + "Successfully": 1, + "installed": 2, + "Installing": 2, + "ri": 1, + "documentation": 2, + "RDoc": 1 + }, + "Shen": { + "*": 47, + "graph.shen": 1, + "-": 747, + "a": 30, + "library": 3, + "for": 12, + "graph": 52, + "definition": 1, + "and": 16, + "manipulation": 1, + "Copyright": 2, + "(": 267, + "C": 6, + ")": 250, + "Eric": 2, + "Schulte": 2, + "***": 5, + "License": 2, + "Redistribution": 2, + "use": 2, + "in": 13, + "source": 4, + "binary": 4, + "forms": 2, + "with": 8, + "or": 2, + "without": 2, + "modification": 2, + "are": 7, + "permitted": 2, + "provided": 4, + "that": 3, + "the": 29, + "following": 6, + "conditions": 6, + "met": 2, + "Redistributions": 4, + "of": 20, + "code": 2, + "must": 4, + "retain": 2, + "above": 4, + "copyright": 4, + "notice": 4, + "this": 4, + "list": 32, + "disclaimer.": 2, + "form": 2, + "reproduce": 2, + "disclaimer": 2, + "documentation": 2, + "and/or": 2, + "other": 2, + "materials": 2, + "distribution.": 2, + "THIS": 4, + "SOFTWARE": 4, + "IS": 2, + "PROVIDED": 2, + "BY": 2, + "THE": 10, + "COPYRIGHT": 4, + "HOLDERS": 2, + "AND": 8, + "CONTRIBUTORS": 4, + "ANY": 8, + "EXPRESS": 2, + "OR": 16, + "IMPLIED": 4, + "WARRANTIES": 4, + "INCLUDING": 6, + "BUT": 4, + "NOT": 4, + "LIMITED": 4, + "TO": 4, + "OF": 16, + "MERCHANTABILITY": 2, + "FITNESS": 2, + "FOR": 4, + "A": 32, + "PARTICULAR": 2, + "PURPOSE": 2, + "ARE": 2, + "DISCLAIMED.": 2, + "IN": 6, + "NO": 2, + "EVENT": 2, + "SHALL": 2, + "HOLDER": 2, + "BE": 2, + "LIABLE": 2, + "DIRECT": 2, + "INDIRECT": 2, + "INCIDENTAL": 2, + "SPECIAL": 2, + "EXEMPLARY": 2, + "CONSEQUENTIAL": 2, + "DAMAGES": 2, + "PROCUREMENT": 2, + "SUBSTITUTE": 2, + "GOODS": 2, + "SERVICES": 2, + ";": 12, + "LOSS": 2, + "USE": 4, + "DATA": 2, + "PROFITS": 2, + "BUSINESS": 2, + "INTERRUPTION": 2, + "HOWEVER": 2, + "CAUSED": 2, + "ON": 2, + "THEORY": 2, + "LIABILITY": 4, + "WHETHER": 2, + "CONTRACT": 2, + "STRICT": 2, + "TORT": 2, + "NEGLIGENCE": 2, + "OTHERWISE": 2, + "ARISING": 2, + "WAY": 2, + "OUT": 2, + "EVEN": 2, + "IF": 2, + "ADVISED": 2, + "POSSIBILITY": 2, + "SUCH": 2, + "DAMAGE.": 2, + "Commentary": 2, + "Graphs": 1, + "represented": 1, + "as": 2, + "two": 1, + "dictionaries": 1, + "one": 2, + "vertices": 17, + "edges.": 1, + "It": 1, + "is": 5, + "important": 1, + "to": 16, + "note": 1, + "dictionary": 3, + "implementation": 1, + "used": 2, + "able": 1, + "accept": 1, + "arbitrary": 1, + "data": 17, + "structures": 1, + "keys.": 1, + "This": 1, + "structure": 2, + "technically": 1, + "encodes": 1, + "hypergraphs": 1, + "generalization": 1, + "graphs": 1, + "which": 1, + "each": 1, + "edge": 32, + "may": 1, + "contain": 2, + "any": 1, + "number": 12, + ".": 1, + "Examples": 1, + "regular": 1, + "G": 25, + "hypergraph": 1, + "H": 3, + "corresponding": 1, + "given": 4, + "below.": 1, + "": 3, + "Vertices": 11, + "Edges": 9, + "+": 33, + "Graph": 65, + "hash": 8, + "|": 103, + "key": 9, + "value": 17, + "b": 13, + "c": 11, + "g": 19, + "[": 93, + "]": 91, + "d": 12, + "e": 14, + "f": 10, + "Hypergraph": 1, + "h": 3, + "i": 3, + "j": 2, + "associated": 1, + "edge/vertex": 1, + "@p": 17, + "V": 48, + "#": 4, + "E": 20, + "edges": 17, + "M": 4, + "vertex": 29, + "associations": 1, + "size": 2, + "all": 3, + "stored": 1, + "dict": 39, + "sizeof": 4, + "int": 1, + "indices": 1, + "into": 1, + "&": 1, + "Edge": 11, + "dicts": 3, + "entry": 2, + "storage": 2, + "Vertex": 3, + "Code": 1, + "require": 2, + "sequence": 2, + "datatype": 1, + "dictoinary": 1, + "vector": 4, + "symbol": 1, + "package": 2, + "add": 25, + "has": 5, + "neighbors": 8, + "connected": 21, + "components": 8, + "partition": 7, + "bipartite": 3, + "included": 2, + "from": 3, + "take": 2, + "drop": 2, + "while": 2, + "range": 1, + "flatten": 1, + "filter": 2, + "complement": 1, + "seperate": 1, + "zip": 1, + "indexed": 1, + "reduce": 3, + "mapcon": 3, + "unique": 3, + "frequencies": 1, + "shuffle": 1, + "pick": 1, + "remove": 2, + "first": 2, + "interpose": 1, + "subset": 3, + "cartesian": 1, + "product": 1, + "<-dict>": 5, + "contents": 1, + "keys": 3, + "vals": 1, + "make": 10, + "define": 34, + "X": 4, + "<-address>": 5, + "0": 1, + "create": 1, + "specified": 1, + "sizes": 2, + "}": 22, + "Vertsize": 2, + "Edgesize": 2, + "let": 9, + "absvector": 1, + "do": 8, + "address": 5, + "defmacro": 3, + "macro": 3, + "return": 4, + "taking": 1, + "optional": 1, + "N": 7, + "vert": 12, + "1": 1, + "2": 3, + "{": 15, + "get": 3, + "Value": 3, + "if": 8, + "tuple": 3, + "fst": 3, + "error": 7, + "string": 3, + "resolve": 6, + "Vector": 2, + "Index": 2, + "Place": 6, + "nth": 1, + "<-vector>": 2, + "Vert": 5, + "Val": 5, + "trap": 4, + "snd": 2, + "map": 5, + "lambda": 1, + "w": 4, + "B": 2, + "Data": 2, + "w/o": 5, + "D": 4, + "update": 5, + "an": 3, + "s": 1, + "Vs": 4, + "Store": 6, + "<": 4, + "limit": 2, + "VertLst": 2, + "/.": 4, + "Contents": 5, + "adjoin": 2, + "length": 5, + "EdgeID": 3, + "EdgeLst": 2, + "p": 1, + "boolean": 4, + "Return": 1, + "Already": 5, + "New": 5, + "Reachable": 2, + "difference": 3, + "append": 1, + "including": 1, + "itself": 1, + "fully": 1, + "Acc": 2, + "true": 1, + "_": 1, + "VS": 4, + "Component": 6, + "ES": 3, + "Con": 8, + "verts": 4, + "cons": 1, + "place": 3, + "partitions": 1, + "element": 2, + "simple": 3, + "CS": 3, + "Neighbors": 3, + "empty": 1, + "intersection": 1, + "check": 1, + "tests": 1, + "set": 1, + "chris": 6, + "patton": 2, + "eric": 1, + "nobody": 2, + "fail": 1, + "when": 1, + "wrapper": 1, + "function": 1, + "html.shen": 1, + "html": 2, + "generation": 1, + "functions": 1, + "shen": 1, + "The": 1, + "standard": 1, + "lisp": 1, + "conversion": 1, + "tool": 1, + "suite.": 1, + "Follows": 1, + "some": 1, + "convertions": 1, + "Clojure": 1, + "tasks": 1, + "stuff": 1, + "todo1": 1, + "today": 1, + "attributes": 1, + "AS": 1, + "load": 1, + "JSON": 1, + "Lexer": 1, + "Read": 1, + "stream": 1, + "characters": 4, + "Whitespace": 4, + "not": 1, + "strings": 2, + "should": 2, + "be": 2, + "discarded.": 1, + "preserved": 1, + "Strings": 1, + "can": 1, + "escaped": 1, + "double": 1, + "quotes.": 1, + "e.g.": 2, + "whitespacep": 2, + "ASCII": 2, + "Space.": 1, + "All": 1, + "others": 1, + "whitespace": 7, + "table.": 1, + "Char": 4, + "member": 1, + "replace": 3, + "@s": 4, + "Suffix": 4, + "where": 2, + "Prefix": 2, + "fetch": 1, + "until": 1, + "unescaped": 1, + "doublequote": 1, + "c#34": 5, + "WhitespaceChar": 2, + "Chars": 4, + "strip": 2, + "chars": 2, + "tokenise": 1, + "JSONString": 2, + "CharList": 2, + "explode": 1 + }, "Slash": { "<%>": 1, "class": 11, @@ -44151,6 +61700,695 @@ "ast.eval": 1, "Env.new": 1 }, + "Slim": { + "doctype": 1, + "html": 2, + "head": 1, + "title": 1, + "Slim": 2, + "Examples": 1, + "meta": 2, + "name": 2, + "content": 2, + "author": 2, + "javascript": 1, + "alert": 1, + "(": 1, + ")": 1, + "body": 1, + "h1": 1, + "Markup": 1, + "examples": 1, + "#content": 1, + "p": 2, + "This": 1, + "example": 1, + "shows": 1, + "you": 2, + "how": 1, + "a": 1, + "basic": 1, + "file": 1, + "looks": 1, + "like.": 1, + "yield": 1, + "-": 3, + "unless": 1, + "items.empty": 1, + "table": 1, + "for": 1, + "item": 1, + "in": 1, + "items": 2, + "do": 1, + "tr": 1, + "td.name": 1, + "item.name": 1, + "td.price": 1, + "item.price": 1, + "else": 1, + "|": 2, + "No": 1, + "found.": 1, + "Please": 1, + "add": 1, + "some": 1, + "inventory.": 1, + "Thank": 1, + "div": 1, + "id": 1, + "render": 1, + "Copyright": 1, + "#": 2, + "{": 2, + "year": 1, + "}": 2 + }, + "Smalltalk": { + "Object": 1, + "subclass": 2, + "#Philosophers": 1, + "instanceVariableNames": 1, + "classVariableNames": 1, + "poolDictionaries": 1, + "category": 1, + "Philosophers": 3, + "class": 1, + "methodsFor": 2, + "new": 4, + "self": 25, + "shouldNotImplement": 1, + "quantity": 2, + "super": 1, + "initialize": 3, + "dine": 4, + "seconds": 2, + "(": 19, + "Delay": 3, + "forSeconds": 1, + ")": 19, + "wait.": 5, + "philosophers": 2, + "do": 1, + "[": 18, + "each": 5, + "|": 18, + "terminate": 1, + "]": 18, + ".": 16, + "size": 4, + "leftFork": 6, + "n": 11, + "forks": 5, + "at": 3, + "rightFork": 6, + "ifTrue": 1, + "ifFalse": 1, + "+": 1, + "eating": 3, + "Semaphore": 2, + "new.": 2, + "-": 1, + "timesRepeat": 1, + "signal": 1, + "randy": 3, + "Random": 1, + "to": 2, + "collect": 2, + "forMutualExclusion": 1, + "philosopher": 2, + "philosopherCode": 3, + "status": 8, + "n.": 2, + "printString": 1, + "true": 2, + "whileTrue": 1, + "Transcript": 5, + "nextPutAll": 5, + ";": 8, + "nl.": 5, + "forMilliseconds": 2, + "next": 2, + "*": 2, + "critical": 1, + "signal.": 2, + "newProcess": 1, + "priority": 1, + "Processor": 1, + "userBackgroundPriority": 1, + "name": 1, + "resume": 1, + "yourself": 1, + "Koan": 1, + "TestBasic": 1, + "": 1, + "A": 1, + "collection": 1, + "of": 1, + "introductory": 1, + "tests": 2, + "testDeclarationAndAssignment": 1, + "declaration": 2, + "anotherDeclaration": 2, + "_": 1, + "expect": 10, + "fillMeIn": 10, + "toEqual": 10, + "declaration.": 1, + "anotherDeclaration.": 1, + "testEqualSignIsNotAnAssignmentOperator": 1, + "variableA": 6, + "variableB": 5, + "value": 2, + "variableB.": 2, + "testMultipleStatementsInASingleLine": 1, + "variableC": 2, + "variableA.": 1, + "variableC.": 1, + "testInequality": 1, + "testLogicalOr": 1, + "expression": 4, + "<": 2, + "expression.": 2, + "testLogicalAnd": 1, + "&": 1, + "testNot": 1, + "not.": 1, + "testSimpleChainMatches": 1, + "e": 11, + "eCtrl": 3, + "eventKey": 3, + "e.": 1, + "ctrl": 5, + "true.": 1, + "assert": 2, + "matches": 4, + "{": 4, + "}": 4, + "eCtrl.": 2, + "deny": 2, + "a": 1 + }, + "SourcePawn": { + "//#define": 1, + "DEBUG": 2, + "#if": 1, + "defined": 1, + "#define": 7, + "assert": 2, + "(": 233, + "%": 18, + ")": 234, + "if": 44, + "ThrowError": 2, + ";": 213, + "assert_msg": 2, + "#else": 1, + "#endif": 1, + "#pragma": 1, + "semicolon": 1, + "#include": 3, + "": 1, + "": 1, + "": 1, + "public": 21, + "Plugin": 1, + "myinfo": 1, + "{": 73, + "name": 7, + "author": 1, + "description": 1, + "version": 1, + "SOURCEMOD_VERSION": 1, + "url": 1, + "}": 71, + "new": 62, + "Handle": 51, + "g_Cvar_Winlimit": 5, + "INVALID_HANDLE": 56, + "g_Cvar_Maxrounds": 5, + "g_Cvar_Fraglimit": 6, + "g_Cvar_Bonusroundtime": 6, + "g_Cvar_StartTime": 3, + "g_Cvar_StartRounds": 5, + "g_Cvar_StartFrags": 3, + "g_Cvar_ExtendTimeStep": 2, + "g_Cvar_ExtendRoundStep": 2, + "g_Cvar_ExtendFragStep": 2, + "g_Cvar_ExcludeMaps": 3, + "g_Cvar_IncludeMaps": 2, + "g_Cvar_NoVoteMode": 2, + "g_Cvar_Extend": 2, + "g_Cvar_DontChange": 2, + "g_Cvar_EndOfMapVote": 8, + "g_Cvar_VoteDuration": 3, + "g_Cvar_RunOff": 2, + "g_Cvar_RunOffPercent": 2, + "g_VoteTimer": 7, + "g_RetryTimer": 4, + "g_MapList": 8, + "g_NominateList": 7, + "g_NominateOwners": 7, + "g_OldMapList": 7, + "g_NextMapList": 2, + "g_VoteMenu": 1, + "g_Extends": 2, + "g_TotalRounds": 7, + "bool": 10, + "g_HasVoteStarted": 7, + "g_WaitingForVote": 4, + "g_MapVoteCompleted": 9, + "g_ChangeMapAtRoundEnd": 6, + "g_ChangeMapInProgress": 4, + "g_mapFileSerial": 3, + "-": 12, + "g_NominateCount": 3, + "MapChange": 4, + "g_ChangeTime": 1, + "g_NominationsResetForward": 3, + "g_MapVoteStartedForward": 2, + "MAXTEAMS": 4, + "g_winCount": 4, + "[": 19, + "]": 19, + "VOTE_EXTEND": 1, + "VOTE_DONTCHANGE": 1, + "OnPluginStart": 1, + "LoadTranslations": 2, + "arraySize": 5, + "ByteCountToCells": 1, + "PLATFORM_MAX_PATH": 6, + "CreateArray": 5, + "CreateConVar": 15, + "_": 18, + "true": 26, + "RegAdminCmd": 2, + "Command_Mapvote": 2, + "ADMFLAG_CHANGEMAP": 2, + "Command_SetNextmap": 2, + "FindConVar": 4, + "||": 15, + "decl": 5, + "String": 11, + "folder": 5, + "GetGameFolderName": 1, + "sizeof": 6, + "strcmp": 3, + "HookEvent": 6, + "Event_TeamPlayWinPanel": 3, + "Event_TFRestartRound": 2, + "else": 5, + "Event_RoundEnd": 3, + "Event_PlayerDeath": 2, + "AutoExecConfig": 1, + "//Change": 1, + "the": 5, + "mp_bonusroundtime": 1, + "max": 1, + "so": 1, + "that": 2, + "we": 2, + "have": 2, + "time": 9, + "to": 4, + "display": 2, + "vote": 6, + "//If": 1, + "you": 1, + "a": 1, + "during": 2, + "bonus": 2, + "good": 1, + "defaults": 1, + "are": 1, + "duration": 1, + "and": 1, + "mp_bonustime": 1, + "SetConVarBounds": 1, + "ConVarBound_Upper": 1, + "CreateGlobalForward": 2, + "ET_Ignore": 2, + "Param_String": 1, + "Param_Cell": 1, + "APLRes": 1, + "AskPluginLoad2": 1, + "myself": 1, + "late": 1, + "error": 1, + "err_max": 1, + "RegPluginLibrary": 1, + "CreateNative": 9, + "Native_NominateMap": 1, + "Native_RemoveNominationByMap": 1, + "Native_RemoveNominationByOwner": 1, + "Native_InitiateVote": 1, + "Native_CanVoteStart": 2, + "Native_CheckVoteDone": 2, + "Native_GetExcludeMapList": 2, + "Native_GetNominatedMapList": 2, + "Native_EndOfMapVoteEnabled": 2, + "return": 23, + "APLRes_Success": 1, + "OnConfigsExecuted": 1, + "ReadMapList": 1, + "MAPLIST_FLAG_CLEARARRAY": 1, + "|": 1, + "MAPLIST_FLAG_MAPSFOLDER": 1, + "LogError": 2, + "CreateNextVote": 1, + "SetupTimeleftTimer": 3, + "false": 8, + "ClearArray": 2, + "for": 9, + "i": 13, + "<": 5, + "+": 12, + "&&": 5, + "GetConVarInt": 10, + "GetConVarFloat": 2, + "<=>": 1, + "Warning": 1, + "Bonus": 1, + "Round": 1, + "Time": 2, + "shorter": 1, + "than": 1, + "Vote": 4, + "Votes": 1, + "round": 1, + "may": 1, + "not": 1, + "complete": 1, + "OnMapEnd": 1, + "map": 27, + "GetCurrentMap": 1, + "PushArrayString": 3, + "GetArraySize": 8, + "RemoveFromArray": 3, + "OnClientDisconnect": 1, + "client": 9, + "index": 8, + "FindValueInArray": 1, + "oldmap": 4, + "GetArrayString": 3, + "Call_StartForward": 1, + "Call_PushString": 1, + "Call_PushCell": 1, + "GetArrayCell": 2, + "Call_Finish": 1, + "Action": 3, + "args": 3, + "ReplyToCommand": 2, + "Plugin_Handled": 4, + "GetCmdArg": 1, + "IsMapValid": 1, + "ShowActivity": 1, + "LogAction": 1, + "SetNextMap": 1, + "OnMapTimeLeftChanged": 1, + "GetMapTimeLeft": 1, + "startTime": 4, + "*": 1, + "GetConVarBool": 6, + "InitiateVote": 8, + "MapChange_MapEnd": 6, + "KillTimer": 1, + "//g_VoteTimer": 1, + "CreateTimer": 3, + "float": 2, + "Timer_StartMapVote": 3, + "TIMER_FLAG_NO_MAPCHANGE": 4, + "data": 8, + "CreateDataTimer": 1, + "WritePackCell": 2, + "ResetPack": 1, + "timer": 2, + "Plugin_Stop": 2, + "mapChange": 2, + "ReadPackCell": 2, + "hndl": 2, + "event": 11, + "const": 4, + "dontBroadcast": 4, + "Timer_ChangeMap": 2, + "bluescore": 2, + "GetEventInt": 7, + "redscore": 2, + "StrEqual": 1, + "CheckMaxRounds": 3, + "switch": 1, + "case": 2, + "CheckWinLimit": 4, + "//We": 1, + "need": 2, + "do": 1, + "nothing": 1, + "on": 1, + "winning_team": 1, + "this": 1, + "indicates": 1, + "stalemate.": 1, + "default": 1, + "winner": 9, + "//": 3, + "Nuclear": 1, + "Dawn": 1, + "SetFailState": 1, + "winner_score": 2, + "winlimit": 3, + "roundcount": 2, + "maxrounds": 3, + "fragger": 3, + "GetClientOfUserId": 1, + "GetClientFrags": 1, + "when": 2, + "inputlist": 1, + "IsVoteInProgress": 1, + "Can": 1, + "t": 7, + "be": 1, + "excluded": 1, + "from": 1, + "as": 2, + "they": 1, + "weren": 1, + "nominationsToAdd": 1, + "Change": 2, + "Extend": 2, + "Map": 5, + "Voting": 7, + "next": 5, + "has": 5, + "started.": 1, + "SM": 5, + "Nextmap": 5, + "Started": 1, + "Current": 2, + "Extended": 1, + "finished.": 3, + "The": 1, + "current": 1, + "been": 1, + "extended.": 1, + "Stays": 1, + "was": 3, + "Finished": 1, + "s.": 1, + "Runoff": 2, + "Starting": 2, + "indecisive": 1, + "beginning": 1, + "runoff": 1, + "T": 3, + "Dont": 1, + "because": 1, + "outside": 1, + "request": 1, + "inputarray": 1, + "plugin": 5, + "numParams": 5, + "CanVoteStart": 1, + "array": 3, + "GetNativeCell": 3, + "size": 2, + "maparray": 3, + "ownerarray": 3, + "If": 1, + "optional": 1, + "parameter": 1, + "an": 1, + "owner": 1, + "list": 1, + "passed": 1, + "then": 1, + "fill": 1, + "out": 1, + "well": 1, + "PushArrayCell": 1 + }, + "SQL": { + "IF": 13, + "EXISTS": 12, + "(": 131, + "SELECT": 4, + "*": 3, + "FROM": 1, + "DBO.SYSOBJECTS": 1, + "WHERE": 1, + "ID": 2, + "OBJECT_ID": 1, + "N": 7, + ")": 131, + "AND": 1, + "OBJECTPROPERTY": 1, + "id": 22, + "DROP": 3, + "PROCEDURE": 1, + "dbo.AvailableInSearchSel": 2, + "GO": 4, + "CREATE": 10, + "Procedure": 1, + "AvailableInSearchSel": 1, + "AS": 1, + "UNION": 2, + "ALL": 2, + "DB_NAME": 1, + "BEGIN": 1, + "GRANT": 1, + "EXECUTE": 1, + "ON": 1, + "TO": 1, + "[": 1, + "rv": 1, + "]": 1, + "END": 1, + "SHOW": 2, + "WARNINGS": 2, + ";": 31, + "-": 496, + "Table": 9, + "structure": 9, + "for": 15, + "table": 17, + "articles": 4, + "TABLE": 10, + "NOT": 46, + "int": 28, + "NULL": 91, + "AUTO_INCREMENT": 9, + "title": 4, + "varchar": 22, + "DEFAULT": 22, + "content": 2, + "longtext": 1, + "date_posted": 4, + "datetime": 10, + "created_by": 2, + "last_modified": 2, + "last_modified_by": 2, + "ordering": 2, + "is_published": 2, + "PRIMARY": 9, + "KEY": 13, + "Dumping": 6, + "data": 6, + "INSERT": 6, + "INTO": 6, + "VALUES": 6, + "challenges": 4, + "pkg_name": 2, + "description": 2, + "text": 1, + "author": 2, + "category": 2, + "visibility": 2, + "publish": 2, + "abstract": 2, + "level": 2, + "duration": 2, + "goal": 2, + "solution": 2, + "availability": 2, + "default_points": 2, + "default_duration": 2, + "challenge_attempts": 2, + "user_id": 8, + "challenge_id": 7, + "time": 1, + "status": 1, + "challenge_attempt_count": 2, + "tries": 1, + "UNIQUE": 4, + "classes": 4, + "name": 3, + "date_created": 6, + "archive": 2, + "class_challenges": 4, + "class_id": 5, + "class_memberships": 4, + "users": 4, + "username": 3, + "full_name": 2, + "email": 2, + "password": 2, + "joined": 2, + "last_visit": 2, + "is_activated": 2, + "type": 3, + "token": 3, + "user_has_challenge_token": 3, + "create": 2, + "FILIAL": 10, + "NUMBER": 1, + "not": 5, + "null": 4, + "title_ua": 1, + "VARCHAR2": 4, + "title_ru": 1, + "title_eng": 1, + "remove_date": 1, + "DATE": 2, + "modify_date": 1, + "modify_user": 1, + "alter": 1, + "add": 1, + "constraint": 1, + "PK_ID": 1, + "primary": 1, + "key": 1, + "grant": 8, + "select": 10, + "on": 8, + "to": 8, + "ATOLL": 1, + "CRAMER2GIS": 1, + "DMS": 1, + "HPSM2GIS": 1, + "PLANMONITOR": 1, + "SIEBEL": 1, + "VBIS": 1, + "VPORTAL": 1, + "if": 1, + "exists": 1, + "from": 2, + "sysobjects": 1, + "where": 2, + "and": 1, + "in": 1, + "exec": 1, + "%": 2, + "object_ddl": 1, + "go": 1, + "use": 1, + "translog": 1, + "VIEW": 1, + "suspendedtoday": 2, + "view": 1, + "as": 1, + "suspended": 1, + "datediff": 1, + "now": 1 + }, "Squirrel": { "//example": 1, "from": 1, @@ -44203,67 +62441,67 @@ "newplayer.MoveTo": 1 }, "Standard ML": { + "structure": 15, + "LazyBase": 4, + "LAZY_BASE": 5, + "struct": 13, + "type": 6, + "a": 78, + "exception": 2, + "Undefined": 6, + "fun": 60, + "delay": 6, + "f": 46, + "force": 18, + "(": 840, + ")": 845, + "val": 147, + "undefined": 2, + "fn": 127, + "raise": 6, + "end": 55, + "LazyMemoBase": 4, + "datatype": 29, + "|": 226, + "Done": 2, + "of": 91, + "lazy": 13, + "unit": 7, + "-": 20, + "let": 44, + "open": 9, + "B": 2, + "inject": 5, + "x": 74, + "isUndefined": 4, + "ignore": 3, + ";": 21, + "false": 32, + "handle": 4, + "true": 36, + "toString": 4, + "if": 51, + "then": 51, + "else": 51, + "eqBy": 5, + "p": 10, + "y": 50, + "eq": 3, + "op": 2, + "compare": 8, + "Ops": 3, + "map": 3, + "Lazy": 2, + "LazyFn": 4, + "LazyMemo": 2, "signature": 2, - "LAZY_BASE": 3, "sig": 2, - "type": 5, - "a": 74, - "lazy": 12, - "-": 19, - ")": 826, - "end": 52, "LAZY": 1, "bool": 9, - "val": 143, - "inject": 3, - "toString": 3, - "(": 822, "string": 14, - "eq": 2, "*": 9, - "eqBy": 3, - "compare": 7, "order": 2, - "map": 2, "b": 58, - "structure": 10, - "Ops": 2, - "LazyBase": 2, - "struct": 9, - "exception": 1, - "Undefined": 3, - "fun": 51, - "delay": 3, - "f": 37, - "force": 9, - "undefined": 1, - "fn": 124, - "raise": 5, - "LazyMemoBase": 2, - "datatype": 28, - "|": 225, - "Done": 1, - "of": 90, - "unit": 6, - "let": 43, - "open": 8, - "B": 1, - "x": 59, - "isUndefined": 2, - "ignore": 2, - ";": 20, - "false": 31, - "handle": 3, - "true": 35, - "if": 50, - "then": 50, - "else": 50, - "p": 6, - "y": 44, - "op": 1, - "Lazy": 1, - "LazyFn": 2, - "LazyMemo": 1, "functor": 2, "Main": 1, "S": 2, @@ -44795,6 +63033,601 @@ "table": 14, "clear": 1 }, + "Stata": { + "local": 6, + "inname": 1, + "outname": 1, + "program": 2, + "hello": 1, + "vers": 1, + "display": 1, + "end": 4, + "{": 441, + "*": 25, + "version": 2, + "mar2014": 1, + "}": 440, + "...": 30, + "Hello": 1, + "world": 1, + "p_end": 47, + "MAXDIM": 1, + "smcl": 1, + "Matthew": 2, + "White": 2, + "jan2014": 1, + "title": 7, + "Title": 1, + "phang": 4, + "cmd": 111, + "odkmeta": 17, + "hline": 1, + "Create": 4, + "a": 30, + "do": 22, + "-": 42, + "file": 18, + "to": 23, + "import": 9, + "ODK": 6, + "data": 4, + "marker": 10, + "syntax": 1, + "Syntax": 1, + "p": 2, + "using": 10, + "it": 61, + "help": 27, + "filename": 3, + "opt": 25, + "csv": 9, + "(": 60, + "csvfile": 3, + ")": 61, + "Using": 7, + "histogram": 2, + "as": 29, + "template.": 8, + "notwithstanding": 1, + "is": 31, + "rarely": 1, + "preceded": 3, + "by": 7, + "an": 6, + "underscore.": 1, + "cmdab": 5, + "s": 10, + "urvey": 2, + "surveyfile": 5, + "odkmeta##surveyopts": 2, + "surveyopts": 4, + "cho": 2, + "ices": 2, + "choicesfile": 4, + "odkmeta##choicesopts": 2, + "choicesopts": 5, + "[": 6, + "options": 1, + "]": 6, + "odbc": 2, + "the": 67, + "position": 1, + "of": 36, + "last": 1, + "character": 1, + "in": 24, + "first": 2, + "column": 18, + "+": 2, + "synoptset": 5, + "tabbed": 4, + "synopthdr": 4, + "synoptline": 8, + "syntab": 6, + "Main": 3, + "heckman": 2, + "p2coldent": 3, + "name": 20, + ".csv": 2, + "that": 21, + "contains": 3, + "metadata": 5, + "from": 6, + "survey": 14, + "worksheet": 5, + "choices": 10, + "Fields": 2, + "synopt": 16, + "drop": 1, + "attrib": 2, + "headers": 8, + "not": 8, + "field": 25, + "attributes": 10, + "with": 10, + "keep": 1, + "only": 3, + "rel": 1, + "ax": 1, + "ignore": 1, + "fields": 7, + "exist": 1, + "Lists": 1, + "ca": 1, + "oth": 1, + "er": 1, + "odkmeta##other": 1, + "other": 14, + "Stata": 5, + "value": 14, + "values": 3, + "select": 6, + "or_other": 5, + ";": 15, + "default": 8, + "max": 2, + "one": 5, + "line": 4, + "write": 1, + "each": 7, + "list": 13, + "on": 7, + "single": 1, + "Options": 1, + "replace": 7, + "overwrite": 1, + "existing": 1, + "p2colreset": 4, + "and": 18, + "are": 13, + "required.": 1, + "Change": 1, + "t": 2, + "ype": 1, + "header": 15, + "type": 7, + "attribute": 10, + "la": 2, + "bel": 2, + "label": 9, + "d": 1, + "isabled": 1, + "disabled": 4, + "li": 1, + "stname": 1, + "list_name": 6, + "maximum": 3, + "plus": 2, + "min": 2, + "minimum": 2, + "minus": 1, + "#": 6, + "constant": 2, + "for": 13, + "all": 3, + "labels": 8, + "description": 1, + "Description": 1, + "pstd": 20, + "creates": 1, + "worksheets": 1, + "XLSForm.": 1, + "The": 9, + "saved": 1, + "completes": 2, + "following": 1, + "tasks": 3, + "order": 1, + "anova": 1, + "phang2": 23, + "o": 12, + "Import": 2, + "lists": 2, + "Add": 1, + "char": 4, + "characteristics": 4, + "Split": 1, + "select_multiple": 6, + "variables": 8, + "Drop": 1, + "note": 1, + "format": 1, + "Format": 1, + "date": 1, + "time": 1, + "datetime": 1, + "Attach": 2, + "variable": 14, + "notes": 1, + "merge": 3, + "Merge": 1, + "repeat": 6, + "groups": 4, + "After": 1, + "have": 2, + "been": 1, + "split": 4, + "can": 1, + "be": 12, + "removed": 1, + "without": 2, + "affecting": 1, + "tasks.": 1, + "User": 1, + "written": 2, + "supplements": 1, + "may": 2, + "make": 1, + "use": 3, + "any": 3, + "which": 6, + "imported": 4, + "characteristics.": 1, + "remarks": 1, + "Remarks": 1, + "uses": 3, + "helpb": 7, + "insheet": 4, + "data.": 1, + "long": 7, + "strings": 1, + "digits": 1, + "such": 2, + "simserial": 1, + "will": 9, + "numeric": 4, + "even": 1, + "if": 10, + "they": 2, + "more": 1, + "than": 3, + "digits.": 1, + "As": 1, + "result": 6, + "lose": 1, + "precision": 1, + ".": 22, + "makes": 1, + "limited": 1, + "mata": 1, + "Mata": 1, + "manage": 1, + "contain": 1, + "difficult": 1, + "characters.": 2, + "starts": 1, + "definitions": 1, + "several": 1, + "macros": 1, + "these": 4, + "constants": 1, + "uses.": 1, + "For": 4, + "instance": 1, + "macro": 1, + "datemask": 1, + "varname": 1, + "constraints": 1, + "names": 16, + "Further": 1, + "files": 1, + "often": 1, + "much": 1, + "longer": 1, + "length": 3, + "limit": 1, + "These": 2, + "differences": 1, + "convention": 1, + "lead": 1, + "three": 1, + "kinds": 1, + "problematic": 1, + "Long": 3, + "involve": 1, + "invalid": 1, + "combination": 1, + "characters": 3, + "example": 2, + "begins": 1, + "colon": 1, + "followed": 1, + "number.": 1, + "convert": 2, + "instead": 1, + "naming": 1, + "v": 6, + "concatenated": 1, + "positive": 1, + "integer": 1, + "v1": 1, + "unique": 1, + "but": 4, + "when": 1, + "converted": 3, + "truncated": 1, + "become": 3, + "duplicates.": 1, + "again": 1, + "names.": 6, + "form": 1, + "duplicates": 1, + "cannot": 2, + "chooses": 1, + "different": 1, + "Because": 1, + "problem": 2, + "recommended": 1, + "you": 1, + "If": 2, + "its": 3, + "characteristic": 2, + "odkmeta##Odk_bad_name": 1, + "Odk_bad_name": 3, + "otherwise": 1, + "Most": 1, + "depend": 1, + "There": 1, + "two": 2, + "exceptions": 1, + "variables.": 1, + "error": 4, + "has": 6, + "or": 7, + "splitting": 2, + "would": 1, + "duplicate": 4, + "reshape": 2, + "groups.": 1, + "there": 2, + "merging": 2, + "code": 1, + "datasets.": 1, + "Where": 1, + "renaming": 2, + "left": 1, + "user.": 1, + "section": 2, + "designated": 2, + "area": 2, + "renaming.": 3, + "In": 3, + "reshaping": 1, + "group": 4, + "own": 2, + "Many": 1, + "forms": 2, + "require": 1, + "others": 1, + "few": 1, + "need": 1, + "renamed": 1, + "should": 1, + "go": 1, + "areas.": 1, + "However": 1, + "some": 1, + "usually": 1, + "because": 1, + "many": 2, + "nested": 2, + "above": 1, + "this": 1, + "case": 1, + "work": 1, + "best": 1, + "Odk_group": 1, + "Odk_name": 1, + "Odk_is_other": 2, + "Odk_geopoint": 2, + "r": 2, + "varlist": 2, + "Odk_list_name": 2, + "foreach": 1, + "var": 5, + "*search": 1, + "n/a": 1, + "know": 1, + "don": 1, + "worksheet.": 1, + "requires": 1, + "comma": 1, + "separated": 2, + "text": 1, + "file.": 1, + "Strings": 1, + "embedded": 2, + "commas": 1, + "double": 3, + "quotes": 3, + "must": 2, + "enclosed": 1, + "another": 1, + "quote.": 1, + "pmore": 5, + "Each": 1, + "header.": 1, + "Use": 1, + "suboptions": 1, + "specify": 1, + "alternative": 1, + "respectively.": 1, + "All": 1, + "used.": 1, + "standardized": 1, + "follows": 1, + "replaced": 9, + "select_one": 3, + "begin_group": 1, + "begin": 2, + "end_group": 1, + "begin_repeat": 1, + "end_repeat": 1, + "addition": 1, + "specified": 1, + "attaches": 1, + "pmore2": 3, + "formed": 1, + "concatenating": 1, + "elements": 1, + "Odk_repeat": 1, + "nested.": 1, + "geopoint": 2, + "component": 1, + "Latitude": 1, + "Longitude": 1, + "Altitude": 1, + "Accuracy": 1, + "blank.": 1, + "imports": 4, + "XLSForm": 1, + "list.": 1, + "one.": 1, + "specifies": 4, + "vary": 1, + "definition": 1, + "rather": 1, + "multiple": 1, + "delimit": 1, + "#delimit": 1, + "dlgtab": 1, + "Other": 1, + "already": 2, + "exists.": 1, + "examples": 1, + "Examples": 1, + "named": 1, + "import.do": 7, + "including": 1, + "survey.csv": 1, + "choices.csv": 1, + "txt": 6, + "Same": 3, + "previous": 3, + "command": 3, + "appears": 2, + "fieldname": 3, + "survey_fieldname.csv": 1, + "valuename": 2, + "choices_valuename.csv": 1, + "except": 1, + "hint": 2, + "dropattrib": 2, + "does": 1, + "_all": 1, + "acknowledgements": 1, + "Acknowledgements": 1, + "Lindsey": 1, + "Shaughnessy": 1, + "Innovations": 2, + "Poverty": 2, + "Action": 2, + "assisted": 1, + "almost": 1, + "aspects": 1, + "development.": 1, + "She": 1, + "collaborated": 1, + "structure": 1, + "was": 1, + "very": 1, + "helpful": 1, + "tester": 1, + "contributed": 1, + "information": 1, + "about": 1, + "ODK.": 1, + "author": 1, + "Author": 1, + "mwhite@poverty": 1, + "action.org": 1, + "Setup": 1, + "sysuse": 1, + "auto": 1, + "Fit": 2, + "linear": 2, + "regression": 2, + "regress": 5, + "mpg": 1, + "weight": 4, + "foreign": 2, + "better": 1, + "physics": 1, + "standpoint": 1, + "gen": 1, + "gp100m": 2, + "/mpg": 1, + "Obtain": 1, + "beta": 2, + "coefficients": 1, + "refitting": 1, + "model": 1, + "Suppress": 1, + "intercept": 1, + "term": 1, + "noconstant": 1, + "Model": 1, + "bn.foreign": 1, + "hascons": 1, + "matrix": 3, + "tanh": 1, + "u": 3, + "eu": 4, + "emu": 4, + "exp": 2, + "return": 1, + "/": 1 + }, + "STON": { + "[": 11, + "]": 11, + "{": 15, + "#a": 1, + "#b": 1, + "}": 15, + "Rectangle": 1, + "#origin": 1, + "Point": 2, + "-": 2, + "#corner": 1, + "TestDomainObject": 1, + "#created": 1, + "DateAndTime": 2, + "#modified": 1, + "#integer": 1, + "#float": 1, + "#description": 1, + "#color": 1, + "#green": 1, + "#tags": 1, + "#two": 1, + "#beta": 1, + "#medium": 1, + "#bytes": 1, + "ByteArray": 1, + "#boolean": 1, + "false": 1, + "ZnResponse": 1, + "#headers": 2, + "ZnHeaders": 1, + "ZnMultiValueDictionary": 1, + "#entity": 1, + "ZnStringEntity": 1, + "#contentType": 1, + "ZnMimeType": 1, + "#main": 1, + "#sub": 1, + "#parameters": 1, + "#contentLength": 1, + "#string": 1, + "#encoder": 1, + "ZnUTF8Encoder": 1, + "#statusLine": 1, + "ZnStatusLine": 1, + "#version": 1, + "#code": 1, + "#reason": 1 + }, "Stylus": { "border": 6, "-": 10, @@ -44884,6 +63717,554 @@ "wait": 1, ".fork": 1 }, + "Swift": { + "let": 43, + "apples": 1, + "oranges": 1, + "appleSummary": 1, + "fruitSummary": 1, + "var": 42, + "shoppingList": 3, + "[": 18, + "]": 18, + "occupations": 2, + "emptyArray": 1, + "String": 27, + "(": 89, + ")": 89, + "emptyDictionary": 1, + "Dictionary": 1, + "": 1, + "Float": 1, + "//": 1, + "Went": 1, + "shopping": 1, + "and": 1, + "bought": 1, + "everything.": 1, + "individualScores": 2, + "teamScore": 4, + "for": 10, + "score": 2, + "in": 11, + "{": 77, + "if": 6, + "+": 15, + "}": 77, + "else": 1, + "optionalString": 2, + "nil": 1, + "optionalName": 2, + "greeting": 2, + "name": 21, + "vegetable": 2, + "switch": 4, + "case": 21, + "vegetableComment": 4, + "x": 1, + "where": 2, + "x.hasSuffix": 1, + "default": 2, + "interestingNumbers": 2, + "largest": 4, + "kind": 1, + "numbers": 6, + "number": 13, + "n": 5, + "while": 2, + "<": 4, + "*": 7, + "m": 5, + "do": 1, + "firstForLoop": 3, + "i": 6, + "secondForLoop": 3, + ";": 2, + "println": 1, + "func": 24, + "greet": 2, + "day": 1, + "-": 21, + "return": 30, + "getGasPrices": 2, + "Double": 11, + "sumOf": 3, + "Int...": 1, + "Int": 19, + "sum": 3, + "returnFifteen": 2, + "y": 3, + "add": 2, + "makeIncrementer": 2, + "addOne": 2, + "increment": 2, + "hasAnyMatches": 2, + "list": 2, + "condition": 2, + "Bool": 4, + "item": 4, + "true": 2, + "false": 2, + "lessThanTen": 2, + "numbers.map": 2, + "result": 5, + "sort": 1, + "class": 7, + "Shape": 2, + "numberOfSides": 4, + "simpleDescription": 14, + "myVariable": 2, + "myConstant": 1, + "shape": 1, + "shape.numberOfSides": 1, + "shapeDescription": 1, + "shape.simpleDescription": 1, + "NamedShape": 3, + "init": 4, + "self.name": 1, + "Square": 7, + "sideLength": 17, + "self.sideLength": 2, + "super.init": 2, + "area": 1, + "override": 2, + "test": 1, + "test.area": 1, + "test.simpleDescription": 1, + "EquilateralTriangle": 4, + "perimeter": 1, + "get": 2, + "set": 1, + "newValue": 1, + "/": 1, + "triangle": 3, + "triangle.perimeter": 2, + "triangle.sideLength": 2, + "TriangleAndSquare": 2, + "willSet": 2, + "square.sideLength": 1, + "newValue.sideLength": 2, + "square": 2, + "size": 4, + "triangleAndSquare": 1, + "triangleAndSquare.square.sideLength": 1, + "triangleAndSquare.triangle.sideLength": 2, + "triangleAndSquare.square": 1, + "Counter": 2, + "count": 2, + "incrementBy": 1, + "amount": 2, + "numberOfTimes": 2, + "times": 4, + "counter": 1, + "counter.incrementBy": 1, + "optionalSquare": 2, + ".sideLength": 1, + "enum": 4, + "Rank": 2, + "Ace": 1, + "Two": 1, + "Three": 1, + "Four": 1, + "Five": 1, + "Six": 1, + "Seven": 1, + "Eight": 1, + "Nine": 1, + "Ten": 1, + "Jack": 1, + "Queen": 1, + "King": 1, + "self": 3, + ".Ace": 1, + ".Jack": 1, + ".Queen": 1, + ".King": 1, + "self.toRaw": 1, + "ace": 1, + "Rank.Ace": 1, + "aceRawValue": 1, + "ace.toRaw": 1, + "convertedRank": 1, + "Rank.fromRaw": 1, + "threeDescription": 1, + "convertedRank.simpleDescription": 1, + "Suit": 2, + "Spades": 1, + "Hearts": 1, + "Diamonds": 1, + "Clubs": 1, + ".Spades": 2, + ".Hearts": 1, + ".Diamonds": 1, + ".Clubs": 1, + "hearts": 1, + "Suit.Hearts": 1, + "heartsDescription": 1, + "hearts.simpleDescription": 1, + "implicitInteger": 1, + "implicitDouble": 1, + "explicitDouble": 1, + "struct": 2, + "Card": 2, + "rank": 2, + "suit": 2, + "threeOfSpades": 1, + ".Three": 1, + "threeOfSpadesDescription": 1, + "threeOfSpades.simpleDescription": 1, + "ServerResponse": 1, + "Result": 1, + "Error": 1, + "success": 2, + "ServerResponse.Result": 1, + "failure": 1, + "ServerResponse.Error": 1, + ".Result": 1, + "sunrise": 1, + "sunset": 1, + "serverResponse": 2, + ".Error": 1, + "error": 1, + "protocol": 1, + "ExampleProtocol": 5, + "mutating": 3, + "adjust": 4, + "SimpleClass": 2, + "anotherProperty": 1, + "a": 2, + "a.adjust": 1, + "aDescription": 1, + "a.simpleDescription": 1, + "SimpleStructure": 2, + "b": 1, + "b.adjust": 1, + "bDescription": 1, + "b.simpleDescription": 1, + "extension": 1, + "protocolValue": 1, + "protocolValue.simpleDescription": 1, + "repeat": 2, + "": 1, + "ItemType": 3, + "OptionalValue": 2, + "": 1, + "None": 1, + "Some": 1, + "T": 5, + "possibleInteger": 2, + "": 1, + ".None": 1, + ".Some": 1, + "anyCommonElements": 2, + "": 1, + "U": 4, + "Sequence": 2, + "GeneratorType": 3, + "Element": 3, + "Equatable": 1, + "lhs": 2, + "rhs": 2, + "lhsItem": 2, + "rhsItem": 2, + "label": 2, + "width": 2, + "widthLabel": 1 + }, + "SystemVerilog": { + "module": 3, + "endpoint_phy_wrapper": 2, + "(": 92, + "input": 12, + "clk_sys_i": 2, + "clk_ref_i": 6, + "clk_rx_i": 3, + "rst_n_i": 3, + "IWishboneMaster.master": 2, + "src": 1, + "IWishboneSlave.slave": 1, + "snk": 1, + "sys": 1, + "output": 6, + "[": 17, + "]": 17, + "td_o": 2, + "rd_i": 2, + "txn_o": 2, + "txp_o": 2, + "rxn_i": 2, + "rxp_i": 2, + ")": 92, + ";": 32, + "wire": 12, + "rx_clock": 3, + "parameter": 2, + "g_phy_type": 6, + "gtx_data": 3, + "gtx_k": 3, + "gtx_disparity": 3, + "gtx_enc_error": 3, + "grx_data": 3, + "grx_clk": 1, + "grx_k": 3, + "grx_enc_error": 3, + "grx_bitslide": 2, + "gtp_rst": 2, + "tx_clock": 3, + "generate": 1, + "if": 5, + "begin": 4, + "assign": 2, + "wr_tbi_phy": 1, + "U_Phy": 1, + ".serdes_rst_i": 1, + ".serdes_loopen_i": 1, + "b0": 5, + ".serdes_enable_i": 1, + "b1": 2, + ".serdes_tx_data_i": 1, + ".serdes_tx_k_i": 1, + ".serdes_tx_disparity_o": 1, + ".serdes_tx_enc_err_o": 1, + ".serdes_rx_data_o": 1, + ".serdes_rx_k_o": 1, + ".serdes_rx_enc_err_o": 1, + ".serdes_rx_bitslide_o": 1, + ".tbi_refclk_i": 1, + ".tbi_rbclk_i": 1, + ".tbi_td_o": 1, + ".tbi_rd_i": 1, + ".tbi_syncen_o": 1, + ".tbi_loopen_o": 1, + ".tbi_prbsen_o": 1, + ".tbi_enable_o": 1, + "end": 4, + "else": 2, + "//": 3, + "wr_gtx_phy_virtex6": 1, + "#": 3, + ".g_simulation": 2, + "U_PHY": 1, + ".clk_ref_i": 2, + ".tx_clk_o": 1, + ".tx_data_i": 1, + ".tx_k_i": 1, + ".tx_disparity_o": 1, + ".tx_enc_err_o": 1, + ".rx_rbclk_o": 1, + ".rx_data_o": 1, + ".rx_k_o": 1, + ".rx_enc_err_o": 1, + ".rx_bitslide_o": 1, + ".rst_i": 1, + ".loopen_i": 1, + ".pad_txn0_o": 1, + ".pad_txp0_o": 1, + ".pad_rxn0_i": 1, + ".pad_rxp0_i": 1, + "endgenerate": 1, + "wr_endpoint": 1, + ".g_pcs_16bit": 1, + ".g_rx_buffer_size": 1, + ".g_with_rx_buffer": 1, + ".g_with_timestamper": 1, + ".g_with_dmtd": 1, + ".g_with_dpi_classifier": 1, + ".g_with_vlans": 1, + ".g_with_rtu": 1, + "DUT": 1, + ".clk_sys_i": 1, + ".clk_dmtd_i": 1, + ".rst_n_i": 1, + ".pps_csync_p1_i": 1, + ".src_dat_o": 1, + "snk.dat_i": 1, + ".src_adr_o": 1, + "snk.adr": 1, + ".src_sel_o": 1, + "snk.sel": 1, + ".src_cyc_o": 1, + "snk.cyc": 1, + ".src_stb_o": 1, + "snk.stb": 1, + ".src_we_o": 1, + "snk.we": 1, + ".src_stall_i": 1, + "snk.stall": 1, + ".src_ack_i": 1, + "snk.ack": 1, + ".src_err_i": 1, + ".rtu_full_i": 1, + ".rtu_rq_strobe_p1_o": 1, + ".rtu_rq_smac_o": 1, + ".rtu_rq_dmac_o": 1, + ".rtu_rq_vid_o": 1, + ".rtu_rq_has_vid_o": 1, + ".rtu_rq_prio_o": 1, + ".rtu_rq_has_prio_o": 1, + ".wb_cyc_i": 1, + "sys.cyc": 1, + ".wb_stb_i": 1, + "sys.stb": 1, + ".wb_we_i": 1, + "sys.we": 1, + ".wb_sel_i": 1, + "sys.sel": 1, + ".wb_adr_i": 1, + "sys.adr": 1, + ".wb_dat_i": 1, + "sys.dat_o": 1, + ".wb_dat_o": 1, + "sys.dat_i": 1, + ".wb_ack_o": 1, + "sys.ack": 1, + "endmodule": 2, + "fifo": 1, + "clk_50": 1, + "clk_2": 1, + "reset_n": 1, + "data_out": 1, + "empty": 1, + "priority_encoder": 1, + "INPUT_WIDTH": 3, + "OUTPUT_WIDTH": 3, + "logic": 2, + "-": 4, + "input_data": 2, + "output_data": 3, + "int": 1, + "ii": 6, + "always_comb": 1, + "for": 2, + "<": 1, + "+": 3, + "function": 1, + "integer": 2, + "log2": 4, + "x": 6, + "endfunction": 1 + }, + "Tcl": { + "#": 7, + "package": 2, + "require": 2, + "Tcl": 2, + "namespace": 6, + "eval": 2, + "stream": 61, + "{": 148, + "export": 3, + "[": 76, + "a": 1, + "-": 5, + "z": 1, + "]": 76, + "*": 19, + "}": 148, + "ensemble": 1, + "create": 7, + "proc": 28, + "first": 24, + "restCmdPrefix": 2, + "return": 22, + "list": 18, + "lassign": 11, + "foldl": 1, + "cmdPrefix": 19, + "initialValue": 7, + "args": 13, + "set": 34, + "numStreams": 3, + "llength": 5, + "if": 14, + "FoldlSingleStream": 2, + "lindex": 5, + "elseif": 3, + "FoldlMultiStream": 2, + "else": 5, + "Usage": 4, + "foreach": 5, + "numArgs": 7, + "varName": 7, + "body": 8, + "ForeachSingleStream": 2, + "(": 11, + ")": 11, + "&&": 2, + "%": 1, + "end": 2, + "items": 5, + "lrange": 1, + "ForeachMultiStream": 2, + "fromList": 2, + "_list": 4, + "index": 4, + "expr": 4, + "+": 1, + "isEmpty": 10, + "map": 1, + "MapSingleStream": 3, + "MapMultiStream": 3, + "rest": 22, + "select": 2, + "while": 6, + "take": 2, + "num": 3, + "||": 1, + "<": 1, + "toList": 1, + "res": 10, + "lappend": 8, + "#################################": 2, + "acc": 9, + "streams": 5, + "firsts": 6, + "restStreams": 6, + "uplevel": 4, + "nextItems": 4, + "msg": 1, + "code": 1, + "error": 1, + "level": 1, + "XDG": 11, + "variable": 4, + "DEFAULTS": 8, + "DATA_HOME": 4, + "CONFIG_HOME": 4, + "CACHE_HOME": 4, + "RUNTIME_DIR": 3, + "DATA_DIRS": 4, + "CONFIG_DIRS": 4, + "SetDefaults": 3, + "ne": 2, + "file": 9, + "join": 9, + "env": 8, + "HOME": 3, + ".local": 1, + "share": 3, + ".config": 1, + ".cache": 1, + "/usr": 2, + "local": 1, + "/etc": 1, + "xdg": 1, + "XDGVarSet": 4, + "var": 11, + "info": 1, + "exists": 1, + "XDG_": 4, + "Dir": 4, + "subdir": 16, + "dir": 5, + "dict": 2, + "get": 2, + "Dirs": 3, + "rawDirs": 3, + "split": 1, + "outDirs": 3, + "XDG_RUNTIME_DIR": 1 + }, "Tea": { "<%>": 1, "template": 1, @@ -45992,6 +65373,87 @@ "log": 1, "defaultproperties": 1 }, + "VCL": { + "sub": 23, + "vcl_recv": 2, + "{": 50, + "if": 14, + "(": 50, + "req.request": 18, + "&&": 14, + ")": 50, + "return": 33, + "pipe": 4, + ";": 48, + "}": 50, + "pass": 9, + "req.http.Authorization": 2, + "||": 4, + "req.http.Cookie": 2, + "lookup": 2, + "vcl_pipe": 2, + "vcl_pass": 2, + "vcl_hash": 2, + "set": 10, + "req.hash": 3, + "+": 17, + "req.url": 2, + "req.http.host": 4, + "else": 3, + "server.ip": 2, + "hash": 2, + "vcl_hit": 2, + "obj.cacheable": 2, + "deliver": 8, + "vcl_miss": 2, + "fetch": 3, + "vcl_fetch": 2, + "obj.http.Set": 1, + "-": 21, + "Cookie": 2, + "obj.prefetch": 1, + "s": 3, + "vcl_deliver": 2, + "vcl_discard": 1, + "discard": 2, + "vcl_prefetch": 1, + "vcl_timeout": 1, + "vcl_error": 2, + "obj.http.Content": 2, + "Type": 2, + "synthetic": 2, + "utf": 2, + "//W3C//DTD": 2, + "XHTML": 2, + "Strict//EN": 2, + "http": 3, + "//www.w3.org/TR/xhtml1/DTD/xhtml1": 2, + "strict.dtd": 2, + "obj.status": 4, + "obj.response": 6, + "req.xid": 2, + "//www.varnish": 1, + "cache.org/": 1, + "req.restarts": 1, + "req.http.x": 1, + "forwarded": 1, + "for": 1, + "req.http.X": 3, + "Forwarded": 3, + "For": 3, + "client.ip": 2, + "hash_data": 3, + "beresp.ttl": 2, + "<": 1, + "beresp.http.Set": 1, + "beresp.http.Vary": 1, + "hit_for_pass": 1, + "obj.http.Retry": 1, + "After": 1, + "vcl_init": 1, + "ok": 2, + "vcl_fini": 1 + }, "Verilog": { "////////////////////////////////////////////////////////////////////////////////": 14, "//": 117, @@ -47325,17 +66787,140 @@ "return": 1 }, "XML": { - "": 4, - "version=": 6, + "": 11, + "version=": 17, + "encoding=": 7, + "": 7, + "ToolsVersion=": 6, + "DefaultTargets=": 5, + "xmlns=": 8, + "": 21, + "Project=": 12, + "Condition=": 37, + "": 26, + "": 6, + "Debug": 10, + "": 6, + "": 6, + "AnyCPU": 10, + "": 6, + "": 5, + "{": 6, + "D9BF15": 1, + "-": 90, + "D10": 1, + "ABAD688E8B": 1, + "}": 6, + "": 5, + "": 4, + "Exe": 4, + "": 4, + "": 2, + "Properties": 3, + "": 2, + "": 5, + "csproj_sample": 1, + "": 5, + "": 4, + "csproj": 1, + "sample": 6, + "": 4, + "": 5, + "v4.5.1": 5, + "": 5, + "": 3, + "": 3, + "": 3, + "true": 24, + "": 3, + "": 25, + "": 6, + "": 6, + "": 5, + "": 5, + "": 6, + "full": 4, + "": 6, + "": 7, + "false": 11, + "": 7, + "": 8, + "bin": 11, + "": 8, + "": 6, + "DEBUG": 3, + ";": 52, + "TRACE": 6, + "": 6, + "": 4, + "prompt": 4, + "": 4, + "": 8, + "": 8, + "pdbonly": 3, + "Release": 6, + "": 26, + "": 30, + "Include=": 78, + "": 26, + "": 10, + "": 5, + "": 7, + "": 2, + "": 2, + "cfa7a11": 1, + "a5cd": 1, + "bd7b": 1, + "b210d4d51a29": 1, + "fsproj_sample": 2, + "": 1, + "": 1, + "": 3, + "fsproj": 1, + "": 3, + "": 2, + "": 2, + "": 5, + "fsproj_sample.XML": 2, + "": 5, + "": 2, + "": 2, + "": 2, + "True": 13, + "": 2, + "": 5, + "": 1, + "": 1, + "": 1, + "": 1, + "": 2, + "(": 65, + "MSBuildExtensionsPath32": 2, + ")": 58, + "..": 1, + "Microsoft": 2, + "SDKs": 1, + "F#": 1, + "Framework": 1, + "v4.0": 1, + "Microsoft.FSharp.Targets": 2, + "": 2, + "": 1, + "": 1, + "VisualStudio": 1, + "v": 1, + "VisualStudioVersion": 1, + "FSharp": 1, + "": 1, + "": 1, "": 1, - "name=": 223, + "name=": 227, "xmlns": 2, "ea=": 2, - "": 2, + "": 4, "This": 21, "easyant": 3, "module.ant": 1, - "sample": 2, "file": 3, "is": 123, "optionnal": 1, @@ -47349,7 +66934,7 @@ "own": 2, "specific": 8, "target.": 1, - "": 2, + "": 4, "": 2, "": 2, "my": 2, @@ -47378,7 +66963,7 @@ "this": 77, "a": 128, "module.ivy": 1, - "for": 59, + "for": 60, "java": 1, "standard": 1, "application": 2, @@ -47394,14 +66979,13 @@ "description=": 2, "": 1, "": 1, - "": 1, + "": 4, "org=": 1, "rev=": 1, "conf=": 1, "default": 9, "junit": 2, "test": 7, - "-": 49, "/": 6, "": 1, "": 1, @@ -47413,7 +66997,7 @@ "": 1, "": 1, "": 120, - "": 120, + "": 121, "IObservedChange": 5, "generic": 3, "interface": 4, @@ -47427,9 +67011,7 @@ "used": 19, "both": 2, "Changing": 5, - "(": 52, "i.e.": 23, - ")": 45, "Changed": 4, "Observables.": 2, "In": 6, @@ -47443,15 +67025,15 @@ "casting": 1, "between": 15, "changes.": 2, - "": 121, + "": 122, "": 120, - "The": 74, + "The": 75, "object": 42, "has": 16, "raised": 1, "change.": 12, "name": 7, - "of": 75, + "of": 76, "property": 74, "changed": 18, "on": 35, @@ -47547,7 +67129,7 @@ "itself": 2, "changes": 13, ".": 20, - "It": 1, + "It": 2, "important": 6, "implement": 5, "Changing/Changed": 1, @@ -47589,7 +67171,6 @@ "ItemChanging": 2, "ItemChanged": 2, "properties": 29, - ";": 10, "implementing": 2, "rebroadcast": 2, "through": 3, @@ -47625,7 +67206,7 @@ "string": 13, "distinguish": 12, "arbitrarily": 2, - "by": 13, + "by": 14, "client.": 2, "Listen": 4, "provides": 6, @@ -47637,7 +67218,7 @@ "to.": 7, "": 12, "": 84, - "A": 19, + "A": 21, "identical": 11, "types": 10, "one": 27, @@ -47649,7 +67230,6 @@ "particular": 2, "registered.": 2, "message.": 1, - "True": 6, "posted": 3, "Type.": 2, "Registers": 3, @@ -47683,7 +67263,7 @@ "allows": 15, "log": 2, "attached.": 1, - "data": 1, + "data": 2, "structure": 1, "representation": 1, "memoizing": 2, @@ -47725,7 +67305,6 @@ "evicted": 2, "because": 2, "Invalidate": 2, - "full": 1, "Evaluates": 1, "returning": 1, "cached": 2, @@ -47943,7 +67522,6 @@ "notification": 6, "Attempts": 1, "expression": 3, - "false": 2, "expression.": 1, "entire": 1, "able": 1, @@ -48033,7 +67611,7 @@ "private": 1, "field.": 1, "Reference": 1, - "Use": 13, + "Use": 15, "custom": 4, "raiseAndSetIfChanged": 1, "doesn": 1, @@ -48109,7 +67687,40 @@ "setup.": 12, "": 1, "": 1, - "encoding=": 1, + "": 1, + "": 1, + "c67af951": 1, + "d8d6376993e7": 1, + "nproj_sample": 2, + "": 1, + "": 1, + "": 1, + "Net": 1, + "": 1, + "": 1, + "ProgramFiles": 1, + "Nemerle": 3, + "": 1, + "": 1, + "NemerleBinPathRoot": 1, + "NemerleVersion": 1, + "": 1, + "nproj": 1, + "OutputPath": 1, + "AssemblyName": 1, + ".xml": 1, + "": 3, + "": 3, + "": 1, + "False": 1, + "": 1, + "": 2, + "Nemerle.dll": 1, + "": 2, + "": 1, + "Nemerle.Linq.dll": 1, + "": 1, + "": 1, "": 1, "TS": 1, "": 1, @@ -48150,7 +67761,443 @@ "English": 1, "Ingl": 1, "": 1, - "": 1 + "": 1, + "": 1, + "": 1, + "": 1, + "Sample": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "Hugh": 2, + "Bot": 2, + "": 1, + "": 1, + "": 1, + "package": 1, + "nuget": 1, + "just": 1, + "works": 1, + "": 1, + "http": 2, + "//hubot.github.com": 1, + "": 1, + "": 1, + "": 1, + "https": 1, + "//github.com/github/hubot/LICENSEmd": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "src=": 1, + "target=": 1, + "": 1, + "": 1, + "MyCommon": 1, + "": 1, + "Name=": 1, + "": 1, + "Text=": 1, + "": 1, + "D377F": 1, + "A798": 1, + "B3FD04C": 1, + "": 1, + "vbproj_sample.Module1": 1, + "": 1, + "vbproj_sample": 1, + "vbproj": 3, + "": 1, + "Console": 3, + "": 1, + "": 2, + "": 2, + "": 2, + "": 2, + "sample.xml": 2, + "": 2, + "": 2, + "": 1, + "On": 2, + "": 1, + "": 1, + "Binary": 1, + "": 1, + "": 1, + "Off": 1, + "": 1, + "": 1, + "": 1, + "": 3, + "": 3, + "": 3, + "Application.myapp": 1, + "": 3, + "": 3, + "": 1, + "": 1, + "Resources.resx": 1, + "Settings.settings": 1, + "": 1, + "": 1, + "": 1, + "": 3, + "VbMyResourcesResXFileCodeGenerator": 1, + "": 3, + "": 3, + "Resources.Designer.vb": 1, + "": 3, + "": 2, + "My.Resources": 1, + "": 2, + "": 1, + "Designer": 1, + "": 1, + "": 1, + "MyApplicationCodeGenerator": 1, + "Application.Designer.vb": 1, + "": 2, + "SettingsSingleFileGenerator": 1, + "My": 1, + "Settings.Designer.vb": 1, + "Label=": 11, + "": 2, + "Win32": 2, + "": 2, + "BF6EED48": 1, + "BF18": 1, + "C54": 1, + "F": 1, + "BBF19EEDC7C": 1, + "": 1, + "ManagedCProj": 1, + "": 1, + "vcxprojsample": 1, + "": 2, + "Application": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "v120": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "Unicode": 2, + "": 2, + "": 4, + "": 4, + "": 2, + "": 2, + "": 2, + "": 8, + "Level3": 2, + "": 1, + "Disabled": 1, + "": 1, + "": 2, + "WIN32": 2, + "_DEBUG": 1, + "%": 2, + "PreprocessorDefinitions": 2, + "": 2, + "": 4, + "": 4, + "": 6, + "": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "": 2, + "NDEBUG": 1, + "": 2, + "": 4, + "": 2, + "Create": 2, + "": 2, + "": 10, + "": 3, + "FC737F1": 1, + "C7A5": 1, + "A066": 1, + "A32D752A2FF": 1, + "": 3, + "": 3, + "cpp": 1, + "c": 1, + "cc": 1, + "cxx": 1, + "def": 1, + "odl": 1, + "idl": 1, + "hpj": 1, + "bat": 1, + "asm": 1, + "asmx": 1, + "": 3, + "": 10, + "BD": 1, + "b04": 1, + "EB": 1, + "FBE52EBFB": 1, + "h": 1, + "hh": 1, + "hpp": 1, + "hxx": 1, + "hm": 1, + "inl": 1, + "inc": 1, + "xsd": 1, + "DA6AB6": 1, + "F800": 1, + "c08": 1, + "B7A": 1, + "BB121AAD01": 1, + "rc": 1, + "ico": 1, + "cur": 1, + "bmp": 1, + "dlg": 1, + "rc2": 1, + "rct": 1, + "rgs": 1, + "gif": 1, + "jpg": 1, + "jpeg": 1, + "jpe": 1, + "resx": 1, + "tiff": 1, + "tif": 1, + "png": 1, + "wav": 1, + "mfcribbon": 1, + "ms": 1, + "Header": 2, + "Files": 7, + "": 2, + "Resource": 2, + "": 1, + "Source": 3, + "": 1, + "": 1, + "compatVersion=": 1, + "": 1, + "FreeMedForms": 1, + "": 1, + "": 1, + "C": 1, + "Eric": 1, + "MAEKER": 1, + "MD": 1, + "": 1, + "": 1, + "GPLv3": 1, + "": 1, + "": 1, + "Patient": 1, + "": 1, + "XML": 1, + "form": 1, + "loader/saver": 1, + "FreeMedForms.": 1, + "": 1, + "//www.freemedforms.com/": 1, + "": 1, + "": 1, + "": 1, + "": 1 + }, + "Xojo": { + "#tag": 88, + "Class": 3, + "Protected": 1, + "App": 1, + "Inherits": 1, + "Application": 1, + "Constant": 3, + "Name": 31, + "kEditClear": 1, + "Type": 34, + "String": 3, + "Dynamic": 3, + "False": 14, + "Default": 9, + "Scope": 4, + "Public": 3, + "#Tag": 5, + "Instance": 5, + "Platform": 5, + "Windows": 2, + "Language": 5, + "Definition": 5, + "Linux": 2, + "EndConstant": 3, + "kFileQuit": 1, + "kFileQuitShortcut": 1, + "Mac": 1, + "OS": 1, + "ViewBehavior": 2, + "EndViewBehavior": 2, + "End": 27, + "EndClass": 1, + "Report": 2, + "Begin": 23, + "BillingReport": 1, + "Compatibility": 2, + "Units": 1, + "Width": 3, + "PageHeader": 1, + "Height": 5, + "Body": 1, + "PageFooter": 1, + "EndReport": 1, + "ReportCode": 1, + "EndReportCode": 1, + "Dim": 3, + "dbFile": 3, + "As": 4, + "FolderItem": 1, + "db": 1, + "New": 1, + "SQLiteDatabase": 1, + "GetFolderItem": 1, + "(": 7, + ")": 7, + "db.DatabaseFile": 1, + "If": 4, + "db.Connect": 1, + "Then": 1, + "db.SQLExecute": 2, + "_": 1, + "+": 5, + "db.Error": 1, + "then": 1, + "MsgBox": 3, + "db.ErrorMessage": 2, + "db.Rollback": 1, + "Else": 2, + "db.Commit": 1, + "Menu": 2, + "MainMenuBar": 1, + "MenuItem": 11, + "FileMenu": 1, + "SpecialMenu": 13, + "Text": 13, + "Index": 14, + "-": 14, + "AutoEnable": 13, + "True": 46, + "Visible": 41, + "QuitMenuItem": 1, + "FileQuit": 1, + "ShortcutKey": 6, + "Shortcut": 6, + "EditMenu": 1, + "EditUndo": 1, + "MenuModifier": 5, + "EditSeparator1": 1, + "EditCut": 1, + "EditCopy": 1, + "EditPaste": 1, + "EditClear": 1, + "EditSeparator2": 1, + "EditSelectAll": 1, + "UntitledSeparator": 1, + "AppleMenuItem": 1, + "AboutItem": 1, + "EndMenu": 1, + "Toolbar": 2, + "MyToolbar": 1, + "ToolButton": 2, + "FirstItem": 1, + "Caption": 3, + "HelpTag": 3, + "Style": 2, + "SecondItem": 1, + "EndToolbar": 1, + "Window": 2, + "Window1": 1, + "BackColor": 1, + "&": 1, + "cFFFFFF00": 1, + "Backdrop": 1, + "CloseButton": 1, + "Composite": 1, + "Frame": 1, + "FullScreen": 1, + "FullScreenButton": 1, + "HasBackColor": 1, + "ImplicitInstance": 1, + "LiveResize": 1, + "MacProcID": 1, + "MaxHeight": 1, + "MaximizeButton": 1, + "MaxWidth": 1, + "MenuBar": 1, + "MenuBarVisible": 1, + "MinHeight": 1, + "MinimizeButton": 1, + "MinWidth": 1, + "Placement": 1, + "Resizeable": 1, + "Title": 1, + "PushButton": 1, + "HelloWorldButton": 2, + "AutoDeactivate": 1, + "Bold": 1, + "ButtonStyle": 1, + "Cancel": 1, + "Enabled": 1, + "InitialParent": 1, + "Italic": 1, + "Left": 1, + "LockBottom": 1, + "LockedInPosition": 1, + "LockLeft": 1, + "LockRight": 1, + "LockTop": 1, + "TabIndex": 1, + "TabPanelIndex": 1, + "TabStop": 1, + "TextFont": 1, + "TextSize": 1, + "TextUnit": 1, + "Top": 1, + "Underline": 1, + "EndWindow": 1, + "WindowCode": 1, + "EndWindowCode": 1, + "Events": 1, + "Event": 1, + "Sub": 2, + "Action": 1, + "total": 4, + "Integer": 2, + "For": 1, + "i": 2, + "To": 1, + "Next": 1, + "Str": 1, + "EndEvent": 1, + "EndEvents": 1, + "ViewProperty": 28, + "true": 26, + "Group": 28, + "InitialValue": 23, + "EndViewProperty": 28, + "EditorType": 14, + "EnumValues": 2, + "EndEnumValues": 2 }, "XProc": { "": 1, @@ -48459,7 +68506,7 @@ }, "YAML": { "gem": 1, - "-": 16, + "-": 25, "local": 1, "gen": 1, "rdoc": 2, @@ -48471,17 +68518,266 @@ "numbers": 1, "gempath": 1, "/usr/local/rubygems": 1, - "/home/gavin/.rubygems": 1 + "/home/gavin/.rubygems": 1, + "http_interactions": 1, + "request": 1, + "method": 1, + "get": 1, + "uri": 1, + "http": 1, + "//example.com/": 1, + "body": 3, + "headers": 2, + "{": 1, + "}": 1, + "response": 2, + "status": 1, + "code": 1, + "message": 1, + "OK": 1, + "Content": 2, + "Type": 1, + "text/html": 1, + ";": 1, + "charset": 1, + "utf": 1, + "Length": 1, + "This": 1, + "is": 1, + "the": 1, + "http_version": 1, + "recorded_at": 1, + "Tue": 1, + "Nov": 1, + "GMT": 1, + "recorded_with": 1, + "VCR": 1 + }, + "Zephir": { + "%": 10, + "{": 58, + "#define": 1, + "MAX_FACTOR": 3, + "}": 52, + "namespace": 4, + "Test": 4, + ";": 91, + "#include": 9, + "static": 1, + "long": 3, + "fibonacci": 4, + "(": 59, + "n": 5, + ")": 57, + "if": 39, + "<": 2, + "return": 26, + "else": 11, + "-": 25, + "+": 5, + "class": 3, + "Cblock": 1, + "public": 22, + "function": 22, + "testCblock1": 1, + "int": 3, + "a": 6, + "testCblock2": 1, + "#ifdef": 1, + "HAVE_CONFIG_H": 1, + "#endif": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "ZEPHIR_INIT_CLASS": 2, + "Test_Router_Exception": 2, + "ZEPHIR_REGISTER_CLASS_EX": 1, + "Router": 3, + "Exception": 4, + "test": 1, + "router_exception": 1, + "zend_exception_get_default": 1, + "TSRMLS_C": 1, + "NULL": 1, + "SUCCESS": 1, + "extern": 1, + "zend_class_entry": 1, + "*test_router_exception_ce": 1, + "php": 1, + "extends": 1, + "Route": 1, + "protected": 9, + "_pattern": 3, + "_compiledPattern": 3, + "_paths": 3, + "_methods": 5, + "_hostname": 3, + "_converters": 3, + "_id": 2, + "_name": 3, + "_beforeMatch": 3, + "__construct": 1, + "pattern": 37, + "paths": 7, + "null": 11, + "httpMethods": 6, + "this": 28, + "reConfigure": 2, + "let": 51, + "compilePattern": 2, + "var": 4, + "idPattern": 6, + "memstr": 10, + "str_replace": 6, + ".": 5, + "via": 1, + "extractNamedParams": 2, + "string": 6, + "char": 1, + "ch": 27, + "tmp": 4, + "matches": 5, + "boolean": 1, + "notValid": 5, + "false": 3, + "cursor": 4, + "cursorVar": 5, + "marker": 4, + "bracketCount": 7, + "parenthesesCount": 5, + "foundPattern": 6, + "intermediate": 4, + "numberMatches": 4, + "route": 12, + "item": 7, + "variable": 5, + "regexp": 7, + "strlen": 1, + "<=>": 5, + "0": 9, + "for": 4, + "in": 4, + "1": 3, + "substr": 3, + "break": 9, + "&&": 6, + "z": 2, + "Z": 2, + "true": 2, + "<='9')>": 1, + "_": 1, + "2": 2, + "continue": 1, + "[": 14, + "]": 14, + "moduleName": 5, + "controllerName": 7, + "actionName": 4, + "parts": 9, + "routePaths": 5, + "realClassName": 1, + "namespaceName": 1, + "pcrePattern": 4, + "compiledPattern": 4, + "extracted": 4, + "typeof": 2, + "throw": 1, + "new": 1, + "explode": 1, + "switch": 1, + "count": 1, + "case": 3, + "controller": 1, + "action": 1, + "array": 1, + "The": 1, + "contains": 1, + "invalid": 1, + "#": 1, + "array_merge": 1, + "//Update": 1, + "the": 1, + "s": 1, + "name": 5, + "*": 2, + "@return": 1, + "*/": 1, + "getName": 1, + "setName": 1, + "beforeMatch": 1, + "callback": 2, + "getBeforeMatch": 1, + "getRouteId": 1, + "getPattern": 1, + "getCompiledPattern": 1, + "getPaths": 1, + "getReversedPaths": 1, + "reversed": 4, + "path": 3, + "position": 3, + "setHttpMethods": 1, + "getHttpMethods": 1, + "setHostname": 1, + "hostname": 2, + "getHostname": 1, + "convert": 1, + "converter": 2, + "getConverters": 1 + }, + "Zimpl": { + "#": 2, + "param": 1, + "columns": 2, + ";": 7, + "set": 3, + "I": 3, + "{": 2, + "..": 1, + "}": 2, + "IxI": 6, + "*": 2, + "TABU": 4, + "[": 8, + "": 3, + "in": 5, + "]": 8, + "": 2, + "with": 1, + "(": 6, + "m": 4, + "i": 8, + "or": 3, + "n": 4, + "j": 8, + ")": 6, + "and": 1, + "abs": 2, + "-": 3, + "var": 1, + "x": 4, + "binary": 1, + "maximize": 1, + "queens": 1, + "sum": 2, + "subto": 1, + "c1": 1, + "forall": 1, + "do": 1, + "card": 2 } }, "language_tokens": { "ABAP": 1500, "Agda": 376, + "Alloy": 1143, "ApacheConf": 1449, "Apex": 4408, "AppleScript": 1862, "Arduino": 20, "AsciiDoc": 103, + "AspectJ": 324, + "Assembly": 21750, "ATS": 4558, "AutoHotkey": 3, "Awk": 544, @@ -48490,20 +68786,25 @@ "Brightscript": 579, "C": 59053, "C#": 278, - "C++": 31181, + "C++": 34739, "Ceylon": 50, "Cirru": 244, "Clojure": 510, "COBOL": 90, "CoffeeScript": 2951, - "Common Lisp": 103, + "Common Lisp": 2186, + "Component Pascal": 825, "Coq": 18259, "Creole": 134, + "Crystal": 1506, "CSS": 43867, "Cuda": 290, "Dart": 74, "Diff": 16, "DM": 169, + "Dogescript": 30, + "E": 601, + "Eagle": 30089, "ECL": 281, "edn": 227, "Elm": 628, @@ -48511,44 +68812,63 @@ "Erlang": 2928, "fish": 636, "Forth": 1516, + "Frege": 5564, + "Game Maker Language": 13310, + "GAMS": 363, + "GAP": 9944, "GAS": 133, - "GLSL": 3766, + "GLSL": 4033, + "Gnuplot": 1023, "Gosu": 410, - "Groovy": 69, + "Grammatical Framework": 10607, + "Groovy": 93, "Groovy Server Pages": 91, "Haml": 4, "Handlebars": 69, + "Haskell": 302, + "HTML": 413, "Hy": 155, "IDL": 418, "Idris": 148, + "Inform 7": 75, "INI": 27, "Ioke": 2, + "Isabelle": 136, "Jade": 3, "Java": 8987, - "JavaScript": 76934, + "JavaScript": 76970, "JSON": 183, "JSON5": 57, + "JSONiq": 151, "JSONLD": 18, "Julia": 247, + "Kit": 6, "Kotlin": 155, "KRL": 25, "Lasso": 9849, + "Latte": 759, "Less": 39, "LFE": 1711, + "Liquid": 633, "Literate Agda": 478, "Literate CoffeeScript": 275, "LiveScript": 123, "Logos": 93, "Logtalk": 36, "Lua": 724, - "M": 23373, + "M": 23615, "Makefile": 50, "Markdown": 1, + "Mask": 74, + "Mathematica": 411, "Matlab": 11942, "Max": 714, "MediaWiki": 766, + "Mercury": 31096, "Monkey": 207, + "Moocode": 5234, "MoonScript": 1718, + "MTML": 93, "Nemerle": 17, "NetLogo": 243, "Nginx": 179, @@ -48556,18 +68876,21 @@ "NSIS": 725, "Nu": 116, "Objective-C": 26518, + "Objective-C++": 6021, "OCaml": 382, "Omgrofl": 57, "Opa": 28, "OpenCL": 144, "OpenEdge ABL": 762, "Org": 358, + "Ox": 1006, "Oxygene": 157, + "Pan": 130, "Parrot Assembly": 6, "Parrot Internal Representation": 5, "Pascal": 30, "PAWN": 3263, - "Perl": 17497, + "Perl": 17979, "Perl6": 372, "PHP": 20724, "Pod": 658, @@ -48576,17 +68899,21 @@ "PowerShell": 12, "Processing": 74, "Prolog": 468, + "Propeller Spin": 13519, "Protocol Buffer": 63, - "Python": 5715, - "R": 195, + "PureScript": 1652, + "Python": 6587, + "R": 1790, "Racket": 331, "Ragel in Ruby Host": 593, "RDoc": 279, - "Rebol": 11, + "Rebol": 533, + "Red": 816, "RMarkdown": 19, "RobotFramework": 483, "Ruby": 3862, "Rust": 3566, + "SAS": 93, "Sass": 56, "Scala": 750, "Scaml": 4, @@ -48594,17 +68921,29 @@ "Scilab": 69, "SCSS": 39, "Shell": 3744, + "ShellSession": 233, + "Shen": 3472, "Slash": 187, + "Slim": 77, + "Smalltalk": 423, + "SourcePawn": 2080, + "SQL": 1485, "Squirrel": 130, - "Standard ML": 6405, + "Standard ML": 6567, + "Stata": 3133, + "STON": 100, "Stylus": 76, "SuperCollider": 133, + "Swift": 1128, + "SystemVerilog": 541, + "Tcl": 1133, "Tea": 3, "TeX": 2701, "Turing": 44, "TXL": 213, "TypeScript": 109, "UnrealScript": 2873, + "VCL": 545, "Verilog": 3778, "VHDL": 42, "VimL": 20, @@ -48612,21 +68951,27 @@ "Volt": 388, "wisp": 1363, "XC": 24, - "XML": 5737, + "XML": 7057, + "Xojo": 807, "XProc": 22, "XQuery": 801, "XSLT": 44, "Xtend": 399, - "YAML": 30 + "YAML": 77, + "Zephir": 1085, + "Zimpl": 123 }, "languages": { "ABAP": 1, "Agda": 1, + "Alloy": 3, "ApacheConf": 3, "Apex": 6, "AppleScript": 7, "Arduino": 1, "AsciiDoc": 3, + "AspectJ": 2, + "Assembly": 4, "ATS": 10, "AutoHotkey": 1, "Awk": 1, @@ -48635,20 +68980,25 @@ "Brightscript": 1, "C": 29, "C#": 2, - "C++": 27, + "C++": 29, "Ceylon": 1, "Cirru": 9, "Clojure": 7, "COBOL": 4, "CoffeeScript": 9, - "Common Lisp": 1, + "Common Lisp": 3, + "Component Pascal": 2, "Coq": 12, "Creole": 1, + "Crystal": 3, "CSS": 2, "Cuda": 2, "Dart": 1, "Diff": 1, "DM": 1, + "Dogescript": 1, + "E": 6, + "Eagle": 2, "ECL": 1, "edn": 1, "Elm": 3, @@ -48656,44 +69006,63 @@ "Erlang": 5, "fish": 3, "Forth": 7, + "Frege": 4, + "Game Maker Language": 13, + "GAMS": 1, + "GAP": 7, "GAS": 1, - "GLSL": 3, + "GLSL": 5, + "Gnuplot": 6, "Gosu": 4, - "Groovy": 2, + "Grammatical Framework": 41, + "Groovy": 5, "Groovy Server Pages": 4, "Haml": 1, "Handlebars": 2, + "Haskell": 3, + "HTML": 2, "Hy": 2, "IDL": 4, "Idris": 1, + "Inform 7": 2, "INI": 2, "Ioke": 1, + "Isabelle": 1, "Jade": 1, "Java": 6, - "JavaScript": 20, + "JavaScript": 22, "JSON": 4, "JSON5": 2, + "JSONiq": 2, "JSONLD": 1, "Julia": 1, + "Kit": 1, "Kotlin": 1, "KRL": 1, "Lasso": 4, + "Latte": 2, "Less": 1, "LFE": 4, + "Liquid": 2, "Literate Agda": 1, "Literate CoffeeScript": 1, "LiveScript": 1, "Logos": 1, "Logtalk": 1, "Lua": 3, - "M": 28, + "M": 29, "Makefile": 2, "Markdown": 1, + "Mask": 1, + "Mathematica": 3, "Matlab": 39, "Max": 3, "MediaWiki": 1, + "Mercury": 9, "Monkey": 1, + "Moocode": 3, "MoonScript": 1, + "MTML": 1, "Nemerle": 1, "NetLogo": 1, "Nginx": 1, @@ -48701,18 +69070,21 @@ "NSIS": 2, "Nu": 2, "Objective-C": 19, + "Objective-C++": 2, "OCaml": 2, "Omgrofl": 1, "Opa": 2, "OpenCL": 2, "OpenEdge ABL": 5, "Org": 1, + "Ox": 3, "Oxygene": 1, + "Pan": 1, "Parrot Assembly": 1, "Parrot Internal Representation": 1, "Pascal": 1, "PAWN": 1, - "Perl": 14, + "Perl": 15, "Perl6": 3, "PHP": 9, "Pod": 1, @@ -48721,17 +69093,21 @@ "PowerShell": 2, "Processing": 1, "Prolog": 3, + "Propeller Spin": 10, "Protocol Buffer": 1, - "Python": 7, - "R": 3, + "PureScript": 4, + "Python": 10, + "R": 7, "Racket": 2, "Ragel in Ruby Host": 3, "RDoc": 1, - "Rebol": 1, + "Rebol": 6, + "Red": 2, "RMarkdown": 1, "RobotFramework": 3, "Ruby": 17, "Rust": 1, + "SAS": 2, "Sass": 2, "Scala": 4, "Scaml": 1, @@ -48739,17 +69115,29 @@ "Scilab": 3, "SCSS": 1, "Shell": 37, + "ShellSession": 3, + "Shen": 3, "Slash": 1, + "Slim": 1, + "Smalltalk": 3, + "SourcePawn": 1, + "SQL": 5, "Squirrel": 1, - "Standard ML": 4, + "Standard ML": 5, + "Stata": 7, + "STON": 7, "Stylus": 1, "SuperCollider": 1, + "Swift": 43, + "SystemVerilog": 4, + "Tcl": 2, "Tea": 1, "TeX": 2, "Turing": 1, "TXL": 1, "TypeScript": 3, "UnrealScript": 2, + "VCL": 2, "Verilog": 13, "VHDL": 1, "VimL": 2, @@ -48757,12 +69145,15 @@ "Volt": 1, "wisp": 1, "XC": 1, - "XML": 4, + "XML": 13, + "Xojo": 6, "XProc": 1, "XQuery": 1, "XSLT": 1, "Xtend": 2, - "YAML": 1 + "YAML": 2, + "Zephir": 5, + "Zimpl": 1 }, - "md5": "cfe1841f5e4b2ab14a1ad53ad64523b8" + "md5": "896b4ca841571551a8fe421eec69b0f6" } \ No newline at end of file diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 135f367c..4d8481e5 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -10,7 +10,7 @@ ## Vendor Conventions ## # Caches -- cache/ +- (^|/)cache/ # Dependencies - ^[Dd]ependencies/ @@ -98,6 +98,16 @@ # AngularJS - (^|/)angular([^.]*)(\.min)?\.js$ +# D3.js +- (^|\/)d3(\.v\d+)?([^.]*)(\.min)?\.js$ + +# React +- (^|/)react(-[^.]*)?(\.min)?\.js$ + +# Modernizr +- (^|/)modernizr\-\d\.\d+(\.\d+)?(\.min)?\.js$ +- (^|/)modernizr\.custom\.\d+\.js$ + ## Python ## # django @@ -128,6 +138,7 @@ # Visual Studio IntelliSense - -vsdoc\.js$ +- \.intellisense\.js$ # jQuery validation plugin (MS bundles this with asp.net mvc) - (^|/)jquery([^.]*)\.validate(\.unobtrusive)?(\.min)?\.js$ @@ -137,7 +148,7 @@ - (^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$ # NuGet -- ^[Pp]ackages/ +- ^[Pp]ackages\/.+\.\d+\/ # ExtJS - (^|/)extjs/.*?\.js$ @@ -157,6 +168,9 @@ - (^|/)extjs/src/ - (^|/)extjs/welcome/ +# Html5shiv +- (^|/)html5shiv(\.min)?\.js$ + # Samples folders - ^[Ss]amples/ @@ -182,3 +196,15 @@ # .DS_Store's - .[Dd][Ss]_[Ss]tore$ + +# Mercury --use-subdirs +- Mercury/ + +# R packages +- ^vignettes/ +- ^inst/extdata/ + +# Octicons +- octicons.css +- octicons.min.css +- sprockets-octicons.scss diff --git a/lib/linguist/version.rb b/lib/linguist/version.rb new file mode 100644 index 00000000..6704b3fb --- /dev/null +++ b/lib/linguist/version.rb @@ -0,0 +1,3 @@ +module Linguist + VERSION = "2.12.0" +end diff --git a/samples/Alloy/file_system.als b/samples/Alloy/file_system.als new file mode 100644 index 00000000..60fd959b --- /dev/null +++ b/samples/Alloy/file_system.als @@ -0,0 +1,59 @@ +module examples/systems/file_system + +/* + * Model of a generic file system. + */ + +abstract sig Object {} + +sig Name {} + +sig File extends Object {} { some d: Dir | this in d.entries.contents } + +sig Dir extends Object { + entries: set DirEntry, + parent: lone Dir +} { + parent = this.~@contents.~@entries + all e1, e2 : entries | e1.name = e2.name => e1 = e2 + this !in this.^@parent + this != Root => Root in this.^@parent +} + +one sig Root extends Dir {} { no parent } + +lone sig Cur extends Dir {} + +sig DirEntry { + name: Name, + contents: Object +} { + one this.~entries +} + + +/** + * all directories besides root have one parent + */ +pred OneParent_buggyVersion { + all d: Dir - Root | one d.parent +} + +/** + * all directories besides root have one parent + */ +pred OneParent_correctVersion { + all d: Dir - Root | (one d.parent && one contents.d) +} + +/** + * Only files may be linked (that is, have more than one entry) + * That is, all directories are the contents of at most one directory entry + */ +pred NoDirAliases { + all o: Dir | lone o.~contents +} + +check { OneParent_buggyVersion => NoDirAliases } for 5 expect 1 + +check { OneParent_correctVersion => NoDirAliases } for 5 expect 0 diff --git a/samples/Alloy/marksweepgc.als b/samples/Alloy/marksweepgc.als new file mode 100644 index 00000000..b8081e3f --- /dev/null +++ b/samples/Alloy/marksweepgc.als @@ -0,0 +1,83 @@ +module examples/systems/marksweepgc + +/* + * Model of mark and sweep garbage collection. + */ + +// a node in the heap +sig Node {} + +sig HeapState { + left, right : Node -> lone Node, + marked : set Node, + freeList : lone Node +} + +pred clearMarks[hs, hs' : HeapState] { + // clear marked set + no hs'.marked + // left and right fields are unchanged + hs'.left = hs.left + hs'.right = hs.right +} + +/** + * simulate the recursion of the mark() function using transitive closure + */ +fun reachable[hs: HeapState, n: Node] : set Node { + n + n.^(hs.left + hs.right) +} + +pred mark[hs: HeapState, from : Node, hs': HeapState] { + hs'.marked = hs.reachable[from] + hs'.left = hs.left + hs'.right = hs.right +} + +/** + * complete hack to simulate behavior of code to set freeList + */ +pred setFreeList[hs, hs': HeapState] { + // especially hackish + hs'.freeList.*(hs'.left) in (Node - hs.marked) + all n: Node | + (n !in hs.marked) => { + no hs'.right[n] + hs'.left[n] in (hs'.freeList.*(hs'.left)) + n in hs'.freeList.*(hs'.left) + } else { + hs'.left[n] = hs.left[n] + hs'.right[n] = hs.right[n] + } + hs'.marked = hs.marked +} + +pred GC[hs: HeapState, root : Node, hs': HeapState] { + some hs1, hs2: HeapState | + hs.clearMarks[hs1] && hs1.mark[root, hs2] && hs2.setFreeList[hs'] +} + +assert Soundness1 { + all h, h' : HeapState, root : Node | + h.GC[root, h'] => + (all live : h.reachable[root] | { + h'.left[live] = h.left[live] + h'.right[live] = h.right[live] + }) +} + +assert Soundness2 { + all h, h' : HeapState, root : Node | + h.GC[root, h'] => + no h'.reachable[root] & h'.reachable[h'.freeList] +} + +assert Completeness { + all h, h' : HeapState, root : Node | + h.GC[root, h'] => + (Node - h'.reachable[root]) in h'.reachable[h'.freeList] +} + +check Soundness1 for 3 expect 0 +check Soundness2 for 3 expect 0 +check Completeness for 3 expect 0 diff --git a/samples/Alloy/views.als b/samples/Alloy/views.als new file mode 100644 index 00000000..3a5ab82b --- /dev/null +++ b/samples/Alloy/views.als @@ -0,0 +1,217 @@ +module examples/systems/views + +/* + * Model of views in object-oriented programming. + * + * Two object references, called the view and the backing, + * are related by a view mechanism when changes to the + * backing are automatically propagated to the view. Note + * that the state of a view need not be a projection of the + * state of the backing; the keySet method of Map, for + * example, produces two view relationships, and for the + * one in which the map is modified by changes to the key + * set, the value of the new map cannot be determined from + * the key set. Note that in the iterator view mechanism, + * the iterator is by this definition the backing object, + * since changes are propagated from iterator to collection + * and not vice versa. Oddly, a reference may be a view of + * more than one backing: there can be two iterators on the + * same collection, eg. A reference cannot be a view under + * more than one view type. + * + * A reference is made dirty when it is a backing for a view + * with which it is no longer related by the view invariant. + * This usually happens when a view is modified, either + * directly or via another backing. For example, changing a + * collection directly when it has an iterator invalidates + * it, as does changing the collection through one iterator + * when there are others. + * + * More work is needed if we want to model more closely the + * failure of an iterator when its collection is invalidated. + * + * As a terminological convention, when there are two + * complementary view relationships, we will give them types + * t and t'. For example, KeySetView propagates from map to + * set, and KeySetView' propagates from set to map. + * + * author: Daniel Jackson + */ + +open util/ordering[State] as so +open util/relation as rel + +sig Ref {} +sig Object {} + +-- t->b->v in views when v is view of type t of backing b +-- dirty contains refs that have been invalidated +sig State { + refs: set Ref, + obj: refs -> one Object, + views: ViewType -> refs -> refs, + dirty: set refs +-- , anyviews: Ref -> Ref -- for visualization + } +-- {anyviews = ViewType.views} + +sig Map extends Object { + keys: set Ref, + map: keys -> one Ref + }{all s: State | keys + Ref.map in s.refs} +sig MapRef extends Ref {} +fact {State.obj[MapRef] in Map} + +sig Iterator extends Object { + left, done: set Ref, + lastRef: lone done + }{all s: State | done + left + lastRef in s.refs} +sig IteratorRef extends Ref {} +fact {State.obj[IteratorRef] in Iterator} + +sig Set extends Object { + elts: set Ref + }{all s: State | elts in s.refs} +sig SetRef extends Ref {} +fact {State.obj[SetRef] in Set} + +abstract sig ViewType {} +one sig KeySetView, KeySetView', IteratorView extends ViewType {} +fact ViewTypes { + State.views[KeySetView] in MapRef -> SetRef + State.views[KeySetView'] in SetRef -> MapRef + State.views[IteratorView] in IteratorRef -> SetRef + all s: State | s.views[KeySetView] = ~(s.views[KeySetView']) + } + +/** + * mods is refs modified directly or by view mechanism + * doesn't handle possibility of modifying an object and its view at once? + * should we limit frame conds to non-dirty refs? + */ +pred modifies [pre, post: State, rs: set Ref] { + let vr = pre.views[ViewType], mods = rs.*vr { + all r: pre.refs - mods | pre.obj[r] = post.obj[r] + all b: mods, v: pre.refs, t: ViewType | + b->v in pre.views[t] => viewFrame [t, pre.obj[v], post.obj[v], post.obj[b]] + post.dirty = pre.dirty + + {b: pre.refs | some v: Ref, t: ViewType | + b->v in pre.views[t] && !viewFrame [t, pre.obj[v], post.obj[v], post.obj[b]] + } + } + } + +pred allocates [pre, post: State, rs: set Ref] { + no rs & pre.refs + post.refs = pre.refs + rs + } + +/** + * models frame condition that limits change to view object from v to v' when backing object changes to b' + */ +pred viewFrame [t: ViewType, v, v', b': Object] { + t in KeySetView => v'.elts = dom [b'.map] + t in KeySetView' => b'.elts = dom [v'.map] + t in KeySetView' => (b'.elts) <: (v.map) = (b'.elts) <: (v'.map) + t in IteratorView => v'.elts = b'.left + b'.done + } + +pred MapRef.keySet [pre, post: State, setRefs: SetRef] { + post.obj[setRefs].elts = dom [pre.obj[this].map] + modifies [pre, post, none] + allocates [pre, post, setRefs] + post.views = pre.views + KeySetView->this->setRefs + KeySetView'->setRefs->this + } + +pred MapRef.put [pre, post: State, k, v: Ref] { + post.obj[this].map = pre.obj[this].map ++ k->v + modifies [pre, post, this] + allocates [pre, post, none] + post.views = pre.views + } + +pred SetRef.iterator [pre, post: State, iterRef: IteratorRef] { + let i = post.obj[iterRef] { + i.left = pre.obj[this].elts + no i.done + i.lastRef + } + modifies [pre,post,none] + allocates [pre, post, iterRef] + post.views = pre.views + IteratorView->iterRef->this + } + +pred IteratorRef.remove [pre, post: State] { + let i = pre.obj[this], i' = post.obj[this] { + i'.left = i.left + i'.done = i.done - i.lastRef + no i'.lastRef + } + modifies [pre,post,this] + allocates [pre, post, none] + pre.views = post.views + } + +pred IteratorRef.next [pre, post: State, ref: Ref] { + let i = pre.obj[this], i' = post.obj[this] { + ref in i.left + i'.left = i.left - ref + i'.done = i.done + ref + i'.lastRef = ref + } + modifies [pre, post, this] + allocates [pre, post, none] + pre.views = post.views + } + +pred IteratorRef.hasNext [s: State] { + some s.obj[this].left + } + +assert zippishOK { + all + ks, vs: SetRef, + m: MapRef, + ki, vi: IteratorRef, + k, v: Ref | + let s0=so/first, + s1=so/next[s0], + s2=so/next[s1], + s3=so/next[s2], + s4=so/next[s3], + s5=so/next[s4], + s6=so/next[s5], + s7=so/next[s6] | + ({ + precondition [s0, ks, vs, m] + no s0.dirty + ks.iterator [s0, s1, ki] + vs.iterator [s1, s2, vi] + ki.hasNext [s2] + vi.hasNext [s2] + ki.this/next [s2, s3, k] + vi.this/next [s3, s4, v] + m.put [s4, s5, k, v] + ki.remove [s5, s6] + vi.remove [s6, s7] + } => no State.dirty) + } + +pred precondition [pre: State, ks, vs, m: Ref] { + // all these conditions and other errors discovered in scope of 6 but 8,3 + // in initial state, must have view invariants hold + (all t: ViewType, b, v: pre.refs | + b->v in pre.views[t] => viewFrame [t, pre.obj[v], pre.obj[v], pre.obj[b]]) + // sets are not aliases +-- ks != vs + // sets are not views of map +-- no (ks+vs)->m & ViewType.pre.views + // no iterator currently on either set +-- no Ref->(ks+vs) & ViewType.pre.views + } + +check zippishOK for 6 but 8 State, 3 ViewType expect 1 + +/** + * experiment with controlling heap size + */ +fact {all s: State | #s.obj < 5} diff --git a/samples/AspectJ/CacheAspect.aj b/samples/AspectJ/CacheAspect.aj new file mode 100644 index 00000000..bfab7bc4 --- /dev/null +++ b/samples/AspectJ/CacheAspect.aj @@ -0,0 +1,41 @@ +package com.blogspot.miguelinlas3.aspectj.cache; + +import java.util.Map; +import java.util.WeakHashMap; + +import org.aspectj.lang.JoinPoint; + +import com.blogspot.miguelinlas3.aspectj.cache.marker.Cachable; + +/** + * This simple aspect simulates the behaviour of a very simple cache + * + * @author migue + * + */ +public aspect CacheAspect { + + public pointcut cache(Cachable cachable): execution(@Cachable * * (..)) && @annotation(cachable); + + Object around(Cachable cachable): cache(cachable){ + + String evaluatedKey = this.evaluateKey(cachable.scriptKey(), thisJoinPoint); + + if(cache.containsKey(evaluatedKey)){ + System.out.println("Cache hit for key " + evaluatedKey); + return this.cache.get(evaluatedKey); + } + + System.out.println("Cache miss for key " + evaluatedKey); + Object value = proceed(cachable); + cache.put(evaluatedKey, value); + return value; + } + + protected String evaluateKey(String key, JoinPoint joinPoint) { + // TODO add some smart staff to allow simple scripting in @Cachable annotation + return key; + } + + protected Map cache = new WeakHashMap(); +} diff --git a/samples/AspectJ/OptimizeRecursionCache.aj b/samples/AspectJ/OptimizeRecursionCache.aj new file mode 100644 index 00000000..ed1e8695 --- /dev/null +++ b/samples/AspectJ/OptimizeRecursionCache.aj @@ -0,0 +1,50 @@ +package aspects.caching; + +import java.util.Map; + +/** + * Cache aspect for optimize recursive functions. + * + * @author Migueli + * @date 05/11/2013 + * @version 1.0 + * + */ +public abstract aspect OptimizeRecursionCache { + + @SuppressWarnings("rawtypes") + private Map _cache; + + public OptimizeRecursionCache() { + _cache = getCache(); + } + + @SuppressWarnings("rawtypes") + abstract public Map getCache(); + + abstract public pointcut operation(Object o); + + pointcut topLevelOperation(Object o): operation(o) && !cflowbelow(operation(Object)); + + before(Object o) : topLevelOperation(o) { + System.out.println("Seeking value for " + o); + } + + Object around(Object o) : operation(o) { + Object cachedValue = _cache.get(o); + if (cachedValue != null) { + System.out.println("Found cached value for " + o + ": " + cachedValue); + return cachedValue; + } + return proceed(o); + } + + @SuppressWarnings("unchecked") + after(Object o) returning(Object result) : topLevelOperation(o) { + _cache.put(o, result); + } + + after(Object o) returning(Object result) : topLevelOperation(o) { + System.out.println("cache size: " + _cache.size()); + } +} diff --git a/samples/Assembly/ASSEMBLE.inc b/samples/Assembly/ASSEMBLE.inc new file mode 100644 index 00000000..c4ffdae3 --- /dev/null +++ b/samples/Assembly/ASSEMBLE.inc @@ -0,0 +1,2048 @@ + +; flat assembler core +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +assembler: + xor eax,eax + mov [stub_size],eax + mov [current_pass],ax + mov [resolver_flags],eax + mov [number_of_sections],eax + mov [actual_fixups_size],eax + assembler_loop: + mov eax,[labels_list] + mov [tagged_blocks],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [structures_buffer],eax + mov esi,[source_start] + mov edi,[code_start] + xor eax,eax + mov dword [adjustment],eax + mov dword [adjustment+4],eax + mov [addressing_space],eax + mov [error_line],eax + mov [counter],eax + mov [format_flags],eax + mov [number_of_relocations],eax + mov [undefined_data_end],eax + mov [file_extension],eax + mov [next_pass_needed],al + mov [output_format],al + mov [adjustment_sign],al + mov [code_type],16 + call init_addressing_space + pass_loop: + call assemble_line + jnc pass_loop + mov eax,[additional_memory_end] + cmp eax,[structures_buffer] + je pass_done + sub eax,18h + mov eax,[eax+4] + mov [current_line],eax + jmp missing_end_directive + pass_done: + call close_pass + mov eax,[labels_list] + check_symbols: + cmp eax,[memory_end] + jae symbols_checked + test byte [eax+8],8 + jz symbol_defined_ok + mov cx,[current_pass] + cmp cx,[eax+18] + jne symbol_defined_ok + test byte [eax+8],1 + jz symbol_defined_ok + sub cx,[eax+16] + cmp cx,1 + jne symbol_defined_ok + and byte [eax+8],not 1 + or [next_pass_needed],-1 + symbol_defined_ok: + test byte [eax+8],10h + jz use_prediction_ok + mov cx,[current_pass] + and byte [eax+8],not 10h + test byte [eax+8],20h + jnz check_use_prediction + cmp cx,[eax+18] + jne use_prediction_ok + test byte [eax+8],8 + jz use_prediction_ok + jmp use_misprediction + check_use_prediction: + test byte [eax+8],8 + jz use_misprediction + cmp cx,[eax+18] + je use_prediction_ok + use_misprediction: + or [next_pass_needed],-1 + use_prediction_ok: + test byte [eax+8],40h + jz check_next_symbol + and byte [eax+8],not 40h + test byte [eax+8],4 + jnz define_misprediction + mov cx,[current_pass] + test byte [eax+8],80h + jnz check_define_prediction + cmp cx,[eax+16] + jne check_next_symbol + test byte [eax+8],1 + jz check_next_symbol + jmp define_misprediction + check_define_prediction: + test byte [eax+8],1 + jz define_misprediction + cmp cx,[eax+16] + je check_next_symbol + define_misprediction: + or [next_pass_needed],-1 + check_next_symbol: + add eax,LABEL_STRUCTURE_SIZE + jmp check_symbols + symbols_checked: + cmp [next_pass_needed],0 + jne next_pass + mov eax,[error_line] + or eax,eax + jz assemble_ok + mov [current_line],eax + cmp [error],undefined_symbol + jne error_confirmed + mov eax,[error_info] + or eax,eax + jz error_confirmed + test byte [eax+8],1 + jnz next_pass + error_confirmed: + call error_handler + error_handler: + mov eax,[error] + sub eax,error_handler + add [esp],eax + ret + next_pass: + inc [current_pass] + mov ax,[current_pass] + cmp ax,[passes_limit] + je code_cannot_be_generated + jmp assembler_loop + assemble_ok: + ret + +create_addressing_space: + mov ebx,[addressing_space] + test ebx,ebx + jz init_addressing_space + test byte [ebx+0Ah],1 + jnz illegal_instruction + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + init_addressing_space: + mov ebx,[tagged_blocks] + mov dword [ebx-4],10h + mov dword [ebx-8],20h + sub ebx,8+20h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [addressing_space],ebx + xor eax,eax + mov [ebx],edi + mov [ebx+4],eax + mov [ebx+8],eax + mov [ebx+10h],eax + mov [ebx+14h],eax + mov [ebx+18h],edi + mov [ebx+1Ch],eax + ret + +assemble_line: + mov eax,[tagged_blocks] + sub eax,100h + cmp edi,eax + ja out_of_memory + lods byte [esi] + cmp al,1 + je assemble_instruction + jb source_end + cmp al,3 + jb define_label + je define_constant + cmp al,4 + je label_addressing_space + cmp al,0Fh + je new_line + cmp al,13h + je code_type_setting + cmp al,10h + jne illegal_instruction + lods byte [esi] + jmp segment_prefix + code_type_setting: + lods byte [esi] + mov [code_type],al + jmp instruction_assembled + new_line: + lods dword [esi] + mov [current_line],eax + mov [prefixed_instruction],0 + cmp [symbols_file],0 + je continue_line + cmp [next_pass_needed],0 + jne continue_line + mov ebx,[tagged_blocks] + mov dword [ebx-4],1 + mov dword [ebx-8],14h + sub ebx,8+14h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [ebx],eax + mov [ebx+4],edi + mov eax,[addressing_space] + mov [ebx+8],eax + mov al,[code_type] + mov [ebx+10h],al + continue_line: + cmp byte [esi],0Fh + je line_assembled + jmp assemble_line + define_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov ebx,eax + lods byte [esi] + mov [label_size],al + call make_label + jmp continue_line + make_label: + mov eax,edi + xor edx,edx + xor cl,cl + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + jp label_value_ok + call recoverable_overflow + label_value_ok: + mov [address_sign],cl + test byte [ds:ebp+0Ah],1 + jnz make_virtual_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + mov ch,[ebx+9] + shr ch,1 + and ch,1 + neg ch + sub eax,[ebx] + sbb edx,[ebx+4] + sbb ch,cl + mov dword [adjustment],eax + mov dword [adjustment+4],edx + mov [adjustment_sign],ch + or al,ch + or eax,edx + setnz ah + jmp finish_label + make_virtual_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + finish_label: + mov ebp,[addressing_space] + mov ch,[ds:ebp+9] + mov cl,[label_size] + mov edx,[ds:ebp+14h] + mov ebp,[ds:ebp+10h] + finish_label_symbol: + mov al,[address_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + cmp ebp,[ebx+12] + mov [ebx+12],ebp + setne al + or ah,al + or ch,ch + jz label_symbol_ok + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_label + cmp cx,[ebx+16] + je symbol_already_defined + btr dword [ebx+8],10 + jc requalified_label + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz label_made + test byte [ebx+8],8 + jz label_made + mov cx,[current_pass] + cmp cx,[ebx+18] + jne label_made + requalified_label: + or [next_pass_needed],-1 + label_made: + ret + new_label: + or byte [ebx+8],1 + ret + define_constant: + lods dword [esi] + inc esi + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov edx,[eax+8] + push edx + cmp [current_pass],0 + je get_constant_value + test dl,4 + jnz get_constant_value + mov cx,[current_pass] + cmp cx,[eax+16] + je get_constant_value + or dl,4 + mov [eax+8],dl + get_constant_value: + push eax + mov al,byte [esi-1] + push eax + or [size_override],-1 + call get_value + pop ebx + mov ch,bl + pop ebx + pop ecx + test cl,4 + jnz constant_referencing_mode_ok + and byte [ebx+8],not 4 + constant_referencing_mode_ok: + xor cl,cl + mov ch,[value_type] + cmp ch,3 + je invalid_use_of_symbol + make_constant: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov al,[value_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + xor edx,edx + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz constant_symbol_ok + mov edx,[symbol_identifier] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + constant_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + test byte [ebx+8],1 + jz new_constant + cmp cx,[ebx+16] + jne redeclare_constant + test byte [ebx+8],2 + jz symbol_already_defined + or byte [ebx+8],4 + and byte [ebx+9],not 4 + jmp instruction_assembled + redeclare_constant: + btr dword [ebx+8],10 + jc requalified_constant + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],4 + jnz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + requalified_constant: + or [next_pass_needed],-1 + jmp instruction_assembled + new_constant: + or byte [ebx+8],1+2 + jmp instruction_assembled + label_addressing_space: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov cx,[current_pass] + test byte [eax+8],1 + jz make_addressing_space_label + cmp cx,[eax+16] + je symbol_already_defined + test byte [eax+9],4 + jnz make_addressing_space_label + or [next_pass_needed],-1 + make_addressing_space_label: + mov dx,[eax+8] + and dx,not (2 or 100h) + or dx,1 or 4 or 400h + mov [eax+8],dx + mov [eax+16],cx + mov edx,[current_line] + mov [eax+28],edx + mov ebx,[addressing_space] + mov [eax],ebx + or byte [ebx+0Ah],2 + jmp continue_line + assemble_instruction: +; mov [operand_size],0 +; mov [size_override],0 +; mov [operand_prefix],0 +; mov [opcode_prefix],0 + and dword [operand_size],0 +; mov [rex_prefix],0 +; mov [vex_required],0 +; mov [vex_register],0 +; mov [immediate_size],0 + and dword [rex_prefix],0 + call instruction_handler + instruction_handler: + movzx ebx,word [esi] + mov al,[esi+2] + add esi,3 + add [esp],ebx + ret + instruction_assembled: + mov al,[esi] + cmp al,0Fh + je line_assembled + or al,al + jnz extra_characters_on_line + line_assembled: + clc + ret + source_end: + dec esi + stc + ret + +org_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + mov cl,[value_type] + test cl,1 + jnz invalid_use_of_symbol + push eax + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],1 + jnz in_virtual + call init_addressing_space + jmp org_space_ok + in_virtual: + call close_virtual_addressing_space + call init_addressing_space + or byte [ebx+0Ah],1 + org_space_ok: + pop eax + mov [ebx+9],cl + mov cl,[value_sign] + sub [ebx],eax + sbb [ebx+4],edx + sbb byte [ebx+8],cl + jp org_value_ok + call recoverable_overflow + org_value_ok: + mov edx,[symbol_identifier] + mov [ebx+14h],edx + cmp [output_format],1 + ja instruction_assembled + cmp edi,[code_start] + jne instruction_assembled + cmp eax,100h + jne instruction_assembled + bts [format_flags],0 + jmp instruction_assembled +label_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov [label_size],0 + lods byte [esi] + cmp al,':' + je get_label_size + dec esi + cmp al,11h + jne label_size_ok + get_label_size: + lods word [esi] + cmp al,11h + jne invalid_argument + mov [label_size],ah + label_size_ok: + cmp byte [esi],80h + je get_free_label_value + call make_label + jmp instruction_assembled + get_free_label_value: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + push ebx ecx + or byte [ebx+8],4 + cmp byte [esi],'.' + je invalid_value + call get_address_value + or bh,bh + setnz ch + xchg ch,cl + mov bp,cx + shl ebp,16 + xchg bl,bh + mov bp,bx + pop ecx ebx + and byte [ebx+8],not 4 + mov ch,[value_type] + test ch,1 + jnz invalid_use_of_symbol + make_free_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov edx,[address_symbol] + mov cl,[label_size] + call finish_label_symbol + jmp instruction_assembled +load_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + push eax + mov al,1 + cmp byte [esi],11h + jne load_size_ok + lods byte [esi] + lods byte [esi] + load_size_ok: + cmp al,8 + ja invalid_value + mov [operand_size],al + and dword [value],0 + and dword [value+4],0 + lods byte [esi] + cmp al,82h + jne invalid_argument + call get_data_point + jc value_loaded + push esi edi + mov esi,ebx + mov edi,value + rep movs byte [edi],[esi] + pop edi esi + value_loaded: + mov [value_sign],0 + mov eax,dword [value] + mov edx,dword [value+4] + pop ebx + xor cx,cx + jmp make_constant + get_data_point: + mov ebx,[addressing_space] + mov ecx,edi + sub ecx,[ebx+18h] + mov [ebx+1Ch],ecx + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],11h + jne get_data_address + cmp word [esi+1+4],'):' + jne get_data_address + inc esi + lods dword [esi] + add esi,2 + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz addressing_space_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne addressing_space_unavailable + test byte [eax+9],4 + jz invalid_use_of_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + cmp [symbols_file],0 + je get_addressing_space + cmp [next_pass_needed],0 + jne get_addressing_space + call store_label_reference + get_addressing_space: + mov ebx,[ebx] + get_data_address: + push ebx + cmp byte [esi],'.' + je invalid_value + or [size_override],-1 + call get_address_value + pop ebp + call calculate_relative_offset + cmp [next_pass_needed],0 + jne data_address_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + data_address_type_ok: + mov ebx,edi + xor ecx,ecx + add ebx,eax + adc edx,ecx + mov eax,ebx + sub eax,[ds:ebp+18h] + sbb edx,ecx + jnz bad_data_address + mov cl,[operand_size] + add eax,ecx + cmp eax,[ds:ebp+1Ch] + ja bad_data_address + clc + ret + addressing_space_unavailable: + cmp [error_line],0 + jne get_data_address + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp get_data_address + bad_data_address: + call recoverable_overflow + stc + ret +store_directive: + cmp byte [esi],11h + je sized_store + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_byte_value + xor edx,edx + movzx eax,al + mov [operand_size],1 + jmp store_value_ok + sized_store: + or [size_override],-1 + call get_value + store_value_ok: + cmp [value_type],0 + jne invalid_use_of_symbol + mov dword [value],eax + mov dword [value+4],edx + lods byte [esi] + cmp al,80h + jne invalid_argument + call get_data_point + jc instruction_assembled + push esi edi + mov esi,value + mov edi,ebx + rep movs byte [edi],[esi] + mov eax,edi + pop edi esi + cmp ebx,[undefined_data_end] + jae instruction_assembled + cmp eax,[undefined_data_start] + jbe instruction_assembled + mov [undefined_data_start],eax + jmp instruction_assembled + +display_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],0 + jne display_byte + inc esi + lods dword [esi] + mov ecx,eax + push edi + mov edi,[tagged_blocks] + sub edi,8 + sub edi,eax + cmp edi,[esp] + jbe out_of_memory + mov [tagged_blocks],edi + rep movs byte [edi],[esi] + stos dword [edi] + xor eax,eax + stos dword [edi] + pop edi + inc esi + jmp display_next + display_byte: + call get_byte_value + push edi + mov edi,[tagged_blocks] + sub edi,8+1 + mov [tagged_blocks],edi + stos byte [edi] + mov eax,1 + stos dword [edi] + dec eax + stos dword [edi] + pop edi + display_next: + cmp edi,[tagged_blocks] + ja out_of_memory + lods byte [esi] + cmp al,',' + je display_directive + dec esi + jmp instruction_assembled +show_display_buffer: + mov eax,[tagged_blocks] + or eax,eax + jz display_done + mov esi,[labels_list] + cmp esi,eax + je display_done + display_messages: + sub esi,8 + mov eax,[esi+4] + mov ecx,[esi] + sub esi,ecx + test eax,eax + jnz skip_block + push esi + call display_block + pop esi + skip_block: + cmp esi,[tagged_blocks] + jne display_messages + display_done: + ret + +times_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_times + cmp byte [esi],':' + jne times_argument_ok + inc esi + times_argument_ok: + push [counter] + push [counter_limit] + mov [counter_limit],eax + mov [counter],1 + times_loop: + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + push esi + or [prefixed_instruction],-1 + call continue_line + mov eax,[counter_limit] + cmp [counter],eax + je times_done + inc [counter] + pop esi + jmp times_loop + times_done: + pop eax + pop [counter_limit] + pop [counter] + jmp instruction_assembled + zero_times: + call skip_symbol + jnc zero_times + jmp instruction_assembled + +virtual_directive: + lods byte [esi] + cmp al,80h + jne virtual_at_current + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_address_value + mov ebp,[address_symbol] + or bh,bh + setnz ch + jmp set_virtual + virtual_at_current: + dec esi + mov ebp,[addressing_space] + mov al,[ds:ebp+9] + mov [value_type],al + mov eax,edi + xor edx,edx + xor cl,cl + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + mov [address_sign],cl + mov bx,[ds:ebp+10h] + mov cx,[ds:ebp+10h+2] + xchg bh,bl + xchg ch,cl + mov ebp,[ds:ebp+14h] + set_virtual: + xchg bl,bh + xchg cl,ch + shl ecx,16 + mov cx,bx + push ecx eax + call allocate_structure_data + mov word [ebx],virtual_directive-instruction_handler + mov ecx,[addressing_space] + mov [ebx+12],ecx + mov [ebx+8],edi + mov ecx,[current_line] + mov [ebx+4],ecx + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + call init_addressing_space + or byte [ebx+0Ah],1 + pop eax + mov cl,[address_sign] + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + pop dword [ebx+10h] + mov [ebx+14h],ebp + mov al,[value_type] + test al,1 + jnz invalid_use_of_symbol + mov [ebx+9],al + jmp instruction_assembled + allocate_structure_data: + mov ebx,[structures_buffer] + sub ebx,18h + cmp ebx,[free_additional_memory] + jb out_of_memory + mov [structures_buffer],ebx + ret + find_structure_data: + mov ebx,[structures_buffer] + scan_structures: + cmp ebx,[additional_memory_end] + je no_such_structure + cmp ax,[ebx] + je structure_data_found + add ebx,18h + jmp scan_structures + structure_data_found: + ret + no_such_structure: + stc + ret + end_virtual: + call find_structure_data + jc unexpected_instruction + push ebx + call close_virtual_addressing_space + pop ebx + mov eax,[ebx+12] + mov [addressing_space],eax + mov edi,[ebx+8] + remove_structure_data: + push esi edi + mov ecx,ebx + sub ecx,[structures_buffer] + shr ecx,2 + lea esi,[ebx-4] + lea edi,[esi+18h] + std + rep movs dword [edi],[esi] + cld + add [structures_buffer],18h + pop edi esi + ret + close_virtual_addressing_space: + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],2 + jz addressing_space_closed + push esi edi ecx edx + mov ecx,eax + mov eax,[tagged_blocks] + mov dword [eax-4],11h + mov dword [eax-8],ecx + sub eax,8 + sub eax,ecx + mov [tagged_blocks],eax + lea edi,[eax+ecx-1] + xchg eax,[ebx+18h] + lea esi,[eax+ecx-1] + mov eax,edi + sub eax,esi + std + shr ecx,1 + jnc virtual_byte_ok + movs byte [edi],[esi] + virtual_byte_ok: + dec esi + dec edi + shr ecx,1 + jnc virtual_word_ok + movs word [edi],[esi] + virtual_word_ok: + sub esi,2 + sub edi,2 + rep movs dword [edi],[esi] + cld + xor edx,edx + add [ebx],eax + adc dword [ebx+4],edx + adc byte [ebx+8],dl + pop edx ecx edi esi + addressing_space_closed: + ret +repeat_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_repeat + call allocate_structure_data + mov word [ebx],repeat_directive-instruction_handler + xchg eax,[counter_limit] + mov [ebx+10h],eax + mov eax,1 + xchg eax,[counter] + mov [ebx+14h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + end_repeat: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[counter_limit] + inc [counter] + cmp [counter],eax + jbe continue_repeating + stop_repeat: + mov eax,[ebx+10h] + mov [counter_limit],eax + mov eax,[ebx+14h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + continue_repeating: + mov esi,[ebx+8] + jmp instruction_assembled + zero_repeat: + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_repeat + jmp instruction_assembled + find_end_repeat: + call find_structure_end + cmp ax,repeat_directive-instruction_handler + jne unexpected_instruction + ret +while_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call allocate_structure_data + mov word [ebx],while_directive-instruction_handler + mov eax,1 + xchg eax,[counter] + mov [ebx+10h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + do_while: + push ebx + call calculate_logical_expression + or al,al + jnz while_true + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + stop_while: + call find_end_while + pop ebx + mov eax,[ebx+10h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + while_true: + pop ebx + jmp instruction_assembled + end_while: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[ebx+4] + mov [current_line],eax + inc [counter] + jz too_many_repeats + mov esi,[ebx+8] + jmp do_while + find_end_while: + call find_structure_end + cmp ax,while_directive-instruction_handler + jne unexpected_instruction + ret +if_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call calculate_logical_expression + mov dl,al + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or dl,dl + jnz if_true + call find_else + jc instruction_assembled + mov al,[esi] + cmp al,1 + jne else_true + cmp word [esi+1],if_directive-instruction_handler + jne else_true + add esi,4 + jmp if_directive + if_true: + xor al,al + make_if_structure: + call allocate_structure_data + mov word [ebx],if_directive-instruction_handler + mov byte [ebx+2],al + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + else_true: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or al,-1 + jmp make_if_structure + else_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + mov ax,if_directive-instruction_handler + call find_structure_data + jc unexpected_instruction + cmp byte [ebx+2],0 + jne unexpected_instruction + found_else: + mov al,[esi] + cmp al,1 + jne skip_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_else + add esi,4 + call find_else + jnc found_else + call remove_structure_data + jmp instruction_assembled + skip_else: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_if + call remove_structure_data + jmp instruction_assembled + end_if: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + call remove_structure_data + jmp instruction_assembled + find_else: + call find_structure_end + cmp ax,else_directive-instruction_handler + je else_found + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + stc + ret + else_found: + clc + ret + find_end_if: + call find_structure_end + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + ret + find_structure_end: + push [error_line] + mov eax,[current_line] + mov [error_line],eax + find_end_directive: + call skip_symbol + jnc find_end_directive + lods byte [esi] + cmp al,0Fh + jne no_end_directive + lods dword [esi] + mov [current_line],eax + skip_labels: + cmp byte [esi],2 + jne labels_ok + add esi,6 + jmp skip_labels + labels_ok: + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + cmp ax,prefix_instruction-instruction_handler + je find_end_directive + add esi,4 + cmp ax,repeat_directive-instruction_handler + je skip_repeat + cmp ax,while_directive-instruction_handler + je skip_while + cmp ax,if_directive-instruction_handler + je skip_if + cmp ax,else_directive-instruction_handler + je structure_end + cmp ax,end_directive-instruction_handler + jne find_end_directive + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + add esi,4 + cmp ax,repeat_directive-instruction_handler + je structure_end + cmp ax,while_directive-instruction_handler + je structure_end + cmp ax,if_directive-instruction_handler + jne find_end_directive + structure_end: + pop [error_line] + ret + no_end_directive: + mov eax,[error_line] + mov [current_line],eax + jmp missing_end_directive + skip_repeat: + call find_end_repeat + jmp find_end_directive + skip_while: + call find_end_while + jmp find_end_directive + skip_if: + call skip_if_block + jmp find_end_directive + skip_if_block: + call find_else + jc if_block_skipped + cmp byte [esi],1 + jne skip_after_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_after_else + add esi,4 + jmp skip_if_block + skip_after_else: + call find_end_if + if_block_skipped: + ret +end_directive: + lods byte [esi] + cmp al,1 + jne invalid_argument + lods word [esi] + inc esi + cmp ax,virtual_directive-instruction_handler + je end_virtual + cmp ax,repeat_directive-instruction_handler + je end_repeat + cmp ax,while_directive-instruction_handler + je end_while + cmp ax,if_directive-instruction_handler + je end_if + cmp ax,data_directive-instruction_handler + je end_data + jmp invalid_argument +break_directive: + mov ebx,[structures_buffer] + mov al,[esi] + or al,al + jz find_breakable_structure + cmp al,0Fh + jne extra_characters_on_line + find_breakable_structure: + cmp ebx,[additional_memory_end] + je unexpected_instruction + mov ax,[ebx] + cmp ax,repeat_directive-instruction_handler + je break_repeat + cmp ax,while_directive-instruction_handler + je break_while + cmp ax,if_directive-instruction_handler + je break_if + add ebx,18h + jmp find_breakable_structure + break_if: + push [current_line] + mov eax,[ebx+4] + mov [current_line],eax + call remove_structure_data + call skip_if_block + pop [current_line] + mov ebx,[structures_buffer] + jmp find_breakable_structure + break_repeat: + push ebx + call find_end_repeat + pop ebx + jmp stop_repeat + break_while: + push ebx + jmp stop_while + +data_bytes: + call define_data + lods byte [esi] + cmp al,'(' + je get_byte + cmp al,'?' + jne invalid_argument + mov eax,edi + mov byte [edi],0 + inc edi + jmp undefined_data + get_byte: + cmp byte [esi],0 + je get_string + call get_byte_value + stos byte [edi] + ret + get_string: + inc esi + lods dword [esi] + mov ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + ja out_of_memory + rep movs byte [edi],[esi] + inc esi + ret + undefined_data: + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jz mark_undefined_data + ret + mark_undefined_data: + cmp eax,[undefined_data_end] + je undefined_data_ok + mov [undefined_data_start],eax + undefined_data_ok: + mov [undefined_data_end],edi + ret + define_data: + cmp edi,[tagged_blocks] + jae out_of_memory + cmp byte [esi],'(' + jne simple_data_value + mov ebx,esi + inc esi + call skip_expression + xchg esi,ebx + cmp byte [ebx],81h + jne simple_data_value + inc esi + call get_count_value + inc esi + or eax,eax + jz duplicate_zero_times + cmp byte [esi],'{' + jne duplicate_single_data_value + inc esi + duplicate_data: + push eax esi + duplicated_values: + cmp edi,[tagged_blocks] + jae out_of_memory + call near dword [esp+8] + lods byte [esi] + cmp al,',' + je duplicated_values + cmp al,'}' + jne invalid_argument + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_data + duplicate_single_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + push eax esi + call near dword [esp+8] + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_single_data_value + duplicate_zero_times: + cmp byte [esi],'{' + jne skip_single_data_value + inc esi + skip_data_value: + call skip_symbol + jc invalid_argument + cmp byte [esi],'}' + jne skip_data_value + inc esi + jmp data_defined + skip_single_data_value: + call skip_symbol + jmp data_defined + simple_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + call near dword [esp] + data_defined: + lods byte [esi] + cmp al,',' + je define_data + dec esi + add esp,4 + jmp instruction_assembled +data_unicode: + or [base_code],-1 + jmp define_words +data_words: + mov [base_code],0 + define_words: + call define_data + lods byte [esi] + cmp al,'(' + je get_word + cmp al,'?' + jne invalid_argument + mov eax,edi + and word [edi],0 + scas word [edi] + jmp undefined_data + ret + get_word: + cmp [base_code],0 + je word_data_value + cmp byte [esi],0 + je word_string + word_data_value: + call get_word_value + call mark_relocation + stos word [edi] + ret + word_string: + inc esi + lods dword [esi] + mov ecx,eax + jecxz word_string_ok + lea eax,[edi+ecx*2] + cmp eax,[tagged_blocks] + ja out_of_memory + xor ah,ah + copy_word_string: + lods byte [esi] + stos word [edi] + loop copy_word_string + word_string_ok: + inc esi + ret +data_dwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_dword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_dword: + push esi + call get_dword_value + pop ebx + cmp byte [esi],':' + je complex_dword + call mark_relocation + stos dword [edi] + ret + complex_dword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_word_value + call mark_relocation + stos word [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_pwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_pword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_pword: + push esi + call get_pword_value + pop ebx + cmp byte [esi],':' + je complex_pword + call mark_relocation + stos dword [edi] + mov ax,dx + stos word [edi] + ret + complex_pword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_dword_value + call mark_relocation + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_qwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_qword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_qword: + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + ret +data_twords: + call define_data + lods byte [esi] + cmp al,'(' + je get_tword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_tword: + cmp byte [esi],'.' + jne complex_tword + inc esi + cmp word [esi+8],8000h + je fp_zero_tword + mov eax,[esi] + stos dword [edi] + mov eax,[esi+4] + stos dword [edi] + mov ax,[esi+8] + add ax,3FFFh + jo value_out_of_range + cmp ax,7FFFh + jge value_out_of_range + cmp ax,0 + jg tword_exp_ok + mov cx,ax + neg cx + inc cx + cmp cx,64 + jae value_out_of_range + cmp cx,32 + ja large_shift + mov eax,[esi] + mov edx,[esi+4] + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + jmp tword_mantissa_shift_done + large_shift: + sub cx,32 + xor edx,edx + mov eax,[esi+4] + shr eax,cl + tword_mantissa_shift_done: + jnc store_shifted_mantissa + add eax,1 + adc edx,0 + store_shifted_mantissa: + mov [edi-8],eax + mov [edi-4],edx + xor ax,ax + test edx,1 shl 31 + jz tword_exp_ok + inc ax + tword_exp_ok: + mov bl,[esi+11] + shl bx,15 + or ax,bx + stos word [edi] + add esi,13 + ret + fp_zero_tword: + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,[esi+11] + shl ax,15 + stos word [edi] + add esi,13 + ret + complex_tword: + call get_word_value + push eax + cmp byte [esi],':' + jne invalid_operand + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_file: + lods word [esi] + cmp ax,'(' + jne invalid_argument + add esi,4 + call open_binary_file + mov eax,[esi-4] + lea esi,[esi+eax+1] + mov al,2 + xor edx,edx + call lseek + push eax + xor edx,edx + cmp byte [esi],':' + jne position_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + sub [esp],edx + jc value_out_of_range + position_ok: + cmp byte [esi],',' + jne size_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx edx + call get_count_value + pop edx ebx + cmp eax,[esp] + ja value_out_of_range + mov [esp],eax + size_ok: + xor al,al + call lseek + pop ecx + mov edx,edi + add edi,ecx + jc out_of_memory + cmp edi,[tagged_blocks] + ja out_of_memory + call read + jc error_reading_file + call close + lods byte [esi] + cmp al,',' + je data_file + dec esi + jmp instruction_assembled + open_binary_file: + push esi + push edi + mov eax,[current_line] + find_current_source_path: + mov esi,[eax] + test byte [eax+7],80h + jz get_current_path + mov eax,[eax+8] + jmp find_current_source_path + get_current_path: + lodsb + stosb + or al,al + jnz get_current_path + cut_current_path: + cmp edi,[esp] + je current_path_ok + cmp byte [edi-1],'\' + je current_path_ok + cmp byte [edi-1],'/' + je current_path_ok + dec edi + jmp cut_current_path + current_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc file_opened + mov edx,[include_paths] + search_in_include_paths: + push edx esi + mov edi,esi + mov esi,[esp+4] + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop edx + jnc file_opened + cmp byte [edx],0 + jne search_in_include_paths + mov edi,esi + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + file_opened: + mov edi,esi + pop esi + ret +reserve_bytes: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_bytes + add edi,ecx + jmp reserved_data + zero_bytes: + xor eax,eax + shr ecx,1 + jnc bytes_stosb_ok + stos byte [edi] + bytes_stosb_ok: + shr ecx,1 + jnc bytes_stosw_ok + stos word [edi] + bytes_stosw_ok: + rep stos dword [edi] + reserved_data: + pop eax + call undefined_data + jmp instruction_assembled +reserve_words: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data + zero_words: + xor eax,eax + shr ecx,1 + jnc words_stosw_ok + stos word [edi] + words_stosw_ok: + rep stos dword [edi] + jmp reserved_data +reserve_dwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data + zero_dwords: + xor eax,eax + rep stos dword [edi] + jmp reserved_data +reserve_pwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +reserve_qwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data +reserve_twords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,2 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +align_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,eax + dec edx + test eax,edx + jnz invalid_align_value + or eax,eax + jz invalid_align_value + cmp eax,1 + je instruction_assembled + mov ecx,edi + mov ebp,[addressing_space] + sub ecx,[ds:ebp] + cmp dword [ds:ebp+10h],0 + jne section_not_aligned_enough + cmp byte [ds:ebp+9],0 + je make_alignment + cmp [output_format],3 + je pe_alignment + mov ebx,[ds:ebp+14h] + cmp byte [ebx],0 + jne section_not_aligned_enough + cmp eax,[ebx+10h] + jbe make_alignment + jmp section_not_aligned_enough + pe_alignment: + cmp eax,1000h + ja section_not_aligned_enough + make_alignment: + dec eax + and ecx,eax + jz instruction_assembled + neg ecx + add ecx,eax + inc ecx + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je nops + add edi,ecx + jmp reserved_data + invalid_align_value: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + jmp instruction_assembled + nops: + mov eax,90909090h + shr ecx,1 + jnc nops_stosb_ok + stos byte [edi] + nops_stosb_ok: + shr ecx,1 + jnc nops_stosw_ok + stos word [edi] + nops_stosw_ok: + rep stos dword [edi] + jmp reserved_data +err_directive: + mov al,[esi] + cmp al,0Fh + je invoked_error + or al,al + jz invoked_error + jmp extra_characters_on_line +assert_directive: + call calculate_logical_expression + or al,al + jnz instruction_assembled + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],assertion_failed + jmp instruction_assembled diff --git a/samples/Assembly/FASM.asm b/samples/Assembly/FASM.asm new file mode 100644 index 00000000..9a2201ae --- /dev/null +++ b/samples/Assembly/FASM.asm @@ -0,0 +1,350 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + + format PE console + +section '.text' code readable executable + +start: + + mov [con_handle],STD_OUTPUT_HANDLE + mov esi,_logo + call display_string + + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + call [GetTickCount] + mov [start_time],eax + + call preprocessor + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + call [GetTickCount] + sub eax,[start_time] + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + call [GetCommandLine] + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + option_param: + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + memory_option: + lodsb + cmp al,20h + je memory_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp find_param + passes_option: + lodsb + cmp al,20h + je passes_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + jmp find_param + symbols_option: + mov [symbols_file],edi + find_symbols_file_name: + lodsb + cmp al,20h + jne process_param + jmp find_symbols_file_name + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + clc + ret + +include 'system.inc' + +include '..\errors.inc' +include '..\symbdump.inc' +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' +include '..\assemble.inc' +include '..\exprcalc.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +include '..\tables.inc' +include '..\messages.inc' + +section '.data' data readable writeable + +include '..\version.inc' + +_copyright db 'Copyright (c) 1999-2014, Tomasz Grysztar',0Dh,0Ah,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0Dh,0Ah + db 'usage: fasm [output]',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -m set the limit in kilobytes for the available memory',0Dh,0Ah + db ' -p set the maximum allowed number of passes',0Dh,0Ah + db ' -s dump symbolic information for debugging',0Dh,0Ah + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0Dh,0Ah,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0Dh,0Ah,0 + +align 4 + +include '..\variable.inc' + +con_handle dd ? +memory_setting dd ? +start_time dd ? +bytes_count dd ? +displayed_count dd ? +character db ? +last_displayed rb 2 + +params rb 1000h +options rb 1000h +buffer rb 4000h + +stack 10000h + +section '.idata' import data readable writeable + + dd 0,0,0,rva kernel_name,rva kernel_table + dd 0,0,0,0,0 + + kernel_table: + ExitProcess dd rva _ExitProcess + CreateFile dd rva _CreateFileA + ReadFile dd rva _ReadFile + WriteFile dd rva _WriteFile + CloseHandle dd rva _CloseHandle + SetFilePointer dd rva _SetFilePointer + GetCommandLine dd rva _GetCommandLineA + GetEnvironmentVariable dd rva _GetEnvironmentVariable + GetStdHandle dd rva _GetStdHandle + VirtualAlloc dd rva _VirtualAlloc + VirtualFree dd rva _VirtualFree + GetTickCount dd rva _GetTickCount + GetSystemTime dd rva _GetSystemTime + GlobalMemoryStatus dd rva _GlobalMemoryStatus + dd 0 + + kernel_name db 'KERNEL32.DLL',0 + + _ExitProcess dw 0 + db 'ExitProcess',0 + _CreateFileA dw 0 + db 'CreateFileA',0 + _ReadFile dw 0 + db 'ReadFile',0 + _WriteFile dw 0 + db 'WriteFile',0 + _CloseHandle dw 0 + db 'CloseHandle',0 + _SetFilePointer dw 0 + db 'SetFilePointer',0 + _GetCommandLineA dw 0 + db 'GetCommandLineA',0 + _GetEnvironmentVariable dw 0 + db 'GetEnvironmentVariableA',0 + _GetStdHandle dw 0 + db 'GetStdHandle',0 + _VirtualAlloc dw 0 + db 'VirtualAlloc',0 + _VirtualFree dw 0 + db 'VirtualFree',0 + _GetTickCount dw 0 + db 'GetTickCount',0 + _GetSystemTime dw 0 + db 'GetSystemTime',0 + _GlobalMemoryStatus dw 0 + db 'GlobalMemoryStatus',0 + +section '.reloc' fixups data readable discardable diff --git a/samples/Assembly/SYSTEM.inc b/samples/Assembly/SYSTEM.inc new file mode 100644 index 00000000..77a61d29 --- /dev/null +++ b/samples/Assembly/SYSTEM.inc @@ -0,0 +1,503 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +FILE_SHARE_READ = 1 +FILE_SHARE_WRITE = 2 +FILE_SHARE_DELETE = 4 + +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h + +STD_INPUT_HANDLE = 0FFFFFFF6h +STD_OUTPUT_HANDLE = 0FFFFFFF5h +STD_ERROR_HANDLE = 0FFFFFFF4h + +MEM_COMMIT = 1000h +MEM_RESERVE = 2000h +MEM_DECOMMIT = 4000h +MEM_RELEASE = 8000h +MEM_FREE = 10000h +MEM_PRIVATE = 20000h +MEM_MAPPED = 40000h +MEM_RESET = 80000h +MEM_TOP_DOWN = 100000h + +PAGE_NOACCESS = 1 +PAGE_READONLY = 2 +PAGE_READWRITE = 4 +PAGE_WRITECOPY = 8 +PAGE_EXECUTE = 10h +PAGE_EXECUTE_READ = 20h +PAGE_EXECUTE_READWRITE = 40h +PAGE_EXECUTE_WRITECOPY = 80h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +init_memory: + xor eax,eax + mov [memory_start],eax + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + mov eax,[memory_setting] + shl eax,10 + jnz allocate_memory + push buffer + call [GlobalMemoryStatus] + mov eax,dword [buffer+20] + mov edx,dword [buffer+12] + cmp eax,0 + jl large_memory + cmp edx,0 + jl large_memory + shr eax,2 + add eax,edx + jmp allocate_memory + large_memory: + mov eax,80000000h + allocate_memory: + mov edx,eax + shr edx,2 + mov ecx,eax + sub ecx,edx + mov [memory_end],ecx + mov [additional_memory_end],edx + push PAGE_READWRITE + push MEM_COMMIT + push eax + push 0 + call [VirtualAlloc] + or eax,eax + jz not_enough_memory + mov [memory_start],eax + add eax,[memory_end] + mov [memory_end],eax + mov [additional_memory],eax + add [additional_memory_end],eax + ret + not_enough_memory: + mov eax,[additional_memory_end] + shl eax,1 + cmp eax,4000h + jb out_of_memory + jmp allocate_memory + +exit_program: + movzx eax,al + push eax + mov eax,[memory_start] + test eax,eax + jz do_exit + push MEM_RELEASE + push 0 + push eax + call [VirtualFree] + do_exit: + call [ExitProcess] + +get_environment_variable: + mov ecx,[memory_end] + sub ecx,edi + cmp ecx,4000h + jbe buffer_for_variable_ok + mov ecx,4000h + buffer_for_variable_ok: + push ecx + push edi + push esi + call [GetEnvironmentVariable] + add edi,eax + cmp edi,[memory_end] + jae out_of_memory + ret + +open: + push 0 + push 0 + push OPEN_EXISTING + push 0 + push FILE_SHARE_READ + push GENERIC_READ + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret + file_error: + stc + ret +create: + push 0 + push 0 + push CREATE_ALWAYS + push 0 + push FILE_SHARE_READ + push GENERIC_WRITE + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret +write: + push 0 + push bytes_count + push ecx + push edx + push ebx + call [WriteFile] + or eax,eax + jz file_error + clc + ret +read: + mov ebp,ecx + push 0 + push bytes_count + push ecx + push edx + push ebx + call [ReadFile] + or eax,eax + jz file_error + cmp ebp,[bytes_count] + jne file_error + clc + ret +close: + push ebx + call [CloseHandle] + ret +lseek: + movzx eax,al + push eax + push 0 + push edx + push ebx + call [SetFilePointer] + ret + +display_string: + push [con_handle] + call [GetStdHandle] + mov ebp,eax + mov edi,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + push 0 + push bytes_count + push ecx + push esi + push ebp + call [WriteFile] + ret +display_character: + push ebx + mov [character],dl + push [con_handle] + call [GetStdHandle] + mov ebx,eax + push 0 + push bytes_count + push 1 + push character + push ebx + call [WriteFile] + pop ebx + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ecx + call display_character + pop ecx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],1 + jb line_break_ok + je make_line_break + mov ax,word [last_displayed] + cmp ax,0A0Dh + je line_break_ok + cmp ax,0D0Ah + je line_break_ok + make_line_break: + mov word [buffer],0A0Dh + push [con_handle] + call [GetStdHandle] + push 0 + push bytes_count + push 2 + push buffer + push eax + call [WriteFile] + line_break_ok: + ret +display_block: + add [displayed_count],ecx + cmp ecx,1 + ja take_last_two_characters + jb block_displayed + mov al,[last_displayed+1] + mov ah,[esi] + mov word [last_displayed],ax + jmp block_ok + take_last_two_characters: + mov ax,[esi+ecx-2] + mov word [last_displayed],ax + block_ok: + push ecx + push [con_handle] + call [GetStdHandle] + pop ecx + push 0 + push bytes_count + push ecx + push esi + push eax + call [WriteFile] + block_displayed: + ret + +fatal_error: + mov [con_handle],STD_ERROR_HANDLE + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],STD_ERROR_HANDLE + call display_user_messages + push dword 0 + mov ebx,[current_line] + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,cr_lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + push buffer + call [GetSystemTime] + movzx ecx,word [buffer] + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,word [buffer+2] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + jbe day_correction_ok + sub ebp,2 + movzx ecx,word [buffer] + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + movzx eax,word [buffer+6] + dec eax + add eax,ebp + mov ebx,24 + mul ebx + movzx ecx,word [buffer+8] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+10] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+12] + add eax,ecx + adc edx,0 + ret + +error_prefix db 'error: ',0 +error_suffix db '.' +cr_lf db 0Dh,0Ah,0 +line_number_start db ' [',0 +line_data_start db ':',0Dh,0Ah,0 diff --git a/samples/Assembly/X86_64.inc b/samples/Assembly/X86_64.inc new file mode 100644 index 00000000..28413065 --- /dev/null +++ b/samples/Assembly/X86_64.inc @@ -0,0 +1,7060 @@ + +; flat assembler core +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +simple_instruction_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction: + stos byte [edi] + jmp instruction_assembled +simple_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp simple_instruction +simple_instruction_16bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_16bit: + cmp [code_type],16 + jne size_prefix + stos byte [edi] + jmp instruction_assembled + size_prefix: + mov ah,al + mov al,66h + stos word [edi] + jmp instruction_assembled +simple_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_32bit: + cmp [code_type],16 + je size_prefix + stos byte [edi] + jmp instruction_assembled +iret_instruction: + cmp [code_type],64 + jne simple_instruction +simple_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov ah,al + mov al,48h + stos word [edi] + jmp instruction_assembled +simple_extended_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov byte [edi],48h + inc edi +simple_extended_instruction: + mov ah,al + mov al,0Fh + stos word [edi] + jmp instruction_assembled +prefix_instruction: + stos byte [edi] + or [prefixed_instruction],-1 + jmp continue_line +segment_prefix: + mov ah,al + shr ah,4 + cmp ah,6 + jne illegal_instruction + and al,1111b + mov [segment_register],al + call store_segment_prefix + or [prefixed_instruction],-1 + jmp continue_line +int_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + test eax,eax + jns int_imm_ok + call recoverable_overflow + int_imm_ok: + mov ah,al + mov al,0CDh + stos word [edi] + jmp instruction_assembled +aa_instruction: + cmp [code_type],64 + je illegal_instruction + push eax + mov bl,10 + cmp byte [esi],'(' + jne aa_store + inc esi + xor al,al + xchg al,[operand_size] + cmp al,1 + ja invalid_operand_size + call get_byte_value + mov bl,al + aa_store: + cmp [operand_size],0 + jne invalid_operand + pop eax + mov ah,bl + stos word [edi] + jmp instruction_assembled + +basic_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg + cmp al,'[' + jne invalid_operand + basic_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je basic_mem_imm + cmp al,10h + jne invalid_operand + basic_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je instruction_ready + call operand_autodetect + inc [base_code] + instruction_ready: + call store_instruction + jmp instruction_assembled + basic_mem_imm: + mov al,[operand_size] + cmp al,1 + jb basic_mem_imm_nosize + je basic_mem_imm_8bit + cmp al,2 + je basic_mem_imm_16bit + cmp al,4 + je basic_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_mem_imm_32bit_ok + basic_mem_imm_nosize: + call recoverable_unknown_size + basic_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + mov [base_code],80h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_16bit_store + cmp [size_declared],0 + jne basic_mem_imm_16bit_store + cmp word [value],80h + jb basic_mem_simm_8bit + cmp word [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_16bit_store: + mov [base_code],81h + call store_instruction_with_imm16 + jmp instruction_assembled + basic_mem_simm_8bit: + mov [base_code],83h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_32bit: + call operand_32bit + call get_dword_value + basic_mem_imm_32bit_ok: + mov dword [value],eax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_32bit_store + cmp [size_declared],0 + jne basic_mem_imm_32bit_store + cmp dword [value],80h + jb basic_mem_simm_8bit + cmp dword [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_32bit_store: + mov [base_code],81h + call store_instruction_with_imm32 + jmp instruction_assembled + get_simm32: + call get_qword_value + mov ecx,edx + cdq + cmp ecx,edx + jne value_out_of_range + cmp [value_type],4 + jne get_simm32_ok + mov [value_type],2 + get_simm32_ok: + ret + basic_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg_reg + cmp al,'(' + je basic_reg_imm + cmp al,'[' + jne invalid_operand + basic_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je basic_reg_mem_8bit + call operand_autodetect + add [base_code],3 + jmp instruction_ready + basic_reg_mem_8bit: + add [base_code],2 + jmp instruction_ready + basic_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je nomem_instruction_ready + call operand_autodetect + inc [base_code] + nomem_instruction_ready: + call store_nomem_instruction + jmp instruction_assembled + basic_reg_imm: + mov al,[operand_size] + cmp al,1 + je basic_reg_imm_8bit + cmp al,2 + je basic_reg_imm_16bit + cmp al,4 + je basic_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_reg_imm_32bit_ok + basic_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + or bl,bl + jz basic_al_imm + mov [base_code],80h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_al_imm: + mov al,[base_code] + add al,4 + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_16bit_store + cmp [size_declared],0 + jne basic_reg_imm_16bit_store + cmp dx,80h + jb basic_reg_simm_8bit + cmp dx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_16bit_store: + or bl,bl + jz basic_ax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_16bit: + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_simm_8bit: + mov [base_code],83h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_ax_imm: + add [base_code],5 + call store_instruction_code + jmp basic_store_imm_16bit + basic_reg_imm_32bit: + call operand_32bit + call get_dword_value + basic_reg_imm_32bit_ok: + mov edx,eax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_32bit_store + cmp [size_declared],0 + jne basic_reg_imm_32bit_store + cmp edx,80h + jb basic_reg_simm_8bit + cmp edx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_32bit_store: + or bl,bl + jz basic_eax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_eax_imm: + add [base_code],5 + call store_instruction_code + jmp basic_store_imm_32bit + recoverable_unknown_size: + cmp [error_line],0 + jne ignore_unknown_size + push [current_line] + pop [error_line] + mov [error],operand_size_not_specified + ignore_unknown_size: + ret +single_operand_instruction: + mov [base_code],0F6h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je single_reg + cmp al,'[' + jne invalid_operand + single_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je single_mem_8bit + jb single_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + single_mem_nosize: + call recoverable_unknown_size + single_mem_8bit: + jmp instruction_ready + single_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je single_reg_8bit + call operand_autodetect + inc [base_code] + single_reg_8bit: + jmp nomem_instruction_ready +mov_instruction: + mov [base_code],88h + lods byte [esi] + call get_size_operator + cmp al,10h + je mov_reg + cmp al,'[' + jne invalid_operand + mov_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je mov_mem_imm + cmp al,10h + jne invalid_operand + mov_mem_reg: + lods byte [esi] + cmp al,60h + jb mov_mem_general_reg + cmp al,70h + jb mov_mem_sreg + mov_mem_general_reg: + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + cmp ah,1 + je mov_mem_reg_8bit + mov al,ah + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_mem_ax + inc [base_code] + jmp instruction_ready + mov_mem_reg_8bit: + or al,bl + or al,bh + jnz instruction_ready + mov_mem_al: + test ch,22h + jnz mov_mem_address16_al + test ch,44h + jnz mov_mem_address32_al + test ch,88h + jnz mov_mem_address64_al + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_al + cmp [code_type],32 + je mov_mem_address32_al + cmp edx,10000h + jb mov_mem_address16_al + mov_mem_address32_al: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A2h + store_mov_address32: + call store_instruction_code + call store_address_32bit_value + jmp instruction_assembled + mov_mem_address16_al: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A2h + store_mov_address16: + cmp [code_type],64 + je invalid_address + call store_instruction_code + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + jmp instruction_assembled + mov_mem_address64_al: + call store_segment_prefix_if_necessary + mov [base_code],0A2h + store_mov_address64: + call store_instruction_code + call store_address_64bit_value + jmp instruction_assembled + mov_mem_ax: + test ch,22h + jnz mov_mem_address16_ax + test ch,44h + jnz mov_mem_address32_ax + test ch,88h + jnz mov_mem_address64_ax + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_ax + cmp [code_type],32 + je mov_mem_address32_ax + cmp edx,10000h + jb mov_mem_address16_ax + mov_mem_address32_ax: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A3h + jmp store_mov_address32 + mov_mem_address16_ax: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A3h + jmp store_mov_address16 + mov_mem_address64_ax: + call store_segment_prefix_if_necessary + mov [base_code],0A3h + jmp store_mov_address64 + mov_mem_sreg: + sub al,61h + mov [postbyte_register],al + pop ecx ebx edx + mov ah,[operand_size] + or ah,ah + jz mov_mem_sreg_store + cmp ah,2 + jne invalid_operand_size + mov_mem_sreg_store: + mov [base_code],8Ch + jmp instruction_ready + mov_mem_imm: + mov al,[operand_size] + cmp al,1 + jb mov_mem_imm_nosize + je mov_mem_imm_8bit + cmp al,2 + je mov_mem_imm_16bit + cmp al,4 + je mov_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp mov_mem_imm_32bit_store + mov_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0C6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + mov_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + mov_mem_imm_nosize: + call recoverable_unknown_size + mov_mem_imm_32bit: + call operand_32bit + call get_dword_value + mov_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + mov_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_sreg + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_reg_mem + cmp al,'(' + je mov_reg_imm + cmp al,10h + jne invalid_operand + mov_reg_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_reg_sreg + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je mov_reg_reg_8bit + call operand_autodetect + inc [base_code] + mov_reg_reg_8bit: + jmp nomem_instruction_ready + mov_reg_sreg: + mov bl,[postbyte_register] + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_reg_creg + cmp ah,7 + je mov_reg_dreg + ja mov_reg_treg + dec [postbyte_register] + cmp [operand_size],8 + je mov_reg_sreg64 + cmp [operand_size],4 + je mov_reg_sreg32 + cmp [operand_size],2 + jne invalid_operand_size + call operand_16bit + jmp mov_reg_sreg_store + mov_reg_sreg64: + call operand_64bit + jmp mov_reg_sreg_store + mov_reg_sreg32: + call operand_32bit + mov_reg_sreg_store: + mov [base_code],8Ch + jmp nomem_instruction_ready + mov_reg_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],24h + jmp mov_reg_xrx + mov_reg_dreg: + mov [extended_code],21h + jmp mov_reg_xrx + mov_reg_creg: + mov [extended_code],20h + mov_reg_xrx: + mov [base_code],0Fh + cmp [code_type],64 + je mov_reg_xrx_64bit + cmp [operand_size],4 + jne invalid_operand_size + cmp [postbyte_register],8 + jne mov_reg_xrx_store + cmp [extended_code],20h + jne mov_reg_xrx_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_reg_xrx_store: + jmp nomem_instruction_ready + mov_reg_xrx_64bit: + cmp [operand_size],8 + jne invalid_operand_size + jmp nomem_instruction_ready + mov_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je mov_reg_mem_8bit + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_ax_mem + add [base_code],3 + jmp instruction_ready + mov_reg_mem_8bit: + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_al_mem + add [base_code],2 + jmp instruction_ready + mov_al_mem: + test ch,22h + jnz mov_al_mem_address16 + test ch,44h + jnz mov_al_mem_address32 + test ch,88h + jnz mov_al_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_al_mem_address64 + cmp [code_type],32 + je mov_al_mem_address32 + cmp edx,10000h + jb mov_al_mem_address16 + mov_al_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A0h + jmp store_mov_address32 + mov_al_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A0h + jmp store_mov_address16 + mov_al_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A0h + jmp store_mov_address64 + mov_ax_mem: + test ch,22h + jnz mov_ax_mem_address16 + test ch,44h + jnz mov_ax_mem_address32 + test ch,88h + jnz mov_ax_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_ax_mem_address64 + cmp [code_type],32 + je mov_ax_mem_address32 + cmp edx,10000h + jb mov_ax_mem_address16 + mov_ax_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A1h + jmp store_mov_address32 + mov_ax_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A1h + jmp store_mov_address16 + mov_ax_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address64 + mov_reg_imm: + mov al,[operand_size] + cmp al,1 + je mov_reg_imm_8bit + cmp al,2 + je mov_reg_imm_16bit + cmp al,4 + je mov_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_reg_imm_64bit: + call operand_64bit + call get_qword_value + mov ecx,edx + cmp [size_declared],0 + jne mov_reg_imm_64bit_store + cmp [value_type],4 + jae mov_reg_imm_64bit_store + cdq + cmp ecx,edx + je mov_reg_64bit_imm_32bit + mov_reg_imm_64bit_store: + push eax ecx + mov al,0B8h + call store_mov_reg_imm_code + pop edx eax + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + mov_reg_imm_8bit: + call get_byte_value + mov dl,al + mov al,0B0h + call store_mov_reg_imm_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + mov_reg_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + mov al,0B8h + call store_mov_reg_imm_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + mov_reg_imm_32bit: + call operand_32bit + call get_dword_value + mov edx,eax + mov al,0B8h + call store_mov_reg_imm_code + mov_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + store_mov_reg_imm_code: + mov ah,[postbyte_register] + test ah,1000b + jz mov_reg_imm_prefix_ok + or [rex_prefix],41h + mov_reg_imm_prefix_ok: + and ah,111b + add al,ah + mov [base_code],al + call store_instruction_code + ret + mov_reg_64bit_imm_32bit: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0C7h + call store_nomem_instruction + jmp mov_store_imm_32bit + mov_sreg: + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_creg + cmp ah,7 + je mov_dreg + ja mov_treg + cmp al,2 + je illegal_instruction + dec [postbyte_register] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_sreg_mem + cmp al,10h + jne invalid_operand + mov_sreg_reg: + lods byte [esi] + call convert_register + or ah,ah + jz mov_sreg_reg_size_ok + cmp ah,2 + jne invalid_operand_size + mov bl,al + mov_sreg_reg_size_ok: + mov [base_code],8Eh + jmp nomem_instruction_ready + mov_sreg_mem: + call get_address + mov al,[operand_size] + or al,al + jz mov_sreg_mem_size_ok + cmp al,2 + jne invalid_operand_size + mov_sreg_mem_size_ok: + mov [base_code],8Eh + jmp instruction_ready + mov_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],26h + jmp mov_xrx + mov_dreg: + mov [extended_code],23h + jmp mov_xrx + mov_creg: + mov [extended_code],22h + mov_xrx: + mov [base_code],0Fh + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + cmp [code_type],64 + je mov_xrx_64bit + cmp ah,4 + jne invalid_operand_size + cmp [postbyte_register],8 + jne mov_xrx_store + cmp [extended_code],22h + jne mov_xrx_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_xrx_store: + jmp nomem_instruction_ready + mov_xrx_64bit: + cmp ah,8 + je mov_xrx_store + jmp invalid_operand_size +test_instruction: + mov [base_code],84h + lods byte [esi] + call get_size_operator + cmp al,10h + je test_reg + cmp al,'[' + jne invalid_operand + test_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je test_mem_imm + cmp al,10h + jne invalid_operand + test_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je test_mem_reg_8bit + call operand_autodetect + inc [base_code] + test_mem_reg_8bit: + jmp instruction_ready + test_mem_imm: + mov al,[operand_size] + cmp al,1 + jb test_mem_imm_nosize + je test_mem_imm_8bit + cmp al,2 + je test_mem_imm_16bit + cmp al,4 + je test_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + test_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_mem_imm_32bit_store + test_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0F6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + test_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + test_mem_imm_nosize: + call recoverable_unknown_size + test_mem_imm_32bit: + call operand_32bit + call get_dword_value + test_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + test_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,'(' + je test_reg_imm + cmp al,10h + jne invalid_operand + test_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je test_reg_reg_8bit + call operand_autodetect + inc [base_code] + test_reg_reg_8bit: + jmp nomem_instruction_ready + test_reg_imm: + mov al,[operand_size] + cmp al,1 + je test_reg_imm_8bit + cmp al,2 + je test_reg_imm_16bit + cmp al,4 + je test_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + test_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_reg_imm_32bit_store + test_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F6h + or bl,bl + jz test_al_imm + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_al_imm: + mov [base_code],0A8h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_ax_imm + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + test_ax_imm: + mov [base_code],0A9h + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + test_reg_imm_32bit: + call operand_32bit + call get_dword_value + test_reg_imm_32bit_store: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_eax_imm + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + test_eax_imm: + mov [base_code],0A9h + call store_instruction_code + mov eax,edx + stos dword [edi] + jmp instruction_assembled + test_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je test_reg_mem_8bit + call operand_autodetect + inc [base_code] + test_reg_mem_8bit: + jmp instruction_ready +xchg_instruction: + mov [base_code],86h + lods byte [esi] + call get_size_operator + cmp al,10h + je xchg_reg + cmp al,'[' + jne invalid_operand + xchg_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je test_mem_reg + jmp invalid_operand + xchg_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,10h + jne invalid_operand + xchg_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je xchg_reg_reg_8bit + call operand_autodetect + cmp [postbyte_register],0 + je xchg_ax_reg + or bl,bl + jnz xchg_reg_reg_store + mov bl,[postbyte_register] + xchg_ax_reg: + cmp [code_type],64 + jne xchg_ax_reg_ok + cmp ah,4 + jne xchg_ax_reg_ok + or bl,bl + jz xchg_reg_reg_store + xchg_ax_reg_ok: + test bl,1000b + jz xchg_ax_reg_store + or [rex_prefix],41h + and bl,111b + xchg_ax_reg_store: + add bl,90h + mov [base_code],bl + call store_instruction_code + jmp instruction_assembled + xchg_reg_reg_store: + inc [base_code] + xchg_reg_reg_8bit: + jmp nomem_instruction_ready +push_instruction: + mov [push_size],al + push_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je push_reg + cmp al,'(' + je push_imm + cmp al,'[' + jne invalid_operand + push_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je push_mem_16bit + cmp al,4 + je push_mem_32bit + cmp al,8 + je push_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je push_mem_16bit + cmp ah,4 + je push_mem_32bit + cmp ah,8 + je push_mem_64bit + call recoverable_unknown_size + jmp push_mem_store + push_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_mem_store + push_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_mem_store + push_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_mem_store: + mov [base_code],0FFh + mov [postbyte_register],110b + call store_instruction + jmp push_done + push_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz push_sreg + call convert_register + test al,1000b + jz push_reg_ok + or [rex_prefix],41h + and al,111b + push_reg_ok: + add al,50h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je push_reg_16bit + cmp al,4 + je push_reg_32bit + cmp al,8 + jne invalid_operand_size + push_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp push_reg_store + push_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_reg_store + push_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + push_reg_store: + call store_instruction_code + jmp push_done + push_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[push_size] + cmp dl,2 + je push_sreg16 + cmp dl,4 + je push_sreg32 + cmp dl,8 + je push_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je push_sreg16 + cmp dh,4 + je push_sreg32 + cmp dh,8 + je push_sreg64 + jmp push_sreg_store + push_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_sreg_store + push_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_sreg_store + push_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + jc invalid_operand + cmp al,4 + jae push_sreg_386 + shl al,3 + add al,6 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp push_reg_store + push_sreg_386: + sub al,4 + shl al,3 + add al,0A0h + mov [extended_code],al + mov [base_code],0Fh + jmp push_reg_store + push_imm: + mov al,[operand_size] + mov ah,[push_size] + or al,al + je push_imm_size_ok + or ah,ah + je push_imm_size_ok + cmp al,ah + jne invalid_operand_size + push_imm_size_ok: + cmp al,2 + je push_imm_16bit + cmp al,4 + je push_imm_32bit + cmp al,8 + je push_imm_64bit + cmp ah,2 + je push_imm_optimized_16bit + cmp ah,4 + je push_imm_optimized_32bit + cmp ah,8 + je push_imm_optimized_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je push_imm_optimized_16bit + cmp [code_type],32 + je push_imm_optimized_32bit + push_imm_optimized_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_16bit: + call get_word_value + mov dx,ax + call operand_16bit + cmp [value_type],0 + jne push_imm_16bit_store + cmp ax,-80h + jl push_imm_16bit_store + cmp ax,80h + jge push_imm_16bit_store + push_imm_8bit: + mov ah,al + mov [base_code],6Ah + call store_instruction_code + mov al,ah + stos byte [edi] + jmp push_done + push_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + push_imm_16bit_store: + mov [base_code],68h + call store_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp push_done + push_imm_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + jmp push_imm_32bit_store + push_imm_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + push_imm_32bit_store: + mov [base_code],68h + call store_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + push_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp push_next +pop_instruction: + mov [push_size],al + pop_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je pop_reg + cmp al,'[' + jne invalid_operand + pop_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je pop_mem_16bit + cmp al,4 + je pop_mem_32bit + cmp al,8 + je pop_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je pop_mem_16bit + cmp ah,4 + je pop_mem_32bit + cmp ah,8 + je pop_mem_64bit + call recoverable_unknown_size + jmp pop_mem_store + pop_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_mem_store + pop_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_mem_store + pop_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_mem_store: + mov [base_code],08Fh + mov [postbyte_register],0 + call store_instruction + jmp pop_done + pop_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz pop_sreg + call convert_register + test al,1000b + jz pop_reg_ok + or [rex_prefix],41h + and al,111b + pop_reg_ok: + add al,58h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je pop_reg_16bit + cmp al,4 + je pop_reg_32bit + cmp al,8 + je pop_reg_64bit + jmp invalid_operand_size + pop_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp pop_reg_store + pop_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_reg_store + pop_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + pop_reg_store: + call store_instruction_code + pop_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp pop_next + pop_sreg: + mov dl,[operand_size] + mov dh,[push_size] + cmp al,62h + je pop_cs + mov bl,al + cmp dl,2 + je pop_sreg16 + cmp dl,4 + je pop_sreg32 + cmp dl,8 + je pop_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_sreg16 + cmp dh,4 + je pop_sreg32 + cmp dh,8 + je pop_sreg64 + jmp pop_sreg_store + pop_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_sreg_store + pop_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_sreg_store + pop_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + jc invalid_operand + cmp al,4 + jae pop_sreg_386 + shl al,3 + add al,7 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp pop_reg_store + pop_cs: + cmp [code_type],16 + jne illegal_instruction + cmp dl,2 + je pop_cs_store + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_cs_store + or dh,dh + jnz illegal_instruction + pop_cs_store: + test dh,not 2 + jnz invalid_operand_size + mov al,0Fh + stos byte [edi] + jmp pop_done + pop_sreg_386: + sub al,4 + shl al,3 + add al,0A1h + mov [extended_code],al + mov [base_code],0Fh + jmp pop_reg_store +inc_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je inc_reg + cmp al,'[' + je inc_mem + jne invalid_operand + inc_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je inc_mem_8bit + jb inc_mem_nosize + call operand_autodetect + mov al,0FFh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_mem_nosize: + call recoverable_unknown_size + inc_mem_8bit: + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je inc_reg_8bit + call operand_autodetect + cmp [code_type],64 + je inc_reg_long_form + mov al,[postbyte_register] + shl al,3 + add al,bl + add al,40h + mov [base_code],al + call store_instruction_code + jmp instruction_assembled + inc_reg_long_form: + inc [base_code] + inc_reg_8bit: + jmp nomem_instruction_ready +set_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je set_reg + cmp al,'[' + jne invalid_operand + set_mem: + call get_address + cmp [operand_size],1 + ja invalid_operand_size + mov [postbyte_register],0 + jmp instruction_ready + set_reg: + lods byte [esi] + call convert_register + cmp ah,1 + jne invalid_operand_size + mov bl,al + mov [postbyte_register],0 + jmp nomem_instruction_ready +arpl_instruction: + cmp [code_type],64 + je illegal_instruction + mov [base_code],63h + lods byte [esi] + call get_size_operator + cmp al,10h + je arpl_reg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,2 + jne invalid_operand_size + jmp instruction_ready + arpl_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + jmp nomem_instruction_ready +bound_instruction: + cmp [code_type],64 + je illegal_instruction + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je bound_store + cmp al,4 + jne invalid_operand_size + bound_store: + call operand_autodetect + mov [base_code],62h + jmp instruction_ready +enter_instruction: + lods byte [esi] + call get_size_operator + cmp ah,2 + je enter_imm16_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm16_size_ok: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne enter_imm16_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + enter_imm16_ok: + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp ah,1 + je enter_imm8_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm8_size_ok: + cmp al,'(' + jne invalid_operand + call get_byte_value + cmp [next_pass_needed],0 + jne enter_imm8_ok + test eax,eax + js value_out_of_range + enter_imm8_ok: + mov dl,al + pop ebx + mov al,0C8h + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +ret_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp ret_instruction +ret_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +ret_instruction_32bit: + call operand_32bit + jmp ret_instruction +ret_instruction_16bit: + call operand_16bit + jmp ret_instruction +retf_instruction: + cmp [code_type],64 + jne ret_instruction +ret_instruction_64bit: + call operand_64bit +ret_instruction: + mov [base_code],al + lods byte [esi] + dec esi + or al,al + jz simple_ret + cmp al,0Fh + je simple_ret + lods byte [esi] + call get_size_operator + or ah,ah + jz ret_imm + cmp ah,2 + je ret_imm + jmp invalid_operand_size + ret_imm: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne ret_imm_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + ret_imm_ok: + cmp [size_declared],0 + jne ret_imm_store + or ax,ax + jz simple_ret + ret_imm_store: + mov dx,ax + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + simple_ret: + inc [base_code] + call store_instruction_code + jmp instruction_assembled +lea_instruction: + mov [base_code],8Dh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + mov [size_override],-1 + call get_address + pop eax + mov [operand_size],al + call operand_autodetect + jmp instruction_ready +ls_instruction: + or al,al + jz les_instruction + cmp al,3 + jz lds_instruction + add al,0B0h + mov [extended_code],al + mov [base_code],0Fh + jmp ls_code_ok + les_instruction: + mov [base_code],0C4h + jmp ls_short_code + lds_instruction: + mov [base_code],0C5h + ls_short_code: + cmp [code_type],64 + je illegal_instruction + ls_code_ok: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + add [operand_size],2 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ls_16bit + cmp al,6 + je ls_32bit + cmp al,10 + je ls_64bit + jmp invalid_operand_size + ls_16bit: + call operand_16bit + jmp instruction_ready + ls_32bit: + call operand_32bit + jmp instruction_ready + ls_64bit: + call operand_64bit + jmp instruction_ready +sh_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je sh_reg + cmp al,'[' + jne invalid_operand + sh_mem: + call get_address + push edx ebx ecx + mov al,[operand_size] + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_mem_imm + cmp al,10h + jne invalid_operand + sh_mem_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + cmp al,1 + je sh_mem_cl_8bit + jb sh_mem_cl_nosize + call operand_autodetect + mov [base_code],0D3h + jmp instruction_ready + sh_mem_cl_nosize: + call recoverable_unknown_size + sh_mem_cl_8bit: + mov [base_code],0D2h + jmp instruction_ready + sh_mem_imm: + mov al,[operand_size] + or al,al + jz sh_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + cmp al,1 + je sh_mem_imm_8bit + jb sh_mem_imm_nosize + call operand_autodetect + cmp byte [value],1 + je sh_mem_1 + mov [base_code],0C1h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1: + mov [base_code],0D1h + jmp instruction_ready + sh_mem_imm_nosize: + call recoverable_unknown_size + sh_mem_imm_8bit: + cmp byte [value],1 + je sh_mem_1_8bit + mov [base_code],0C0h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1_8bit: + mov [base_code],0D0h + jmp instruction_ready + sh_reg: + lods byte [esi] + call convert_register + mov bx,ax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_reg_imm + cmp al,10h + jne invalid_operand + sh_reg_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + mov al,bh + cmp al,1 + je sh_reg_cl_8bit + call operand_autodetect + mov [base_code],0D3h + jmp nomem_instruction_ready + sh_reg_cl_8bit: + mov [base_code],0D2h + jmp nomem_instruction_ready + sh_reg_imm: + mov al,[operand_size] + or al,al + jz sh_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_reg_imm_size_ok: + push ebx + call get_byte_value + mov dl,al + pop ebx + mov al,bh + cmp al,1 + je sh_reg_imm_8bit + call operand_autodetect + cmp dl,1 + je sh_reg_1 + mov [base_code],0C1h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1: + mov [base_code],0D1h + jmp nomem_instruction_ready + sh_reg_imm_8bit: + cmp dl,1 + je sh_reg_1_8bit + mov [base_code],0C0h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1_8bit: + mov [base_code],0D0h + jmp nomem_instruction_ready +shd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je shd_reg + cmp al,'[' + jne invalid_operand + shd_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + mov [operand_size],0 + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_mem_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + call operand_autodetect + inc [extended_code] + jmp instruction_ready + shd_mem_reg_imm: + mov al,[operand_size] + or al,al + jz shd_mem_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_mem_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + call operand_autodetect + call store_instruction_with_imm8 + jmp instruction_assembled + shd_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_reg_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop ebx eax + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready + shd_reg_reg_imm: + mov al,[operand_size] + or al,al + jz shd_reg_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_reg_reg_imm_size_ok: + call get_byte_value + mov dl,al + pop ebx eax + call operand_autodetect + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +movx_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movx_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov ah,[operand_size] + or ah,ah + jz movx_unknown_size + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_mem_store + cmp ah,2 + jne invalid_operand_size + inc [extended_code] + movx_mem_store: + call operand_autodetect + jmp instruction_ready + movx_unknown_size: + call recoverable_unknown_size + jmp movx_mem_store + movx_reg: + lods byte [esi] + call convert_register + pop ebx + xchg bl,al + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_reg_8bit + cmp ah,2 + je movx_reg_16bit + jmp invalid_operand_size + movx_reg_8bit: + call operand_autodetect + jmp nomem_instruction_ready + movx_reg_16bit: + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready +movsxd_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,8 + jne invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movsxd_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je movsxd_mem_store + cmp [operand_size],0 + jne invalid_operand_size + movsxd_mem_store: + call operand_64bit + jmp instruction_ready + movsxd_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call operand_64bit + jmp nomem_instruction_ready +bt_instruction: + mov [postbyte_register],al + shl al,3 + add al,83h + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je bt_reg + cmp al,'[' + jne invalid_operand + call get_address + push eax ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_mem_imm + cmp byte [esi],11h + jne bt_mem_reg + cmp byte [esi+2],'(' + je bt_mem_imm + bt_mem_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + call operand_autodetect + jmp instruction_ready + bt_mem_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + or al,al + jz bt_mem_imm_nosize + call operand_autodetect + bt_mem_imm_store: + pop ecx ebx edx + mov [extended_code],0BAh + call store_instruction_with_imm8 + jmp instruction_assembled + bt_mem_imm_nosize: + call recoverable_unknown_size + jmp bt_mem_imm_store + bt_reg: + lods byte [esi] + call convert_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_reg_imm + cmp byte [esi],11h + jne bt_reg_reg + cmp byte [esi+2],'(' + je bt_reg_imm + bt_reg_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + bt_reg_imm: + xor al,al + xchg al,[operand_size] + push eax ebx + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop ebx eax + call operand_autodetect + bt_reg_imm_store: + mov [extended_code],0BAh + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +bs_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc bs_reg_reg + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + bs_reg_reg: + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + get_reg_mem: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je get_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + clc + ret + get_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + stc + ret + +imul_instruction: + mov [base_code],0F6h + mov [postbyte_register],5 + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg + cmp al,'[' + jne invalid_operand + imul_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je imul_mem_8bit + jb imul_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + imul_mem_nosize: + call recoverable_unknown_size + imul_mem_8bit: + jmp instruction_ready + imul_reg: + lods byte [esi] + call convert_register + cmp byte [esi],',' + je imul_reg_ + mov bl,al + mov al,ah + cmp al,1 + je imul_reg_8bit + call operand_autodetect + inc [base_code] + imul_reg_8bit: + jmp nomem_instruction_ready + imul_reg_: + mov [postbyte_register],al + inc esi + cmp byte [esi],'(' + je imul_reg_imm + cmp byte [esi],11h + jne imul_reg_noimm + cmp byte [esi+2],'(' + je imul_reg_imm + imul_reg_noimm: + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg_reg + cmp al,'[' + jne invalid_operand + imul_reg_mem: + call get_address + push edx ebx ecx + cmp byte [esi],',' + je imul_reg_mem_imm + mov al,[operand_size] + call operand_autodetect + pop ecx ebx edx + mov [base_code],0Fh + mov [extended_code],0AFh + jmp instruction_ready + imul_reg_mem_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_mem_imm_16bit + cmp al,4 + je imul_reg_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_mem_imm_32bit_ok + imul_reg_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + cmp [value_type],0 + jne imul_reg_mem_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_16bit_store + cmp ax,-80h + jl imul_reg_mem_imm_16bit_store + cmp ax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_16bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm16 + jmp instruction_assembled + imul_reg_mem_imm_32bit: + call operand_32bit + call get_dword_value + imul_reg_mem_imm_32bit_ok: + mov dword [value],eax + cmp [value_type],0 + jne imul_reg_mem_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_32bit_store + cmp eax,-80h + jl imul_reg_mem_imm_32bit_store + cmp eax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_32bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm32 + jmp instruction_assembled + imul_reg_mem_imm_8bit_store: + pop ecx ebx edx + mov [base_code],6Bh + call store_instruction_with_imm8 + jmp instruction_assembled + imul_reg_imm: + mov bl,[postbyte_register] + dec esi + jmp imul_reg_reg_imm + imul_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp byte [esi],',' + je imul_reg_reg_imm + mov al,ah + call operand_autodetect + mov [base_code],0Fh + mov [extended_code],0AFh + jmp nomem_instruction_ready + imul_reg_reg_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_reg_imm_16bit + cmp al,4 + je imul_reg_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + push ebx + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_reg_imm_32bit_ok + imul_reg_reg_imm_16bit: + call operand_16bit + push ebx + call get_word_value + pop ebx + mov dx,ax + cmp [value_type],0 + jne imul_reg_reg_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_16bit_store + cmp ax,-80h + jl imul_reg_reg_imm_16bit_store + cmp ax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_16bit_store: + mov [base_code],69h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + imul_reg_reg_imm_32bit: + call operand_32bit + push ebx + call get_dword_value + imul_reg_reg_imm_32bit_ok: + pop ebx + mov edx,eax + cmp [value_type],0 + jne imul_reg_reg_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_32bit_store + cmp eax,-80h + jl imul_reg_reg_imm_32bit_store + cmp eax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_32bit_store: + mov [base_code],69h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + imul_reg_reg_imm_8bit_store: + mov [base_code],6Bh + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +in_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + push eax + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je in_imm + cmp al,10h + je in_reg + jmp invalid_operand + in_reg: + lods byte [esi] + cmp al,22h + jne invalid_operand + pop eax + cmp al,1 + je in_al_dx + cmp al,2 + je in_ax_dx + cmp al,4 + jne invalid_operand_size + in_ax_dx: + call operand_autodetect + mov [base_code],0EDh + call store_instruction_code + jmp instruction_assembled + in_al_dx: + mov al,0ECh + stos byte [edi] + jmp instruction_assembled + in_imm: + mov al,[operand_size] + or al,al + jz in_imm_size_ok + cmp al,1 + jne invalid_operand_size + in_imm_size_ok: + call get_byte_value + mov dl,al + pop eax + cmp al,1 + je in_al_imm + cmp al,2 + je in_ax_imm + cmp al,4 + jne invalid_operand_size + in_ax_imm: + call operand_autodetect + mov [base_code],0E5h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_al_imm: + mov al,0E4h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +out_instruction: + lods byte [esi] + call get_size_operator + cmp al,'(' + je out_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_dx_al + cmp al,2 + je out_dx_ax + cmp al,4 + jne invalid_operand_size + out_dx_ax: + call operand_autodetect + mov [base_code],0EFh + call store_instruction_code + jmp instruction_assembled + out_dx_al: + mov al,0EEh + stos byte [edi] + jmp instruction_assembled + out_imm: + mov al,[operand_size] + or al,al + jz out_imm_size_ok + cmp al,1 + jne invalid_operand_size + out_imm_size_ok: + call get_byte_value + mov dl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_imm_al + cmp al,2 + je out_imm_ax + cmp al,4 + jne invalid_operand_size + out_imm_ax: + call operand_autodetect + mov [base_code],0E7h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_al: + mov al,0E6h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + +call_instruction: + mov [postbyte_register],10b + mov [base_code],0E8h + mov [extended_code],9Ah + jmp process_jmp +jmp_instruction: + mov [postbyte_register],100b + mov [base_code],0E9h + mov [extended_code],0EAh + process_jmp: + lods byte [esi] + call get_jump_operator + call get_size_operator + cmp al,'(' + je jmp_imm + mov [base_code],0FFh + cmp al,10h + je jmp_reg + cmp al,'[' + jne invalid_operand + jmp_mem: + cmp [jump_type],1 + je illegal_instruction + call get_address + mov edx,eax + mov al,[operand_size] + or al,al + jz jmp_mem_size_not_specified + cmp al,2 + je jmp_mem_16bit + cmp al,4 + je jmp_mem_32bit + cmp al,6 + je jmp_mem_48bit + cmp al,8 + je jmp_mem_64bit + cmp al,10 + je jmp_mem_80bit + jmp invalid_operand_size + jmp_mem_size_not_specified: + cmp [jump_type],3 + je jmp_mem_far + cmp [jump_type],2 + je jmp_mem_near + call recoverable_unknown_size + jmp_mem_near: + cmp [code_type],16 + je jmp_mem_16bit + cmp [code_type],32 + je jmp_mem_near_32bit + jmp_mem_64bit: + cmp [jump_type],3 + je invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp instruction_ready + jmp_mem_far: + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_48bit: + call operand_32bit + jmp_mem_far_store: + cmp [jump_type],2 + je invalid_operand_size + inc [postbyte_register] + jmp instruction_ready + jmp_mem_80bit: + call operand_64bit + jmp jmp_mem_far_store + jmp_mem_far_32bit: + call operand_16bit + jmp jmp_mem_far_store + jmp_mem_32bit: + cmp [jump_type],3 + je jmp_mem_far_32bit + cmp [jump_type],2 + je jmp_mem_near_32bit + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_near_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp instruction_ready + jmp_mem_16bit: + cmp [jump_type],3 + je invalid_operand_size + call operand_16bit + jmp instruction_ready + jmp_reg: + test [jump_type],1 + jnz invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,2 + je jmp_reg_16bit + cmp al,4 + je jmp_reg_32bit + cmp al,8 + jne invalid_operand_size + jmp_reg_64bit: + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + jmp_reg_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp nomem_instruction_ready + jmp_reg_16bit: + call operand_16bit + jmp nomem_instruction_ready + jmp_imm: + cmp byte [esi],'.' + je invalid_value + mov ebx,esi + dec esi + call skip_symbol + xchg esi,ebx + cmp byte [ebx],':' + je jmp_far + cmp [jump_type],3 + je invalid_operand + jmp_near: + mov al,[operand_size] + cmp al,2 + je jmp_imm_16bit + cmp al,4 + je jmp_imm_32bit + cmp al,8 + je jmp_imm_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je jmp_imm_16bit + cmp [code_type],64 + je jmp_imm_64bit + jmp_imm_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne jmp_imm_32bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc jmp_short + jmp_imm_32bit_store: + mov edx,eax + sub edx,3 + jno jmp_imm_32bit_ok + cmp [code_type],64 + je relative_jump_out_of_range + jmp_imm_32bit_ok: + mov al,[base_code] + stos byte [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + jmp_imm_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + call check_for_short_jump + jnc jmp_imm_32bit_store + jmp_short: + mov ah,al + mov al,0EBh + stos word [edi] + jmp instruction_assembled + jmp_imm_16bit: + call get_address_word_value + cmp [code_type],16 + je jmp_imm_16bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc jmp_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + mov al,[base_code] + stos byte [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled + calculate_jump_offset: + add edi,2 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,2 + ret + check_for_short_jump: + cmp [jump_type],1 + je forced_short + ja no_short_jump + cmp [base_code],0E8h + je no_short_jump + cmp [value_type],0 + jne no_short_jump + cmp eax,80h + jb short_jump + cmp eax,-80h + jae short_jump + no_short_jump: + clc + ret + forced_short: + cmp [base_code],0E8h + je illegal_instruction + cmp [next_pass_needed],0 + jne jmp_short_value_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + jmp_short_value_type_ok: + cmp eax,-80h + jae short_jump + cmp eax,80h + jae jump_out_of_range + short_jump: + stc + ret + jump_out_of_range: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],relative_jump_out_of_range + jmp instruction_assembled + jmp_far: + cmp [jump_type],2 + je invalid_operand + cmp [code_type],64 + je illegal_instruction + mov al,[extended_code] + mov [base_code],al + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax [symbol_identifier] + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,4 + je jmp_far_16bit + cmp al,6 + je jmp_far_32bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + jne jmp_far_32bit + jmp_far_16bit: + call get_word_value + mov ebx,eax + call operand_16bit + call store_instruction_code + mov ax,bx + call mark_relocation + stos word [edi] + jmp_far_segment: + pop [symbol_identifier] eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + jmp instruction_assembled + jmp_far_32bit: + call get_dword_value + mov ebx,eax + call operand_32bit + call store_instruction_code + mov eax,ebx + call mark_relocation + stos dword [edi] + jmp jmp_far_segment +conditional_jump: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],3 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je conditional_jump_16bit + cmp al,4 + je conditional_jump_32bit + cmp al,8 + je conditional_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je conditional_jump_16bit + cmp [code_type],64 + je conditional_jump_64bit + conditional_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne conditional_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc conditional_jump_short + conditional_jump_32bit_store: + mov edx,eax + sub edx,4 + jno conditional_jump_32bit_range_ok + cmp [code_type],64 + je relative_jump_out_of_range + conditional_jump_32bit_range_ok: + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + conditional_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + call check_for_short_jump + jnc conditional_jump_32bit_store + conditional_jump_short: + mov ah,al + mov al,[base_code] + stos word [edi] + jmp instruction_assembled + conditional_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je conditional_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc conditional_jump_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + sub dx,2 + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled +loop_instruction_16bit: + cmp [code_type],64 + je illegal_instruction + cmp [code_type],16 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_32bit: + cmp [code_type],32 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction +loop_instruction: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],1 + ja invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je loop_jump_16bit + cmp al,4 + je loop_jump_32bit + cmp al,8 + je loop_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je loop_jump_16bit + cmp [code_type],64 + je loop_jump_64bit + loop_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne loop_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_32bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cdq + make_loop_jump: + call check_for_short_jump + jc conditional_jump_short + scas word [edi] + jmp jump_out_of_range + loop_counter_size: + cmp [operand_prefix],0 + je loop_counter_size_ok + push eax + mov al,[operand_prefix] + stos byte [edi] + pop eax + loop_counter_size_ok: + ret + loop_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call loop_counter_size + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + jmp make_loop_jump + loop_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je loop_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_16bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cwde + cdq + jmp make_loop_jump + +movs_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp [segment_register],1 + ja invalid_address + push ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop edx + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,6 + jne invalid_address + cmp dh,7 + jne invalid_address + cmp al,2 + je movs_address_16bit + cmp al,4 + je movs_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp movs_store + movs_address_32bit: + call address_32bit_prefix + jmp movs_store + movs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + movs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A4h + movs_check_size: + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jnz invalid_operand_size + call recoverable_unknown_size + jmp simple_instruction +lods_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je lods_address_16bit + cmp bh,46h + je lods_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp lods_store + lods_address_32bit: + call address_32bit_prefix + jmp lods_store + lods_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + lods_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0ACh + jmp movs_check_size +stos_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je stos_address_16bit + cmp bh,47h + je stos_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp stos_store + stos_address_32bit: + call address_32bit_prefix + jmp stos_store + stos_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + stos_store: + cmp [segment_register],1 + ja invalid_address + mov al,[base_code] + jmp movs_check_size +cmps_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,[segment_register] + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + pop edx eax + cmp [segment_register],1 + ja invalid_address + mov [segment_register],al + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,7 + jne invalid_address + cmp dh,6 + jne invalid_address + cmp al,2 + je cmps_address_16bit + cmp al,4 + je cmps_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp cmps_store + cmps_address_32bit: + call address_32bit_prefix + jmp cmps_store + cmps_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + cmps_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A6h + jmp movs_check_size +ins_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je ins_address_16bit + cmp bh,47h + je ins_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp ins_store + ins_address_32bit: + call address_32bit_prefix + jmp ins_store + ins_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + ins_store: + cmp [segment_register],1 + ja invalid_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + mov al,6Ch + ins_check_size: + cmp [operand_size],8 + jne movs_check_size + jmp invalid_operand_size +outs_instruction: + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je outs_address_16bit + cmp bh,46h + je outs_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp outs_store + outs_address_32bit: + call address_32bit_prefix + jmp outs_store + outs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + outs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,6Eh + jmp ins_check_size +xlat_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,23h + je xlat_address_16bit + cmp bh,43h + je xlat_address_32bit + cmp bh,83h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp xlat_store + xlat_address_32bit: + call address_32bit_prefix + jmp xlat_store + xlat_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + xlat_store: + call store_segment_prefix_if_necessary + mov al,0D7h + cmp [operand_size],1 + jbe simple_instruction + jmp invalid_operand_size + +pm_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pm_reg + pm_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je pm_mem_store + or al,al + jnz invalid_operand_size + pm_mem_store: + jmp instruction_ready + pm_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp ah,2 + jne invalid_operand_size + jmp nomem_instruction_ready +pm_store_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne pm_mem + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +lgdt_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,6 + je lgdt_mem_48bit + cmp al,10 + je lgdt_mem_80bit + or al,al + jnz invalid_operand_size + jmp lgdt_mem_store + lgdt_mem_80bit: + cmp [code_type],64 + jne illegal_instruction + jmp lgdt_mem_store + lgdt_mem_48bit: + cmp [code_type],64 + je illegal_instruction + cmp [postbyte_register],2 + jb lgdt_mem_store + call operand_32bit + lgdt_mem_store: + jmp instruction_ready +lar_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + call operand_autodetect + lods byte [esi] + call get_size_operator + cmp al,10h + je lar_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz lar_reg_mem + cmp al,2 + jne invalid_operand_size + lar_reg_mem: + jmp instruction_ready + lar_reg_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +invlpg_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +swapgs_instruction: + cmp [code_type],64 + jne illegal_instruction +rdtscp_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + mov bl,al + jmp nomem_instruction_ready + +basic_486_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_486_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je basic_486_mem_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_mem_reg_8bit: + jmp instruction_ready + basic_486_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je basic_486_reg_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_reg_reg_8bit: + jmp nomem_instruction_ready +bswap_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + test al,1000b + jz bswap_reg_code_ok + or [rex_prefix],41h + and al,111b + bswap_reg_code_ok: + add al,0C8h + mov [extended_code],al + mov [base_code],0Fh + cmp ah,8 + je bswap_reg64 + cmp ah,4 + jne invalid_operand_size + call operand_32bit + call store_instruction_code + jmp instruction_assembled + bswap_reg64: + call operand_64bit + call store_instruction_code + jmp instruction_assembled +cmpxchgx_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,1 + xchg [postbyte_register],ah + mov al,[operand_size] + or al,al + jz cmpxchgx_size_ok + cmp al,ah + jne invalid_operand_size + cmpxchgx_size_ok: + cmp ah,16 + jne cmpxchgx_store + call operand_64bit + cmpxchgx_store: + jmp instruction_ready +nop_instruction: + mov ah,[esi] + cmp ah,10h + je extended_nop + cmp ah,11h + je extended_nop + cmp ah,'[' + je extended_nop + stos byte [edi] + jmp instruction_assembled + extended_nop: + mov [base_code],0Fh + mov [extended_code],1Fh + mov [postbyte_register],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je extended_nop_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz extended_nop_store + call operand_autodetect + extended_nop_store: + jmp instruction_ready + extended_nop_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + +basic_fpu_instruction: + mov [postbyte_register],al + mov [base_code],0D8h + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_fpu_streg + cmp al,'[' + je basic_fpu_mem + dec esi + mov ah,[postbyte_register] + cmp ah,2 + jb invalid_operand + cmp ah,3 + ja invalid_operand + mov bl,1 + jmp nomem_instruction_ready + basic_fpu_mem: + call get_address + mov al,[operand_size] + cmp al,4 + je basic_fpu_mem_32bit + cmp al,8 + je basic_fpu_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + basic_fpu_mem_32bit: + jmp instruction_ready + basic_fpu_mem_64bit: + mov [base_code],0DCh + jmp instruction_ready + basic_fpu_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + mov ah,[postbyte_register] + cmp ah,2 + je basic_fpu_single_streg + cmp ah,3 + je basic_fpu_single_streg + or al,al + jz basic_fpu_st0 + test ah,110b + jz basic_fpu_streg_st0 + xor [postbyte_register],1 + basic_fpu_streg_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + mov [base_code],0DCh + jmp nomem_instruction_ready + basic_fpu_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov bl,al + basic_fpu_single_streg: + mov [base_code],0D8h + jmp nomem_instruction_ready +simple_fpu_instruction: + mov ah,al + or ah,11000000b + mov al,0D9h + stos word [edi] + jmp instruction_assembled +fi_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fi_mem_16bit + cmp al,4 + je fi_mem_32bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fi_mem_32bit: + mov [base_code],0DAh + jmp instruction_ready + fi_mem_16bit: + mov [base_code],0DEh + jmp instruction_ready +fld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je fld_streg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je fld_mem_32bit + cmp al,8 + je fld_mem_64bit + cmp al,10 + je fld_mem_80bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fld_mem_32bit: + mov [base_code],0D9h + jmp instruction_ready + fld_mem_64bit: + mov [base_code],0DDh + jmp instruction_ready + fld_mem_80bit: + mov al,[postbyte_register] + cmp al,0 + je fld_mem_80bit_store + dec [postbyte_register] + cmp al,3 + je fld_mem_80bit_store + jmp invalid_operand_size + fld_mem_80bit_store: + add [postbyte_register],5 + mov [base_code],0DBh + jmp instruction_ready + fld_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + cmp [postbyte_register],2 + jae fst_streg + mov [base_code],0D9h + jmp nomem_instruction_ready + fst_streg: + mov [base_code],0DDh + jmp nomem_instruction_ready +fild_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fild_mem_16bit + cmp al,4 + je fild_mem_32bit + cmp al,8 + je fild_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fild_mem_32bit: + mov [base_code],0DBh + jmp instruction_ready + fild_mem_16bit: + mov [base_code],0DFh + jmp instruction_ready + fild_mem_64bit: + mov al,[postbyte_register] + cmp al,1 + je fisttp_64bit_store + jb fild_mem_64bit_store + dec [postbyte_register] + cmp al,3 + je fild_mem_64bit_store + jmp invalid_operand_size + fild_mem_64bit_store: + add [postbyte_register],5 + mov [base_code],0DFh + jmp instruction_ready + fisttp_64bit_store: + mov [base_code],0DDh + jmp instruction_ready +fbld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fbld_mem_80bit + cmp al,10 + je fbld_mem_80bit + jmp invalid_operand_size + fbld_mem_80bit: + mov [base_code],0DFh + jmp instruction_ready +faddp_instruction: + mov [postbyte_register],al + mov [base_code],0DEh + mov edx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je faddp_streg + mov esi,edx + mov bl,1 + jmp nomem_instruction_ready + faddp_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + jmp nomem_instruction_ready +fcompp_instruction: + mov ax,0D9DEh + stos word [edi] + jmp instruction_assembled +fucompp_instruction: + mov ax,0E9DAh + stos word [edi] + jmp instruction_assembled +fxch_instruction: + mov dx,01D9h + jmp fpu_single_operand +ffreep_instruction: + mov dx,00DFh + jmp fpu_single_operand +ffree_instruction: + mov dl,0DDh + mov dh,al + fpu_single_operand: + mov ebx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je fpu_streg + or dh,dh + jz invalid_operand + mov esi,ebx + shl dh,3 + or dh,11000001b + mov ax,dx + stos word [edi] + jmp instruction_assembled + fpu_streg: + lods byte [esi] + call convert_fpu_register + shl dh,3 + or dh,al + or dh,11000000b + mov ax,dx + stos word [edi] + jmp instruction_assembled + +fstenv_instruction: + mov byte [edi],9Bh + inc edi +fldenv_instruction: + mov [base_code],0D9h + jmp fpu_mem +fstenv_instruction_16bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_16bit: + call operand_16bit + jmp fldenv_instruction +fstenv_instruction_32bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_32bit: + call operand_32bit + jmp fldenv_instruction +fsave_instruction_32bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_32bit: + call operand_32bit + jmp fnsave_instruction +fsave_instruction_16bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_16bit: + call operand_16bit + jmp fnsave_instruction +fsave_instruction: + mov byte [edi],9Bh + inc edi +fnsave_instruction: + mov [base_code],0DDh + fpu_mem: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + jne invalid_operand_size + jmp instruction_ready +fstcw_instruction: + mov byte [edi],9Bh + inc edi +fldcw_instruction: + mov [postbyte_register],al + mov [base_code],0D9h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fldcw_mem_16bit + cmp al,2 + je fldcw_mem_16bit + jmp invalid_operand_size + fldcw_mem_16bit: + jmp instruction_ready +fstsw_instruction: + mov al,9Bh + stos byte [edi] +fnstsw_instruction: + mov [base_code],0DDh + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,10h + je fstsw_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fstsw_mem_16bit + cmp al,2 + je fstsw_mem_16bit + jmp invalid_operand_size + fstsw_mem_16bit: + jmp instruction_ready + fstsw_reg: + lods byte [esi] + call convert_register + cmp ax,0200h + jne invalid_operand + mov ax,0E0DFh + stos word [edi] + jmp instruction_assembled +finit_instruction: + mov byte [edi],9Bh + inc edi +fninit_instruction: + mov ah,al + mov al,0DBh + stos word [edi] + jmp instruction_assembled +fcmov_instruction: + mov dh,0DAh + jmp fcomi_streg +fcomi_instruction: + mov dh,0DBh + jmp fcomi_streg +fcomip_instruction: + mov dh,0DFh + fcomi_streg: + mov dl,al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + cmp byte [esi],',' + je fcomi_st0_streg + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + fcomi_st0_streg: + or ah,ah + jnz invalid_operand + inc esi + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + +basic_mmx_instruction: + mov [base_code],0Fh + mov [extended_code],al + mmx_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'[' + jne invalid_operand + mmx_mmreg_mem: + call get_address + jmp instruction_ready + mmx_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +mmx_bit_shift_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'(' + je mmx_ps_mmreg_imm8 + cmp al,'[' + je mmx_mmreg_mem + jmp invalid_operand + mmx_ps_mmreg_imm8: + call get_byte_value + mov byte [value],al + test [operand_size],not 1 + jnz invalid_value + mov bl,[extended_code] + mov al,bl + shr bl,4 + and al,1111b + add al,70h + mov [extended_code],al + sub bl,0Ch + shl bl,1 + xchg bl,[postbyte_register] + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +pmovmskb_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call make_mmx_prefix + cmp [extended_code],0C5h + je mmx_nomem_imm8 + jmp nomem_instruction_ready + mmx_imm8: + push ebx ecx edx + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + mov [operand_size],cl + cmp al,'(' + jne invalid_operand + call get_byte_value + mov byte [value],al + pop edx ecx ebx + call store_instruction_with_imm8 + jmp instruction_assembled + mmx_nomem_imm8: + call store_nomem_instruction + call append_imm8 + jmp instruction_assembled + append_imm8: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + stosb + ret +pinsrw_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsrw_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + cmp [operand_size],2 + jne invalid_operand_size + jmp mmx_imm8 + pinsrw_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +pshufw_instruction: + mov [mmx_size],8 + mov [opcode_prefix],al + jmp pshuf_instruction +pshufd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],al + pshuf_instruction: + mov [base_code],0Fh + mov [extended_code],70h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pshuf_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + pshuf_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +movd_instruction: + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + jmp instruction_ready + movd_reg: + lods byte [esi] + cmp al,0B0h + jae movd_mmreg + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + jmp nomem_instruction_ready + movd_mmreg: + mov [extended_code],6Eh + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + jmp instruction_ready + movd_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + make_mmx_prefix: + cmp [vex_required],0 + jne mmx_prefix_for_vex + cmp [operand_size],16 + jne no_mmx_prefix + mov [operand_prefix],66h + no_mmx_prefix: + ret + mmx_prefix_for_vex: + cmp [operand_size],16 + jne invalid_operand + mov [opcode_prefix],66h + ret +movq_instruction: + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + cmp ah,16 + je movq_mem_xmmreg + mov [extended_code],7Fh + jmp instruction_ready + movq_mem_xmmreg: + mov [extended_code],0D6h + mov [opcode_prefix],66h + jmp instruction_ready + movq_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg + call convert_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + mov [extended_code],7Eh + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg: + call convert_mmx_register + mov [postbyte_register],al + mov [extended_code],6Fh + mov [mmx_size],ah + cmp ah,16 + jne movq_mmreg_ + mov [extended_code],7Eh + mov [opcode_prefix],0F3h + movq_mmreg_: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_mmreg_reg + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + jmp instruction_ready + movq_mmreg_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg_mmreg + mov [operand_size],0 + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [extended_code],6Eh + mov [opcode_prefix],0 + mov bl,al + cmp [mmx_size],16 + jne movq_mmreg_reg_store + mov [opcode_prefix],66h + movq_mmreg_reg_store: + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg_mmreg: + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +movdq_instruction: + mov [opcode_prefix],al + mov [base_code],0Fh + mov [extended_code],6Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [extended_code],7Fh + jmp instruction_ready + movdq_mmreg: + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + movdq_mmreg_mmreg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +lddqu_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [postbyte_register],al + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0F0h + jmp instruction_ready + +movdq2q_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movq2dq_ +movq2dq_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],16 + movq2dq_: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + xor [mmx_size],8+16 + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + mov [base_code],0Fh + mov [extended_code],0D6h + jmp nomem_instruction_ready + +sse_ps_instruction_imm8: + mov [immediate_size],1 +sse_ps_instruction: + mov [mmx_size],16 + jmp sse_instruction +sse_pd_instruction_imm8: + mov [immediate_size],1 +sse_pd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],66h + jmp sse_instruction +sse_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_instruction +sse_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + jmp sse_instruction +cmp_pd_instruction: + mov [opcode_prefix],66h +cmp_ps_instruction: + mov [mmx_size],16 + mov byte [value],al + mov al,0C2h + jmp sse_instruction +cmp_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp cmp_sx_instruction +cmpsd_instruction: + mov al,0A7h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov al,-1 +cmp_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + cmp_sx_instruction: + mov byte [value],al + mov al,0C2h + jmp sse_instruction +comiss_instruction: + mov [mmx_size],4 + jmp sse_instruction +comisd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],66h + jmp sse_instruction +cvtdq2pd_instruction: + mov [opcode_prefix],0F3h +cvtps2pd_instruction: + mov [mmx_size],8 + jmp sse_instruction +cvtpd2dq_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F2h + jmp sse_instruction +movshdup_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F3h +sse_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + sse_xmmreg: + lods byte [esi] + call convert_xmm_register + sse_reg: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg + sse_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je sse_mem_size_ok + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + sse_mem_size_ok: + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_mem_ok + cmp ax,443Ah + je sse_cmp_mem_ok + cmp [immediate_size],1 + je mmx_imm8 + cmp [immediate_size],-1 + jne sse_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_ok: + jmp instruction_ready + sse_cmp_mem_ok: + cmp byte [value],-1 + je mmx_imm8 + call store_instruction_with_imm8 + jmp instruction_assembled + sse_xmmreg_xmmreg: + cmp [operand_prefix],66h + jne sse_xmmreg_xmmreg_ok + cmp [extended_code],12h + je invalid_operand + cmp [extended_code],16h + je invalid_operand + sse_xmmreg_xmmreg_ok: + lods byte [esi] + call convert_xmm_register + mov bl,al + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_nomem_ok + cmp ax,443Ah + je sse_cmp_nomem_ok + cmp [immediate_size],1 + je mmx_nomem_imm8 + cmp [immediate_size],-1 + jne sse_nomem_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_nomem_ok: + jmp nomem_instruction_ready + sse_cmp_nomem_ok: + cmp byte [value],-1 + je mmx_nomem_imm8 + call store_nomem_instruction + mov al,byte [value] + stosb + jmp instruction_assembled + take_additional_xmm0: + cmp byte [esi],',' + jne additional_xmm0_ok + inc esi + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + test al,al + jnz invalid_operand + additional_xmm0_ok: + ret + +pslldq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp mmx_nomem_imm8 +movpd_instruction: + mov [opcode_prefix],66h +movps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],16 + jmp sse_mov_instruction +movss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_movs +movsd_instruction: + mov al,0A5h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [opcode_prefix],0F2h + sse_movs: + mov [base_code],0Fh + mov [extended_code],10h + jmp sse_mov_instruction +sse_mov_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg + sse_mem: + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address + cmp [operand_size],0 + je sse_mem_xmmreg + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + mov [operand_size],0 + sse_mem_xmmreg: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready +movlpd_instruction: + mov [opcode_prefix],66h +movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + lods byte [esi] + call get_size_operator + cmp al,10h + jne sse_mem + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + jmp sse_reg_mem +movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand +maskmovq_instruction: + mov cl,8 + jmp maskmov_instruction +maskmovdqu_instruction: + mov cl,16 + mov [opcode_prefix],66h + maskmov_instruction: + mov [base_code],0Fh + mov [extended_code],0F7h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,cl + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +movmskpd_instruction: + mov [opcode_prefix],66h +movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,4 + je movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand + +cvtpi2pd_instruction: + mov [opcode_prefix],66h +cvtpi2ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtpi_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtpi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + cvtpi_size_ok: + jmp instruction_ready + cvtpi_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +cvtsi2ss_instruction: + mov [opcode_prefix],0F3h + jmp cvtsi_instruction +cvtsi2sd_instruction: + mov [opcode_prefix],0F2h + cvtsi_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + cvtsi_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtsi_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtsi_size_ok + cmp [operand_size],4 + je cvtsi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + call operand_64bit + cvtsi_size_ok: + jmp instruction_ready + cvtsi_xmmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + je cvtsi_xmmreg_reg_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + cvtsi_xmmreg_reg_store: + mov bl,al + jmp nomem_instruction_ready +cvtps2pi_instruction: + mov [mmx_size],8 + jmp cvtpd_instruction +cvtpd2pi_instruction: + mov [opcode_prefix],66h + mov [mmx_size],16 + cvtpd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + jmp sse_reg +cvtss2si_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + jmp cvt2si_instruction +cvtsd2si_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + cvt2si_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [operand_size],0 + cmp ah,4 + je sse_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp sse_reg + +ssse3_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + jmp mmx_instruction +palignr_instruction: + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je palignr_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + palignr_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +amd3dnow_instruction: + mov [base_code],0Fh + mov [extended_code],0Fh + mov byte [value],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je amd3dnow_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction_with_imm8 + jmp instruction_assembled + amd3dnow_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + +sse4_instruction_38_xmm0: + mov [immediate_size],-1 +sse4_instruction_38: + mov [mmx_size],16 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp sse_instruction +sse4_ss_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],4 + jmp sse4_instruction_3a_setup +sse4_sd_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],8 + jmp sse4_instruction_3a_setup +sse4_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],16 + sse4_instruction_3a_setup: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp sse_instruction +pclmulqdq_instruction: + mov byte [value],al + mov [mmx_size],16 + mov al,44h + jmp sse4_instruction_3a_setup +extractps_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],17h + lods byte [esi] + call get_size_operator + cmp al,10h + je extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je extractps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + extractps_size_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + extractps_reg: + lods byte [esi] + call convert_register + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ebx + mov al,bh + cmp al,4 + je mmx_nomem_imm8 + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp mmx_nomem_imm8 +insertps_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + insertps_xmmreg: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],21h + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je insertps_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je insertps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + insertps_size_ok: + jmp mmx_imm8 + insertps_xmmreg_reg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +pextrq_instruction: + mov [mmx_size],8 + jmp pextr_instruction +pextrd_instruction: + mov [mmx_size],4 + jmp pextr_instruction +pextrw_instruction: + mov [mmx_size],2 + jmp pextr_instruction +pextrb_instruction: + mov [mmx_size],1 + pextr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pextr_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,[operand_size] + je pextr_size_ok + cmp [operand_size],0 + jne invalid_operand_size + pextr_size_ok: + cmp al,8 + jne pextr_prefix_ok + call operand_64bit + pextr_prefix_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + pextr_reg: + lods byte [esi] + call convert_register + cmp [mmx_size],4 + ja pextrq_reg + cmp ah,4 + je pextr_reg_size_ok + cmp [code_type],64 + jne pextr_invalid_size + cmp ah,8 + je pextr_reg_size_ok + pextr_invalid_size: + jmp invalid_operand_size + pextrq_reg: + cmp ah,8 + jne pextr_invalid_size + call operand_64bit + pextr_reg_size_ok: + mov [operand_size],0 + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov ebx,eax + pop eax + mov [postbyte_register],al + mov al,ah + cmp [mmx_size],2 + jne pextr_reg_store + mov [opcode_prefix],0 + mov [extended_code],0C5h + call make_mmx_prefix + jmp mmx_nomem_imm8 + pextr_reg_store: + cmp bh,16 + jne invalid_operand_size + xchg bl,[postbyte_register] + call operand_autodetect + jmp mmx_nomem_imm8 +pinsrb_instruction: + mov [mmx_size],1 + jmp pinsr_instruction +pinsrd_instruction: + mov [mmx_size],4 + jmp pinsr_instruction +pinsrq_instruction: + mov [mmx_size],8 + call operand_64bit + pinsr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pinsr_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsr_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + mov al,[mmx_size] + cmp al,[operand_size] + je mmx_imm8 + jmp invalid_operand_size + pinsr_xmmreg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp [mmx_size],8 + je pinsrq_xmmreg_reg + cmp ah,4 + je mmx_nomem_imm8 + jmp invalid_operand_size + pinsrq_xmmreg_reg: + cmp ah,8 + je mmx_nomem_imm8 + jmp invalid_operand_size +pmovsxbw_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxbd_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxbq_instruction: + mov [mmx_size],2 + jmp pmovsx_instruction +pmovsxwd_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxwq_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxdq_instruction: + mov [mmx_size],8 + pmovsx_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je pmovsx_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je instruction_ready + mov al,[mmx_size] + cmp al,[operand_size] + jne invalid_operand_size + jmp instruction_ready + pmovsx_xmmreg_reg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready + +fxsave_instruction_64bit: + call operand_64bit +fxsave_instruction: + mov [extended_code],0AEh + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + or ah,ah + jz fxsave_size_ok + mov al,[postbyte_register] + cmp al,111b + je clflush_size_check + cmp al,10b + jb invalid_operand_size + cmp al,11b + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + jmp fxsave_size_ok + clflush_size_check: + cmp ah,1 + jne invalid_operand_size + fxsave_size_ok: + jmp instruction_ready +prefetch_instruction: + mov [extended_code],18h + prefetch_mem_8bit: + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or ah,ah + jz prefetch_size_ok + cmp ah,1 + jne invalid_operand_size + prefetch_size_ok: + call get_address + jmp instruction_ready +amd_prefetch_instruction: + mov [extended_code],0Dh + jmp prefetch_mem_8bit +fence_instruction: + mov bl,al + mov ax,0AE0Fh + stos word [edi] + mov al,bl + stos byte [edi] + jmp instruction_assembled +pause_instruction: + mov ax,90F3h + stos word [edi] + jmp instruction_assembled +movntq_instruction: + mov [mmx_size],8 + jmp movnt_instruction +movntpd_instruction: + mov [opcode_prefix],66h +movntps_instruction: + mov [mmx_size],16 + movnt_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + jmp instruction_ready + +movntsd_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movnts_instruction +movntss_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + movnts_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,[mmx_size] + je movnts_size_ok + test al,al + jnz invalid_operand_size + movnts_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready + +movnti_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je movnti_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + movnti_store: + mov [postbyte_register],al + jmp instruction_ready +monitor_instruction: + mov [postbyte_register],al + cmp byte [esi],0 + je monitor_instruction_store + cmp byte [esi],0Fh + je monitor_instruction_store + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0400h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0401h + jne invalid_operand + cmp [postbyte_register],0C8h + jne monitor_instruction_store + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0402h + jne invalid_operand + monitor_instruction_store: + mov ax,010Fh + stos word [edi] + mov al,[postbyte_register] + stos byte [edi] + jmp instruction_assembled +movntdqa_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + +extrq_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je extrq_xmmreg_xmmreg + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + xor bl,bl + xchg bl,[postbyte_register] + call store_nomem_instruction + call get_byte_value + stosb + call append_imm8 + jmp instruction_assembled + extrq_xmmreg_xmmreg: + inc [extended_code] + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +insertq_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + cmp byte [esi],',' + je insertq_with_imm + inc [extended_code] + jmp nomem_instruction_ready + insertq_with_imm: + call store_nomem_instruction + call append_imm8 + call append_imm8 + jmp instruction_assembled + +crc32_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F0h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,8 + je crc32_reg64 + cmp ah,4 + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg32_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + test al,al + jz crc32_unknown_size + cmp al,1 + je crc32_reg32_mem_store + cmp al,4 + ja invalid_operand_size + inc [supplemental_code] + call operand_autodetect + crc32_reg32_mem_store: + jmp instruction_ready + crc32_unknown_size: + call recoverable_unknown_size + jmp crc32_reg32_mem_store + crc32_reg32_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je crc32_reg32_reg_store + cmp al,4 + ja invalid_operand_size + inc [supplemental_code] + call operand_autodetect + crc32_reg32_reg_store: + jmp nomem_instruction_ready + crc32_reg64: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call operand_64bit + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg64_reg + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + mov al,8 + test ah,ah + jz crc32_unknown_size + cmp ah,1 + je crc32_reg32_mem_store + cmp ah,al + jne invalid_operand_size + inc [supplemental_code] + jmp crc32_reg32_mem_store + crc32_reg64_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,8 + cmp ah,1 + je crc32_reg32_reg_store + cmp ah,al + jne invalid_operand_size + inc [supplemental_code] + jmp crc32_reg32_reg_store +popcnt_instruction: + mov [opcode_prefix],0F3h + jmp bs_instruction +movbe_instruction: + mov [supplemental_code],al + mov [extended_code],38h + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + je movbe_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + movbe_mem: + inc [supplemental_code] + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready +adx_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F6h + mov [operand_prefix],al + call get_reg_mem + jc adx_reg_reg + mov al,[operand_size] + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + adx_reg_reg: + cmp ah,4 + je nomem_instruction_ready + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp nomem_instruction_ready + +simple_vmx_instruction: + mov ah,al + mov al,0Fh + stos byte [edi] + mov al,1 + stos word [edi] + jmp instruction_assembled +vmclear_instruction: + mov [opcode_prefix],66h + jmp vmx_instruction +vmxon_instruction: + mov [opcode_prefix],0F3h +vmx_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,8 + jne invalid_operand_size + vmx_size_ok: + mov [base_code],0Fh + jmp instruction_ready +vmread_instruction: + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + je vmread_nomem + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + jmp vmx_size_ok + vmread_nomem: + lods byte [esi] + call convert_register + push eax + call vmread_check_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + pop ebx + mov [base_code],0Fh + jmp nomem_instruction_ready + vmread_check_size: + cmp [code_type],64 + je vmread_long + cmp [operand_size],4 + jne invalid_operand_size + ret + vmread_long: + cmp [operand_size],8 + jne invalid_operand_size + ret +vmwrite_instruction: + mov [extended_code],79h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je vmwrite_nomem + cmp al,'[' + jne invalid_operand + call get_address + call vmread_check_size + jmp vmx_size_ok + vmwrite_nomem: + lods byte [esi] + call convert_register + mov bl,al + mov [base_code],0Fh + jmp nomem_instruction_ready +vmx_inv_instruction: + mov [opcode_prefix],66h + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,16 + jne invalid_operand_size + jmp vmx_size_ok +simple_svm_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + simple_svm_detect_size: + cmp ah,2 + je simple_svm_16bit + cmp ah,4 + je simple_svm_32bit + cmp [code_type],64 + jne invalid_operand_size + jmp simple_svm_store + simple_svm_16bit: + cmp [code_type],16 + je simple_svm_store + cmp [code_type],64 + je invalid_operand_size + jmp prefixed_svm_store + simple_svm_32bit: + cmp [code_type],32 + je simple_svm_store + prefixed_svm_store: + mov al,67h + stos byte [edi] + simple_svm_store: + call store_instruction_code + pop eax + stos byte [edi] + jmp instruction_assembled +skinit_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0400h + jne invalid_operand + mov al,0DEh + jmp simple_vmx_instruction +invlpga_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov bl,ah + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0401h + jne invalid_operand + mov ah,bl + jmp simple_svm_detect_size + +rdrand_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +rdfsbase_instruction: + cmp [code_type],64 + jne illegal_instruction + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],0AEh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp ah,2 + je invalid_operand_size + call operand_autodetect + jmp nomem_instruction_ready + +xabort_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov dl,al + mov ax,0F8C6h + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +xbegin_instruction: + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[code_type] + cmp al,64 + je xbegin_64bit + cmp al,32 + je xbegin_32bit + xbegin_16bit: + call get_address_word_value + add edi,4 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,4 + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_32bit: + call get_address_dword_value + jmp xbegin_address_ok + xbegin_64bit: + call get_address_qword_value + xbegin_address_ok: + add edi,5 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,5 + mov edx,eax + cwde + cmp eax,edx + jne xbegin_rel32 + mov al,66h + stos byte [edi] + mov eax,edx + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_rel32: + sub edx,1 + jno xbegin_rel32_ok + cmp [code_type],64 + je relative_jump_out_of_range + xbegin_rel32_ok: + mov ax,0F8C7h + stos word [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + +convert_register: + mov ah,al + shr ah,4 + and al,0Fh + cmp ah,8 + je match_register_size + cmp ah,4 + ja invalid_operand + cmp ah,1 + ja match_register_size + cmp al,4 + jb match_register_size + or ah,ah + jz high_byte_register + or [rex_prefix],40h + match_register_size: + cmp ah,[operand_size] + je register_size_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + register_size_ok: + ret + high_byte_register: + mov ah,1 + or [rex_prefix],80h + jmp match_register_size +convert_fpu_register: + mov ah,al + shr ah,4 + and al,111b + cmp ah,10 + jne invalid_operand + jmp match_register_size +convert_mmx_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + ja invalid_operand + and al,111b + cmp ah,0Bh + jne invalid_operand + mov ah,8 + cmp [vex_required],0 + jne invalid_operand + jmp match_register_size + xmm_register: + and al,0Fh + mov ah,16 + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +convert_xmm_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + jmp invalid_operand +get_size_operator: + xor ah,ah + cmp al,11h + jne no_size_operator + mov [size_declared],1 + lods word [esi] + xchg al,ah + mov [size_override],1 + cmp ah,[operand_size] + je size_operator_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + size_operator_ok: + ret + no_size_operator: + mov [size_declared],0 + cmp al,'[' + jne size_operator_ok + mov [size_override],0 + ret +get_jump_operator: + mov [jump_type],0 + cmp al,12h + jne jump_operator_ok + lods word [esi] + mov [jump_type],al + mov al,ah + jump_operator_ok: + ret +get_address: + mov [segment_register],0 + mov [address_size],0 + mov [free_address_range],0 + mov al,[code_type] + shr al,3 + mov [value_size],al + mov al,[esi] + and al,11110000b + cmp al,60h + jne get_size_prefix + lods byte [esi] + sub al,60h + mov [segment_register],al + mov al,[esi] + and al,11110000b + get_size_prefix: + cmp al,70h + jne address_size_prefix_ok + lods byte [esi] + sub al,70h + cmp al,2 + jb invalid_address_size + cmp al,8 + ja invalid_address_size + mov [address_size],al + mov [value_size],al + address_size_prefix_ok: + call calculate_address + cmp byte [esi-1],']' + jne invalid_address + mov [address_high],edx + mov edx,eax + cmp [code_type],64 + jne address_ok + or bx,bx + jnz address_ok + test ch,0Fh + jnz address_ok + calculate_relative_address: + mov edx,[address_symbol] + mov [symbol_identifier],edx + mov edx,[address_high] + mov ebp,[addressing_space] + call calculate_relative_offset + mov [address_high],edx + cdq + cmp edx,[address_high] + je address_high_ok + call recoverable_overflow + address_high_ok: + mov edx,eax + ror ecx,16 + mov cl,[value_type] + rol ecx,16 + mov bx,0FF00h + address_ok: + ret +operand_16bit: + cmp [code_type],16 + je size_prefix_ok + mov [operand_prefix],66h + ret +operand_32bit: + cmp [code_type],16 + jne size_prefix_ok + mov [operand_prefix],66h + size_prefix_ok: + ret +operand_64bit: + cmp [code_type],64 + jne illegal_instruction + or [rex_prefix],48h + ret +operand_autodetect: + cmp al,2 + je operand_16bit + cmp al,4 + je operand_32bit + cmp al,8 + je operand_64bit + jmp invalid_operand_size +store_segment_prefix_if_necessary: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,4 + ja segment_prefix_386 + cmp [code_type],64 + je segment_prefix_ok + cmp al,3 + je ss_prefix + jb segment_prefix_86 + cmp bl,25h + je segment_prefix_86 + cmp bh,25h + je segment_prefix_86 + cmp bh,45h + je segment_prefix_86 + cmp bh,44h + je segment_prefix_86 + ret + ss_prefix: + cmp bl,25h + je segment_prefix_ok + cmp bh,25h + je segment_prefix_ok + cmp bh,45h + je segment_prefix_ok + cmp bh,44h + je segment_prefix_ok + jmp segment_prefix_86 +store_segment_prefix: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,5 + jae segment_prefix_386 + segment_prefix_86: + dec al + shl al,3 + add al,26h + stos byte [edi] + jmp segment_prefix_ok + segment_prefix_386: + add al,64h-5 + stos byte [edi] + segment_prefix_ok: + ret +store_instruction_code: + cmp [vex_required],0 + jne store_vex_instruction_code + mov al,[operand_prefix] + or al,al + jz operand_prefix_ok + stos byte [edi] + operand_prefix_ok: + mov al,[opcode_prefix] + or al,al + jz opcode_prefix_ok + stos byte [edi] + opcode_prefix_ok: + mov al,[rex_prefix] + test al,40h + jz rex_prefix_ok + cmp [code_type],64 + jne invalid_operand + test al,0B0h + jnz disallowed_combination_of_registers + stos byte [edi] + rex_prefix_ok: + mov al,[base_code] + stos byte [edi] + cmp al,0Fh + jne instruction_code_ok + store_extended_code: + mov al,[extended_code] + stos byte [edi] + cmp al,38h + je store_supplemental_code + cmp al,3Ah + je store_supplemental_code + instruction_code_ok: + ret + store_supplemental_code: + mov al,[supplemental_code] + stos byte [edi] + ret +store_nomem_instruction: + test [postbyte_register],1000b + jz nomem_reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + nomem_reg_code_ok: + test bl,1000b + jz nomem_rm_code_ok + or [rex_prefix],41h + and bl,111b + nomem_rm_code_ok: + call store_instruction_code + mov al,[postbyte_register] + shl al,3 + or al,bl + or al,11000000b + stos byte [edi] + ret +store_instruction: + mov [current_offset],edi + test [postbyte_register],1000b + jz reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + reg_code_ok: + cmp [code_type],64 + jne address_value_ok + xor eax,eax + bt edx,31 + sbb eax,[address_high] + jz address_value_ok + cmp [address_high],0 + jne address_value_out_of_range + test ch,44h + jnz address_value_ok + test bx,8080h + jz address_value_ok + address_value_out_of_range: + call recoverable_overflow + address_value_ok: + call store_segment_prefix_if_necessary + test [vex_required],4 + jnz address_vsib + or bx,bx + jz address_immediate + cmp bx,0F800h + je address_rip_based + cmp bx,0F400h + je address_eip_based + cmp bx,0FF00h + je address_relative + mov al,bl + or al,bh + and al,11110000b + cmp al,80h + je postbyte_64bit + cmp al,40h + je postbyte_32bit + cmp al,20h + jne invalid_address + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + call store_instruction_code + cmp bl,bh + jbe determine_16bit_address + xchg bl,bh + determine_16bit_address: + cmp bx,2600h + je address_si + cmp bx,2700h + je address_di + cmp bx,2300h + je address_bx + cmp bx,2500h + je address_bp + cmp bx,2625h + je address_bp_si + cmp bx,2725h + je address_bp_di + cmp bx,2723h + je address_bx_di + cmp bx,2623h + jne invalid_address + address_bx_si: + xor al,al + jmp postbyte_16bit + address_bx_di: + mov al,1 + jmp postbyte_16bit + address_bp_si: + mov al,10b + jmp postbyte_16bit + address_bp_di: + mov al,11b + jmp postbyte_16bit + address_si: + mov al,100b + jmp postbyte_16bit + address_di: + mov al,101b + jmp postbyte_16bit + address_bx: + mov al,111b + jmp postbyte_16bit + address_bp: + mov al,110b + postbyte_16bit: + test ch,22h + jnz address_16bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + or dx,dx + jz address + cmp dx,80h + jb address_8bit_value + cmp dx,-80h + jae address_8bit_value + address_16bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + ret + address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp dx,80h + jge value_out_of_range + cmp dx,-80h + jl value_out_of_range + ret + address: + cmp al,110b + je address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_vsib: + mov al,bl + shr al,4 + cmp al,0Ch + je vector_index_ok + cmp al,0Dh + jne invalid_address + vector_index_ok: + mov al,bh + shr al,4 + cmp al,4 + je postbyte_32bit + cmp [code_type],64 + je address_prefix_ok + test al,al + jnz invalid_address + postbyte_32bit: + call address_32bit_prefix + jmp address_prefix_ok + postbyte_64bit: + cmp [code_type],64 + jne invalid_address_size + address_prefix_ok: + cmp bl,44h + je invalid_address + cmp bl,84h + je invalid_address + test bh,1000b + jz base_code_ok + or [rex_prefix],41h + base_code_ok: + test bl,1000b + jz index_code_ok + or [rex_prefix],42h + index_code_ok: + call store_instruction_code + or cl,cl + jz only_base_register + base_and_index: + mov al,100b + xor ah,ah + cmp cl,1 + je scale_ok + cmp cl,2 + je scale_1 + cmp cl,4 + je scale_2 + or ah,11000000b + jmp scale_ok + scale_2: + or ah,10000000b + jmp scale_ok + scale_1: + or ah,01000000b + scale_ok: + or bh,bh + jz only_index_register + and bl,111b + shl bl,3 + or ah,bl + and bh,111b + or ah,bh + sib_ready: + test ch,44h + jnz sib_address_32bit_value + test ch,88h + jnz sib_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp bh,5 + je address_value + or edx,edx + jz sib_address + address_value: + cmp edx,80h + jb sib_address_8bit_value + cmp edx,-80h + jae sib_address_8bit_value + sib_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + sib_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + sib_address: + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + ret + only_index_register: + or ah,101b + and bl,111b + shl bl,3 + or ah,bl + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + test ch,44h + jnz store_address_32bit_value + test ch,88h + jnz store_address_32bit_value + or ch,ch + jnz invalid_address_size + jmp store_address_32bit_value + zero_index_register: + mov bl,4 + mov cl,1 + jmp base_and_index + only_base_register: + mov al,bh + and al,111b + cmp al,4 + je zero_index_register + test ch,44h + jnz simple_address_32bit_value + test ch,88h + jnz simple_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + or edx,edx + jz simple_address + cmp edx,80h + jb simple_address_8bit_value + cmp edx,-80h + jae simple_address_8bit_value + simple_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + jmp store_address_32bit_value + simple_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + simple_address: + cmp al,5 + je simple_address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_immediate: + cmp [code_type],64 + je address_immediate_sib + test ch,44h + jnz address_immediate_32bit + test ch,88h + jnz address_immediate_32bit + test ch,22h + jnz address_immediate_16bit + or ch,ch + jnz invalid_address_size + cmp [code_type],16 + je addressing_16bit + address_immediate_32bit: + call address_32bit_prefix + call store_instruction_code + store_immediate_address: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + store_address_32bit_value: + test ch,0F0h + jz address_32bit_relocation_ok + mov eax,ecx + shr eax,16 + cmp al,4 + jne address_32bit_relocation + mov al,2 + address_32bit_relocation: + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_32bit_relocation_ok: + mov eax,edx + stos dword [edi] + ret + store_address_64bit_value: + test ch,0F0h + jz address_64bit_relocation_ok + mov eax,ecx + shr eax,16 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_64bit_relocation_ok: + mov eax,edx + stos dword [edi] + mov eax,[address_high] + stos dword [edi] + ret + address_immediate_sib: + test ch,44h + jnz address_immediate_sib_32bit + test ch,not 88h + jnz invalid_address_size + address_immediate_sib_store: + call store_instruction_code + mov al,100b + mov ah,100101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + address_immediate_sib_32bit: + test ecx,0FF0000h + jnz address_immediate_sib_nosignextend + test edx,80000000h + jz address_immediate_sib_store + address_immediate_sib_nosignextend: + call address_32bit_prefix + jmp address_immediate_sib_store + address_eip_based: + mov al,67h + stos byte [edi] + address_rip_based: + cmp [code_type],64 + jne invalid_address + call store_instruction_code + jmp store_immediate_address + address_relative: + call store_instruction_code + movzx eax,[immediate_size] + add eax,edi + sub eax,[current_offset] + add eax,5 + sub edx,eax + jo value_out_of_range + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + shr ecx,16 + xchg [value_type],cl + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + mov eax,edx + call mark_relocation + mov [value_type],cl + mov [symbol_identifier],ebx + stos dword [edi] + ret + addressing_16bit: + cmp edx,10000h + jge address_immediate_32bit + cmp edx,-8000h + jl address_immediate_32bit + movzx edx,dx + address_immediate_16bit: + call address_16bit_prefix + call store_instruction_code + mov al,110b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + ret + address_16bit_prefix: + cmp [code_type],16 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + ret + address_32bit_prefix: + cmp [code_type],32 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + instruction_prefix_ok: + ret +store_instruction_with_imm8: + mov [immediate_size],1 + call store_instruction + mov al,byte [value] + stos byte [edi] + ret +store_instruction_with_imm16: + mov [immediate_size],2 + call store_instruction + mov ax,word [value] + call mark_relocation + stos word [edi] + ret +store_instruction_with_imm32: + mov [immediate_size],4 + call store_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + ret diff --git a/samples/C++/Math.inl b/samples/C++/Math.inl new file mode 100644 index 00000000..194370a3 --- /dev/null +++ b/samples/C++/Math.inl @@ -0,0 +1,530 @@ +/* +=========================================================================== +The Open Game Libraries. +Copyright (C) 2007-2010 Lusito Software + +Author: Santo Pfingsten (TTK-Bandit) +Purpose: Math namespace +----------------------------------------- + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. +=========================================================================== +*/ + +#ifndef __OG_MATH_INL__ +#define __OG_MATH_INL__ + +namespace og { + +/* +============================================================================== + + Math + +============================================================================== +*/ + +/* +================ +Math::Abs +================ +*/ +OG_INLINE int Math::Abs( int i ) { +#if 1 + if ( i & 0x80000000 ) + return 0x80000000 - (i & MASK_SIGNED); + return i; +#else + int y = x >> 31; + return ( ( x ^ y ) - y ); +#endif +} + +/* +================ +Math::Fabs +================ +*/ +OG_INLINE float Math::Fabs( float f ) { +#if 1 + uInt *pf = reinterpret_cast(&f); + *(pf) &= MASK_SIGNED; + return f; +#else + return fabsf( f ); +#endif +} + +/* +================ +Math::Round +================ +*/ +OG_INLINE float Math::Round( float f ) { + return floorf( f + 0.5f ); +} + +/* +================ +Math::Floor +================ +*/ +OG_INLINE float Math::Floor( float f ) { + return floorf( f ); +} + +/* +================ +Math::Ceil +================ +*/ +OG_INLINE float Math::Ceil( float f ) { + return ceilf( f ); +} + +/* +================ +Math::Ftoi + +ok since this is SSE, why should the other ftoi be the faster one ? +and: we might need to add a check for SSE extensions.. +because sse isn't *really* faster (I actually read that GCC does not handle +SSE extensions perfectly. I'll find the link and send it to you when you're online) +================ +*/ +OG_INLINE int Math::Ftoi( float f ) { + //! @todo needs testing + // note: sse function cvttss2si +#if OG_ASM_MSVC + int i; +#if defined(OG_FTOI_USE_SSE) + if( SysInfo::cpu.general.SSE ) { + __asm cvttss2si eax, f + __asm mov i, eax + return i; + } else +#endif + { + __asm fld f + __asm fistp i + //__asm mov eax, i // do we need this ? O_o + } + return i; +#elif OG_ASM_GNU + int i; +#if defined(OG_FTOI_USE_SSE) + if( SysInfo::cpu.general.SSE ) { + __asm__ __volatile__( "cvttss2si %1 \n\t" + : "=m" (i) + : "m" (f) + ); + } else +#endif + { + __asm__ __volatile__( "flds %1 \n\t" + "fistpl %0 \n\t" + : "=m" (i) + : "m" (f) + ); + } + return i; +#else + // we use c++ cast instead of c cast (not sure why id did that) + return static_cast(f); +#endif +} + +/* +================ +Math::FtoiFast +================ +*/ +OG_INLINE int Math::FtoiFast( float f ) { +#if OG_ASM_MSVC + int i; + __asm fld f + __asm fistp i + //__asm mov eax, i // do we need this ? O_o + return i; +#elif OG_ASM_GNU + int i; + __asm__ __volatile__( "flds %1 \n\t" + "fistpl %0 \n\t" + : "=m" (i) + : "m" (f) + ); + return i; +#else + // we use c++ cast instead of c cast (not sure why id did that) + return static_cast(f); +#endif +} + +/* +================ +Math::Ftol +================ +*/ +OG_INLINE long Math::Ftol( float f ) { +#if OG_ASM_MSVC + long i; + __asm fld f + __asm fistp i + //__asm mov eax, i // do we need this ? O_o + return i; +#elif OG_ASM_GNU + long i; + __asm__ __volatile__( "flds %1 \n\t" + "fistpl %0 \n\t" + : "=m" (i) + : "m" (f) + ); + return i; +#else + // we use c++ cast instead of c cast (not sure why id did that) + return static_cast(f); +#endif +} + +/* +================ +Math::Sign +================ +*/ +OG_INLINE float Math::Sign( float f ) { + if ( f > 0.0f ) + return 1.0f; + if ( f < 0.0f ) + return -1.0f; + return 0.0f; +} + +/* +================ +Math::Fmod +================ +*/ +OG_INLINE float Math::Fmod( float numerator, float denominator ) { + return fmodf( numerator, denominator ); +} + +/* +================ +Math::Modf +================ +*/ +OG_INLINE float Math::Modf( float f, float& i ) { + return modff( f, &i ); +} +OG_INLINE float Math::Modf( float f ) { + float i; + return modff( f, &i ); +} + +/* +================ +Math::Sqrt +================ +*/ +OG_INLINE float Math::Sqrt( float f ) { + return sqrtf( f ); +} + +/* +================ +Math::InvSqrt + +Cannot be 0.0f +================ +*/ +OG_INLINE float Math::InvSqrt( float f ) { + OG_ASSERT( f != 0.0f ); + return 1.0f / sqrtf( f ); +} + +/* +================ +Math::RSqrt + +Can be 0.0f +================ +*/ +OG_INLINE float Math::RSqrt( float f ) { + float g = 0.5f * f; + int i = *reinterpret_cast(&f); + + // do a guess + i = 0x5f375a86 - ( i>>1 ); + f = *reinterpret_cast(&i); + + // Newtons calculation + f = f * ( 1.5f - g * f * f ); + return f; +} + +/* +================ +Math::Log/Log2/Log10 + +Log of 0 is bad. +I've also heard you're not really +supposed to do log of negatives, yet +they work fine. +================ +*/ +OG_INLINE float Math::Log( float f ) { + OG_ASSERT( f != 0.0f ); + return logf( f ); +} +OG_INLINE float Math::Log2( float f ) { + OG_ASSERT( f != 0.0f ); + return INV_LN_2 * logf( f ); +} +OG_INLINE float Math::Log10( float f ) { + OG_ASSERT( f != 0.0f ); + return INV_LN_10 * logf( f ); +} + +/* +================ +Math::Pow +================ +*/ +OG_INLINE float Math::Pow( float base, float exp ) { + return powf( base, exp ); +} + +/* +================ +Math::Exp +================ +*/ +OG_INLINE float Math::Exp( float f ) { + return expf( f ); +} + +/* +================ +Math::IsPowerOfTwo +================ +*/ +OG_INLINE bool Math::IsPowerOfTwo( int x ) { + // This is the faster of the two known methods + // with the x > 0 check moved to the beginning + return x > 0 && ( x & ( x - 1 ) ) == 0; +} + +/* +================ +Math::HigherPowerOfTwo +================ +*/ +OG_INLINE int Math::HigherPowerOfTwo( int x ) { + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + return x + 1; +} + +/* +================ +Math::LowerPowerOfTwo +================ +*/ +OG_INLINE int Math::LowerPowerOfTwo( int x ) { + return HigherPowerOfTwo( x ) >> 1; +} + +/* +================ +Math::FloorPowerOfTwo +================ +*/ +OG_INLINE int Math::FloorPowerOfTwo( int x ) { + return IsPowerOfTwo( x ) ? x : LowerPowerOfTwo( x ); +} + +/* +================ +Math::CeilPowerOfTwo +================ +*/ +OG_INLINE int Math::CeilPowerOfTwo( int x ) { + return IsPowerOfTwo( x ) ? x : HigherPowerOfTwo( x ); +} + +/* +================ +Math::ClosestPowerOfTwo +================ +*/ +OG_INLINE int Math::ClosestPowerOfTwo( int x ) { + if ( IsPowerOfTwo( x ) ) + return x; + int high = HigherPowerOfTwo( x ); + int low = high >> 1; + return ((high-x) < (x-low)) ? high : low; +} + +/* +================ +Math::Digits +================ +*/ +OG_INLINE int Math::Digits( int x ) { + int digits = 1; + int step = 10; + while (step <= x) { + digits++; + step *= 10; + } + return digits; +} + +/* +================ +Math::Sin/ASin +================ +*/ +OG_INLINE float Math::Sin( float f ) { + return sinf( f ); +} +OG_INLINE float Math::ASin( float f ) { + if ( f <= -1.0f ) + return -HALF_PI; + if ( f >= 1.0f ) + return HALF_PI; + return asinf( f ); +} + +/* +================ +Math::Cos/ACos +================ +*/ +OG_INLINE float Math::Cos( float f ) { + return cosf( f ); +} +OG_INLINE float Math::ACos( float f ) { + if ( f <= -1.0f ) + return PI; + if ( f >= 1.0f ) + return 0.0f; + return acosf( f ); +} + +/* +================ +Math::Tan/ATan +================ +*/ +OG_INLINE float Math::Tan( float f ) { + return tanf( f ); +} +OG_INLINE float Math::ATan( float f ) { + return atanf( f ); +} +OG_INLINE float Math::ATan( float f1, float f2 ) { + return atan2f( f1, f2 ); +} + +/* +================ +Math::SinCos +================ +*/ +OG_INLINE void Math::SinCos( float f, float &s, float &c ) { +#if OG_ASM_MSVC + // sometimes assembler is just waaayy faster + _asm { + fld f + fsincos + mov ecx, c + mov edx, s + fstp dword ptr [ecx] + fstp dword ptr [edx] + } +#elif OG_ASM_GNU + asm ("fsincos" : "=t" (c), "=u" (s) : "0" (f)); +#else + s = Sin(f); + c = Sqrt( 1.0f - s * s ); // faster than calling Cos(f) +#endif +} + +/* +================ +Math::Deg2Rad +================ +*/ +OG_INLINE float Math::Deg2Rad( float f ) { + return f * DEG_TO_RAD; +} + +/* +================ +Math::Rad2Deg +================ +*/ +OG_INLINE float Math::Rad2Deg( float f ) { + return f * RAD_TO_DEG; +} + +/* +================ +Math::Square +================ +*/ +OG_INLINE float Math::Square( float v ) { + return v * v; +} + +/* +================ +Math::Cube +================ +*/ +OG_INLINE float Math::Cube( float v ) { + return v * v * v; +} + +/* +================ +Math::Sec2Ms +================ +*/ +OG_INLINE int Math::Sec2Ms( int sec ) { + return sec * 1000; +} + +/* +================ +Math::Ms2Sec +================ +*/ +OG_INLINE int Math::Ms2Sec( int ms ) { + return FtoiFast( ms * 0.001f ); +} + +} + +#endif diff --git a/samples/C++/epoll_reactor.ipp b/samples/C++/epoll_reactor.ipp new file mode 100644 index 00000000..5d592aff --- /dev/null +++ b/samples/C++/epoll_reactor.ipp @@ -0,0 +1,664 @@ +// +// detail/impl/epoll_reactor.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP +#define BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_EPOLL) + +#include +#include +#include +#include +#include + +#if defined(BOOST_ASIO_HAS_TIMERFD) +# include +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + +#include + +namespace boost { +namespace asio { +namespace detail { + +epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) + : boost::asio::detail::service_base(io_service), + io_service_(use_service(io_service)), + mutex_(), + interrupter_(), + epoll_fd_(do_epoll_create()), + timer_fd_(do_timerfd_create()), + shutdown_(false) +{ + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } +} + +epoll_reactor::~epoll_reactor() +{ + if (epoll_fd_ != -1) + close(epoll_fd_); + if (timer_fd_ != -1) + close(timer_fd_); +} + +void epoll_reactor::shutdown_service() +{ + mutex::scoped_lock lock(mutex_); + shutdown_ = true; + lock.unlock(); + + op_queue ops; + + while (descriptor_state* state = registered_descriptors_.first()) + { + for (int i = 0; i < max_ops; ++i) + ops.push(state->op_queue_[i]); + state->shutdown_ = true; + registered_descriptors_.free(state); + } + + timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + if (epoll_fd_ != -1) + ::close(epoll_fd_); + epoll_fd_ = -1; + epoll_fd_ = do_epoll_create(); + + if (timer_fd_ != -1) + ::close(timer_fd_); + timer_fd_ = -1; + timer_fd_ = do_timerfd_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } + + update_timeout(); + + // Re-register all descriptors with epoll. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + ev.events = state->registered_events_; + ev.data.ptr = state; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); + if (result != 0) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll re-registration"); + } + } + } +} + +void epoll_reactor::init_task() +{ + io_service_.init_task(); +} + +int epoll_reactor::register_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +int epoll_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +void epoll_reactor::move_descriptor(socket_type, + epoll_reactor::per_descriptor_data& target_descriptor_data, + epoll_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + +void epoll_reactor::start_op(int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op, + bool is_continuation, bool allow_speculative) +{ + if (!descriptor_data) + { + op->ec_ = boost::asio::error::bad_descriptor; + post_immediate_completion(op, is_continuation); + return; + } + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (descriptor_data->shutdown_) + { + post_immediate_completion(op, is_continuation); + return; + } + + if (descriptor_data->op_queue_[op_type].empty()) + { + if (allow_speculative + && (op_type != read_op + || descriptor_data->op_queue_[except_op].empty())) + { + if (op->perform()) + { + descriptor_lock.unlock(); + io_service_.post_immediate_completion(op, is_continuation); + return; + } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) + { + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op, is_continuation); + return; + } + } + } + } + else + { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_; + ev.data.ptr = descriptor_data; + epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); + } + } + + descriptor_data->op_queue_[op_type].push(op); + io_service_.work_started(); +} + +void epoll_reactor::cancel_ops(socket_type, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + { + while (reactor_op* op = descriptor_data->op_queue_[i].front()) + { + op->ec_ = boost::asio::error::operation_aborted; + descriptor_data->op_queue_[i].pop(); + ops.push(op); + } + } + + descriptor_lock.unlock(); + + io_service_.post_deferred_completions(ops); +} + +void epoll_reactor::deregister_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, bool closing) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + if (closing) + { + // The descriptor will be automatically removed from the epoll set when + // it is closed. + } + else + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + } + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + { + while (reactor_op* op = descriptor_data->op_queue_[i].front()) + { + op->ec_ = boost::asio::error::operation_aborted; + descriptor_data->op_queue_[i].pop(); + ops.push(op); + } + } + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + + io_service_.post_deferred_completions(ops); + } +} + +void epoll_reactor::deregister_internal_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + +void epoll_reactor::run(bool block, op_queue& ops) +{ + // This code relies on the fact that the task_io_service queues the reactor + // task behind all descriptor operations generated by this function. This + // means, that by the time we reach this point, any previously returned + // descriptor operations have already been dequeued. Therefore it is now safe + // for us to reuse and return them for the task_io_service to queue again. + + // Calculate a timeout only if timerfd is not used. + int timeout; + if (timer_fd_ != -1) + timeout = block ? -1 : 0; + else + { + mutex::scoped_lock lock(mutex_); + timeout = block ? get_timeout() : 0; + } + + // Block on the epoll descriptor. + epoll_event events[128]; + int num_events = epoll_wait(epoll_fd_, events, 128, timeout); + +#if defined(BOOST_ASIO_HAS_TIMERFD) + bool check_timers = (timer_fd_ == -1); +#else // defined(BOOST_ASIO_HAS_TIMERFD) + bool check_timers = true; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + + // Dispatch the waiting events. + for (int i = 0; i < num_events; ++i) + { + void* ptr = events[i].data.ptr; + if (ptr == &interrupter_) + { + // No need to reset the interrupter since we're leaving the descriptor + // in a ready-to-read state and relying on edge-triggered notifications + // to make it so that we only get woken up when the descriptor's epoll + // registration is updated. + +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ == -1) + check_timers = true; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + check_timers = true; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + } +#if defined(BOOST_ASIO_HAS_TIMERFD) + else if (ptr == &timer_fd_) + { + check_timers = true; + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + else + { + // The descriptor operation doesn't count as work in and of itself, so we + // don't call work_started() here. This still allows the io_service to + // stop if the only remaining operations are descriptor operations. + descriptor_state* descriptor_data = static_cast(ptr); + descriptor_data->set_ready_events(events[i].events); + ops.push(descriptor_data); + } + } + + if (check_timers) + { + mutex::scoped_lock common_lock(mutex_); + timer_queues_.get_ready_timers(ops); + +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ != -1) + { + itimerspec new_timeout; + itimerspec old_timeout; + int flags = get_timeout(new_timeout); + timerfd_settime(timer_fd_, flags, &new_timeout, &old_timeout); + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + } +} + +void epoll_reactor::interrupt() +{ + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, interrupter_.read_descriptor(), &ev); +} + +int epoll_reactor::do_epoll_create() +{ +#if defined(EPOLL_CLOEXEC) + int fd = epoll_create1(EPOLL_CLOEXEC); +#else // defined(EPOLL_CLOEXEC) + int fd = -1; + errno = EINVAL; +#endif // defined(EPOLL_CLOEXEC) + + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) + { + fd = epoll_create(epoll_size); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + if (fd == -1) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll"); + } + + return fd; +} + +int epoll_reactor::do_timerfd_create() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) +# if defined(TFD_CLOEXEC) + int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); +# else // defined(TFD_CLOEXEC) + int fd = -1; + errno = EINVAL; +# endif // defined(TFD_CLOEXEC) + + if (fd == -1 && errno == EINVAL) + { + fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + return fd; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + return -1; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) +} + +epoll_reactor::descriptor_state* epoll_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void epoll_reactor::free_descriptor_state(epoll_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + +void epoll_reactor::do_add_timer_queue(timer_queue_base& queue) +{ + mutex::scoped_lock lock(mutex_); + timer_queues_.insert(&queue); +} + +void epoll_reactor::do_remove_timer_queue(timer_queue_base& queue) +{ + mutex::scoped_lock lock(mutex_); + timer_queues_.erase(&queue); +} + +void epoll_reactor::update_timeout() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ != -1) + { + itimerspec new_timeout; + itimerspec old_timeout; + int flags = get_timeout(new_timeout); + timerfd_settime(timer_fd_, flags, &new_timeout, &old_timeout); + return; + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + interrupt(); +} + +int epoll_reactor::get_timeout() +{ + // By default we will wait no longer than 5 minutes. This will ensure that + // any changes to the system clock are detected after no longer than this. + return timer_queues_.wait_duration_msec(5 * 60 * 1000); +} + +#if defined(BOOST_ASIO_HAS_TIMERFD) +int epoll_reactor::get_timeout(itimerspec& ts) +{ + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 0; + + long usec = timer_queues_.wait_duration_usec(5 * 60 * 1000 * 1000); + ts.it_value.tv_sec = usec / 1000000; + ts.it_value.tv_nsec = usec ? (usec % 1000000) * 1000 : 1; + + return usec ? 0 : TFD_TIMER_ABSTIME; +} +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + +struct epoll_reactor::perform_io_cleanup_on_block_exit +{ + explicit perform_io_cleanup_on_block_exit(epoll_reactor* r) + : reactor_(r), first_op_(0) + { + } + + ~perform_io_cleanup_on_block_exit() + { + if (first_op_) + { + // Post the remaining completed operations for invocation. + if (!ops_.empty()) + reactor_->io_service_.post_deferred_completions(ops_); + + // A user-initiated operation has completed, but there's no need to + // explicitly call work_finished() here. Instead, we'll take advantage of + // the fact that the task_io_service will call work_finished() once we + // return. + } + else + { + // No user-initiated operations have completed, so we need to compensate + // for the work_finished() call that the task_io_service will make once + // this operation returns. + reactor_->io_service_.work_started(); + } + } + + epoll_reactor* reactor_; + op_queue ops_; + operation* first_op_; +}; + +epoll_reactor::descriptor_state::descriptor_state() + : operation(&epoll_reactor::descriptor_state::do_complete) +{ +} + +operation* epoll_reactor::descriptor_state::perform_io(uint32_t events) +{ + mutex_.lock(); + perform_io_cleanup_on_block_exit io_cleanup(reactor_); + mutex::scoped_lock descriptor_lock(mutex_, mutex::scoped_lock::adopt_lock); + + // Exception operations must be processed first to ensure that any + // out-of-band data is read before normal data. + static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; + for (int j = max_ops - 1; j >= 0; --j) + { + if (events & (flag[j] | EPOLLERR | EPOLLHUP)) + { + while (reactor_op* op = op_queue_[j].front()) + { + if (op->perform()) + { + op_queue_[j].pop(); + io_cleanup.ops_.push(op); + } + else + break; + } + } + } + + // The first operation will be returned for completion now. The others will + // be posted for later by the io_cleanup object's destructor. + io_cleanup.first_op_ = io_cleanup.ops_.front(); + io_cleanup.ops_.pop(); + return io_cleanup.first_op_; +} + +void epoll_reactor::descriptor_state::do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + if (owner) + { + descriptor_state* descriptor_data = static_cast(base); + uint32_t events = static_cast(bytes_transferred); + if (operation* op = descriptor_data->perform_io(events)) + { + op->complete(*owner, ec, 0); + } + } +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_EPOLL) + +#endif // BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP diff --git a/samples/Common Lisp/macros-advanced.cl b/samples/Common Lisp/macros-advanced.cl new file mode 100644 index 00000000..b746d769 --- /dev/null +++ b/samples/Common Lisp/macros-advanced.cl @@ -0,0 +1,82 @@ +;; @file macros-advanced.cl +;; +;; @breif Advanced macro practices - defining your own macros +;; +;; Macro definition skeleton: +;; (defmacro name (parameter*) +;; "Optional documentation string" +;; body-form*) +;; +;; Note that backquote expression is most often used in the `body-form` +;; + +; `primep` test a number for prime +(defun primep (n) + "test a number for prime" + (if (< n 2) (return-from primep)) + (do ((i 2 (1+ i)) (p t (not (zerop (mod n i))))) + ((> i (sqrt n)) p) + (when (not p) (return)))) +; `next-prime` return the next prime bigger than the specified number +(defun next-prime (n) + "return the next prime bigger than the speicified number" + (do ((i (1+ n) (1+ i))) + ((primep i) i))) +; +; The recommended procedures to writting a new macro are as follows: +; 1. Write a sample call to the macro and the code it should expand into +(do-primes (p 0 19) + (format t "~d " p)) +; Expected expanded codes +(do ((p (next-prime (- 0 1)) (next-prime p))) + ((> p 19)) + (format t "~d " p)) +; 2. Write code that generate the hardwritten expansion from the arguments in +; the sample call +(defmacro do-primes (var-and-range &rest body) + (let ((var (first var-and-range)) + (start (second var-and-range)) + (end (third var-and-range))) + `(do ((,var (next-prime (- ,start 1)) (next-prime ,var))) + ((> ,var ,end)) + ,@body))) +; 2-1. More concise implementations with the 'parameter list destructuring' and +; '&body' synonym, it also emits more friendly messages on incorrent input. +(defmacro do-primes ((var start end) &body body) + `(do ((,var (next-prime (- ,start 1)) (next-prime ,var))) + ((> ,var ,end)) + ,@body)) +; 2-2. Test the result of macro expansion with the `macroexpand-1` function +(macroexpand-1 '(do-primes (p 0 19) (format t "~d " p))) +; 3. Make sure the macro abstraction does not "leak" +(defmacro do-primes ((var start end) &body body) + (let ((end-value-name (gensym))) + `(do ((,var (next-prime (- ,start 1)) (next-prime ,var)) + (,end-value-name ,end)) + ((> ,var ,end-value-name)) + ,@body))) +; 3-1. Rules to observe to avoid common and possible leaks +; a. include any subforms in the expansion in positions that will be evaluated +; in the same order as the subforms appear in the macro call +; b. make sure subforms are evaluated only once by creating a variable in the +; expansion to hold the value of evaluating the argument form, and then +; using that variable anywhere else the value is needed in the expansion +; c. use `gensym` at macro expansion time to create variable names used in the +; expansion +; +; Appendix I. Macro-writting macros, 'with-gensyms', to guranttee that rule c +; gets observed. +; Example usage of `with-gensyms` +(defmacro do-primes-a ((var start end) &body body) + "do-primes implementation with macro-writting macro 'with-gensyms'" + (with-gensyms (end-value-name) + `(do ((,var (next-prime (- ,start 1)) (next-prime ,var)) + (,end-value-name ,end)) + ((> ,var ,end-value-name)) + ,@body))) +; Define the macro, note how comma is used to interpolate the value of the loop +; expression +(defmacro with-gensyms ((&rest names) &body body) + `(let ,(loop for n in names collect `(,n (gensym))) + ,@body) +) \ No newline at end of file diff --git a/samples/Common Lisp/motor-inferencia.cl b/samples/Common Lisp/motor-inferencia.cl new file mode 100644 index 00000000..6a2a97ea --- /dev/null +++ b/samples/Common Lisp/motor-inferencia.cl @@ -0,0 +1,475 @@ +#| +ESCUELA POLITECNICA SUPERIOR - UNIVERSIDAD AUTONOMA DE MADRID +INTELIGENCIA ARTIFICIAL + +Motor de inferencia +Basado en parte en "Paradigms of AI Programming: Case Studies +in Common Lisp", de Peter Norvig, 1992 +|# + + +;;;;;;;;;;;;;;;;;;;;; +;;;; Global variables +;;;;;;;;;;;;;;;;;;;;; + + +(defvar *hypothesis-list*) +(defvar *rule-list*) +(defvar *fact-list*) + +;;;;;;;;;;;;;;;;;;;;; +;;;; Constants +;;;;;;;;;;;;;;;;;;;;; + +(defconstant +fail+ nil "Indicates unification failure") + +(defconstant +no-bindings+ '((nil)) + "Indicates unification success, with no variables.") + +(defconstant *mundo-abierto* nil) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; Functions for the user +;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;; Resets *fact-list* to NIL +(defun erase-facts () (setq *fact-list* nil)) + +(defun set-hypothesis-list (h) (setq *hypothesis-list* h)) + + +;; Returns a list of solutions, each one satisfying all the hypothesis contained +;; in *hypothesis-list* +(defun motor-inferencia () + (consulta *hypothesis-list*)) + + + +;;;;;;;;;;;;;;;;;;;;;;;; +;;;; Auxiliary functions +;;;;;;;;;;;;;;;;;;;;;;;; + +#|____________________________________________________________________________ +FUNCTION: CONSULTA + +COMMENTS: +CONSULTA receives a list of hypothesis (variable ), and returns +a list of binding lists (each binding list being a solution). + +EXAMPLES: +hypotheses is: +((brothers ?x ?y) (neighbours juan ?x)). + +That is, we are searching the brothers of the possible neighbors of Juan. + +The function can return in this case: + +(((?x . sergio) (?y . javier)) ((?x . julian) (?y . mario)) ((?x . julian) (?y . pedro))). +That is, the neighbors of Juan (Sergio and Julian) have 3 brothers in total(Javier, Mario, Pedro) +____________________________________________________________________________|# + +(defun consulta (hypotheses) + (if (null hypotheses) (list +no-bindings+) + (mapcan #'(lambda (b) + (mapcar #'(lambda (x) (une-bindings-con-bindings b x)) + (consulta (subst-bindings b (rest hypotheses))))) + (find-hypothesis-value (first hypotheses))))) + + + +#|____________________________________________________________________________ +FUNCTION: FIND-HYPOTHESIS-VALUE + +COMMENTS: +This function manages the query a single query (only one hypothesis) given a binding list. +It tries (in the following order) to: +- Answer the query from *fact-list* +- Answer the query from the rules in *rule-list* +- Ask the user + +The function returns a list of solutions (list of binding lists). + +EXAMPLES: +If hypothesis is (brothers ?x ?y) +and the function returns: +(((?x . sergio) (?y . javier)) ((?x . julian) (?y . maria)) ((?x . alberto) (?y . pedro))). + +Means that Sergio and Javier and brothers, Julian and Mario are brothers, and Alberto and Pedro are brothers. +____________________________________________________________________________|# + +(defun find-hypothesis-value (hypothesis) + (let (rules) + (cond + ((equality? hypothesis) + (value-from-equality hypothesis)) + ((value-from-facts hypothesis)) + ((setq good-rules (find-rules hypothesis)) + (value-from-rules hypothesis good-rules)) + (t (ask-user hypothesis))))) + + + +; une-bindings-con-bindings takes two binding lists and returns a binding list +; Assumes that b1 and b2 are not +fail+ +(defun une-bindings-con-bindings (b1 b2) + (cond + ((equal b1 +no-bindings+) b2) + ((equal b2 +no-bindings+) b1) + (T (append b1 b2)))) + + + +#|____________________________________________________________________________ +FUNCTION: VALUE-FROM-FACTS + +COMMENTS: +Returns all the solutions of obtained directly from *fact-list* + +EXAMPLES: +> (setf *fact-list* '((man luis) (man pedro)(woman mart)(man daniel)(woman laura))) + +> (value-from-facts '(man ?x)) +returns: + +(((?X . LUIS)) ((?X . PEDRO)) ((?X . DANIEL))) +____________________________________________________________________________|# + +(defun value-from-facts (hypothesis) + (mapcan #'(lambda(x) (let ((aux (unify hypothesis x))) + (when aux (list aux)))) *fact-list*)) + + + + +#|____________________________________________________________________________ +FUNCTION: FIND-RULES + +COMMENTS: +Returns the rules in *rule-list* whose THENs unify with the term given in +The variables in the rules that satisfy this requirement are renamed. + +EXAMPLES: +> (setq *rule-list* + '((R1 (pertenece ?E (?E . ?_))) + (R2 (pertenece ?E (?_ . ?Xs)) :- ((pertenece ?E ?Xs))))) + +Then: +> (FIND-RULES (PERTENECE 1 (2 5))) +returns: +((R2 (PERTENECE ?E.1 (?_ . ?XS.2)) :- ((PERTENECE ?E.1 ?XS.2)))) +That is, only the THEN of rule R2 unify with + +However, +> (FIND-RULES (PERTENECE 1 (1 6 7))) + +returns: +((R1 (PERTENECE ?E.6 (?E.6 . ?_))) + (R2 (PERTENECE ?E.7 (?_ . ?XS.8)) :- ((PERTENECE ?E.7 ?XS.8)))) +So the THEN of both rules unify with +____________________________________________________________________________|# + +(defun find-rules (hypothesis) + (mapcan #'(lambda(b) (let ((renamed-rule (rename-variables b))) + (when (in-then? hypothesis renamed-rule) + (list renamed-rule)))) *rule-list*)) + +(defun in-then? (hypothesis rule) + (unless (null (rule-then rule)) + (not (equal +fail+ (unify hypothesis (rule-then rule)))))) + + + +#|____________________________________________________________________________ +FUNCTION: VALUE-FROM-RULES + +COMMENTS: +Returns all the solutions to found using all the rules given in +the list . Note that a single rule can have multiple solutions. +____________________________________________________________________________|# +(defun value-from-rules (hypothesis rules) + (mapcan #'(lambda (r) (eval-rule hypothesis r)) rules)) + +(defun limpia-vinculos (termino bindings) + (unify termino (subst-bindings bindings termino))) + + +#|____________________________________________________________________________ +FUNCTION: EVAL-RULE + +COMMENTS: +Returns all the solutions found using the rule given as input argument. + +EXAMPLES: +> (setq *rule-list* + '((R1 (pertenece ?E (?E . ?_))) + (R2 (pertenece ?E (?_ . ?Xs)) :- ((pertenece ?E ?Xs))))) +Then: +> (EVAL-RULE + (PERTENECE 1 (1 6 7)) + (R1 (PERTENECE ?E.42 (?E.42 . ?_)))) +returns: +(((NIL))) +That is, the query (PERTENECE 1 (1 6 7)) can be proven from the given rule, and +no binding in the variables in the query is necessary (in fact, the query has no variables). +On the other hand: +> (EVAL-RULE + (PERTENECE 1 (7)) + (R2 (PERTENECE ?E.49 (?_ . ?XS.50)) :- ((PERTENECE ?E.49 ?XS.50)))) +returns: +NIL +That is, the query can not be proven from the rule R2. +____________________________________________________________________________|# + +(defun eval-rule (hypothesis rule) + (let ((bindings-then + (unify (rule-then rule) hypothesis))) + (unless (equal +fail+ bindings-then) + (if (rule-ifs rule) + (mapcar #'(lambda(b) (limpia-vinculos hypothesis (append bindings-then b))) + (consulta (subst-bindings bindings-then (rule-ifs rule)))) + (list (limpia-vinculos hypothesis bindings-then)))))) + + +(defun ask-user (hypothesis) + (let ((question hypothesis)) + (cond + ((variables-in question) +fail+) + ((not-in-fact-list? question) +fail+) + (*mundo-abierto* + (format t "~%Es cierto el hecho ~S? (T/nil)" question) + (cond + ((read) (add-fact question) +no-bindings+) + (T (add-fact (list 'NOT question)) +fail+))) + (T +fail+)))) + + +; value-from-equality: +(defun value-from-equality (hypothesis) + (let ((new-bindings (unify (second hypothesis) (third hypothesis)))) + (if (not (equal +fail+ new-bindings)) + (list new-bindings)))) + + + +#|____________________________________________________________________________ +FUNCTION: UNIFY + +COMMENTS: +Finds the most general unifier of two input expressions, taking into account the +bindings specified in the input +In case the two expressions can unify, the function returns the total bindings necessary +for that unification. Otherwise, returns +fail+ + +EXAMPLES: +> (unify '1 '1) +((NIL)) ;; which is the constant +no-bindings+ +> (unify 1 '2) +nil ;; which is the constant +fail+ +> (unify '?x 1) +((?x . 1)) +> (unify '(1 1) ?x) +((? x 1 1)) +> (unify '?_ '?x) +((NIL)) +> (unify '(p ?x 1 2) '(p ?y ?_ ?_)) +((?x . ?y)) +> (unify '(?a . ?_) '(1 2 3)) +((?a . 1)) +> (unify '(?_ ?_) '(1 2)) +((nil)) +> (unify '(?a . ?b) '(1 2 3)) +((?b 2 3) (?a . 1)) +> (unify '(?a . ?b) '(?v . ?d)) +((?b . ?d) (?a . ?v)) +> (unify '(?eval (+ 1 1)) '1) +nil +> (unify '(?eval (+ 1 1)) '2) +(nil)) +____________________________________________________________________________|# + +(defun unify (x y &optional (bindings +no-bindings+)) + "See if x and y match with given bindings. If they do, + return a binding list that would make them equal [p 303]." + (cond ((eq bindings +fail+) +fail+) + ((eql x y) bindings) + ((eval? x) (unify-eval x y bindings)) + ((eval? y) (unify-eval y x bindings)) + ((variable? x) (unify-var x y bindings)) + ((variable? y) (unify-var y x bindings)) + ((and (consp x) (consp y)) + (unify (rest x) (rest y) + (unify (first x) (first y) bindings))) + (t +fail+))) + + +;; rename-variables: renombra ?X por ?X.1, ?Y por ?Y.2 etc. salvo ?_ que no se renombra +(defun rename-variables (x) + "Replace all variables in x with new ones. Excepto ?_" + (sublis (mapcar #'(lambda (var) + (if (anonymous-var? var) + (make-binding var var) + (make-binding var (new-variable var)))) + (variables-in x)) + x)) + + + +;;;; Auxiliary Functions + +(defun unify-var (var x bindings) + "Unify var with x, using (and maybe extending) bindings [p 303]." + (cond ((or (anonymous-var? var)(anonymous-var? x)) bindings) + ((get-binding var bindings) + (unify (lookup var bindings) x bindings)) + ((and (variable? x) (get-binding x bindings)) + (unify var (lookup x bindings) bindings)) + ((occurs-in? var x bindings) + +fail+) + (t (extend-bindings var x bindings)))) + +(defun variable? (x) + "Is x a variable (a symbol starting with ?)?" + (and (symbolp x) (eql (char (symbol-name x) 0) #\?))) + +(defun get-binding (var bindings) + "Find a (variable . value) pair in a binding list." + (assoc var bindings)) + +(defun binding-var (binding) + "Get the variable part of a single binding." + (car binding)) + +(defun binding-val (binding) + "Get the value part of a single binding." + (cdr binding)) + +(defun make-binding (var val) (cons var val)) + +(defun lookup (var bindings) + "Get the value part (for var) from a binding list." + (binding-val (get-binding var bindings))) + +(defun extend-bindings (var val bindings) + "Add a (var . value) pair to a binding list." + (append + (unless (eq bindings +no-bindings+) bindings) + (list (make-binding var val)))) + +(defun occurs-in? (var x bindings) + "Does var occur anywhere inside x?" + (cond ((eq var x) t) + ((and (variable? x) (get-binding x bindings)) + (occurs-in? var (lookup x bindings) bindings)) + ((consp x) (or (occurs-in? var (first x) bindings) + (occurs-in? var (rest x) bindings))) + (t nil))) + +(defun subst-bindings (bindings x) + "Substitute the value of variables in bindings into x, + taking recursively bound variables into account." + (cond ((eq bindings +fail+) +fail+) + ((eq bindings +no-bindings+) x) + ((and (listp x) (eq '?eval (car x))) + (subst-bindings-quote bindings x)) + ((and (variable? x) (get-binding x bindings)) + (subst-bindings bindings (lookup x bindings))) + ((atom x) x) + (t (cons (subst-bindings bindings (car x)) ;; s/reuse-cons/cons + (subst-bindings bindings (cdr x)))))) + +(defun unifier (x y) + "Return something that unifies with both x and y (or fail)." + (subst-bindings (unify x y) x)) + +(defun variables-in (exp) + "Return a list of all the variables in EXP." + (unique-find-anywhere-if #'variable? exp)) + +(defun unique-find-anywhere-if (predicate tree &optional found-so-far) + "Return a list of leaves of tree satisfying predicate, + with duplicates removed." + (if (atom tree) + (if (funcall predicate tree) + (pushnew tree found-so-far) + found-so-far) + (unique-find-anywhere-if + predicate + (first tree) + (unique-find-anywhere-if predicate (rest tree) + found-so-far)))) + +(defun find-anywhere-if (predicate tree) + "Does predicate apply to any atom in the tree?" + (if (atom tree) + (funcall predicate tree) + (or (find-anywhere-if predicate (first tree)) + (find-anywhere-if predicate (rest tree))))) + +(defun new-variable (var) + "Create a new variable. Assumes user never types variables of form ?X.9" + (gentemp (format nil "~S." var))) +; (gentemp "?") ) +;;; + +(defun anonymous-var? (x) + (eq x '?_)) + +(defun subst-bindings-quote (bindings x) + "Substitute the value of variables in bindings into x, + taking recursively bound variables into account." + (cond ((eq bindings +fail+) +fail+) + ((eq bindings +no-bindings+) x) + ((and (variable? x) (get-binding x bindings)) + (if (variable? (lookup x bindings)) + (subst-bindings-quote bindings (lookup x bindings)) + (subst-bindings-quote bindings (list 'quote (lookup x bindings))) + ) + ) + ((atom x) x) + (t (cons (subst-bindings-quote bindings (car x)) ;; s/reuse-cons/cons + (subst-bindings-quote bindings (cdr x)))))) + +(defun eval? (x) + (and (consp x) (eq (first x) '?eval))) + +(defun unify-eval (x y bindings) + (let ((exp (subst-bindings-quote bindings (second x)))) + (if (variables-in exp) + +fail+ + (unify (eval exp) y bindings)))) + + + +(defun rule-ifs (rule) (fourth rule)) +(defun rule-then (rule) (second rule)) + + +(defun equality? (term) + (and (consp term) (eql (first term) '?=))) + + +(defun in-fact-list? (expresion) + (some #'(lambda(x) (equal x expresion)) *fact-list*)) + +(defun not-in-fact-list? (expresion) + (if (eq (car expresion) 'NOT) + (in-fact-list? (second expresion)) + (in-fact-list? (list 'NOT expresion)))) + + +;; add-fact: + +(defun add-fact (fact) + (setq *fact-list* (cons fact *fact-list*))) + + +(defun variable? (x) + "Is x a variable (a symbol starting with ?) except ?eval and ?=" + (and (not (equal x '?eval)) (not (equal x '?=)) + (symbolp x) (eql (char (symbol-name x) 0) #\?))) + + +;; EOF \ No newline at end of file diff --git a/samples/Component Pascal/Example.cp b/samples/Component Pascal/Example.cp new file mode 100644 index 00000000..5bace2c4 --- /dev/null +++ b/samples/Component Pascal/Example.cp @@ -0,0 +1,130 @@ +MODULE ObxControls; +(** + project = "BlackBox" + organization = "www.oberon.ch" + contributors = "Oberon microsystems" + version = "System/Rsrc/About" + copyright = "System/Rsrc/About" + license = "Docu/BB-License" + changes = "" + issues = "" + +**) + +IMPORT Dialog, Ports, Properties, Views; + +CONST beginner = 0; advanced = 1; expert = 2; guru = 3; (* user classes *) + +TYPE + View = POINTER TO RECORD (Views.View) + size: INTEGER (* border size in mm *) + END; + +VAR + data*: RECORD + class*: INTEGER; (* current user class *) + list*: Dialog.List; (* list of currently available sizes, derived from class *) + width*: INTEGER (* width of next view to be opened. Derived from + class, or entered through a text entry field *) + END; + + predef: ARRAY 6 OF INTEGER; (* table of predefined sizes *) + + +PROCEDURE SetList; +BEGIN + IF data.class = beginner THEN + data.list.SetLen(1); + data.list.SetItem(0, "default") + ELSIF data.class = advanced THEN + data.list.SetLen(4); + data.list.SetItem(0, "default"); + data.list.SetItem(1, "small"); + data.list.SetItem(2, "medium"); + data.list.SetItem(3, "large"); + ELSE + data.list.SetLen(6); + data.list.SetItem(0, "default"); + data.list.SetItem(1, "small"); + data.list.SetItem(2, "medium"); + data.list.SetItem(3, "large"); + data.list.SetItem(4, "tiny"); + data.list.SetItem(5, "huge"); + END +END SetList; + +(* View *) + +PROCEDURE (v: View) CopyFromSimpleView (source: Views.View); +BEGIN + v.size := source(View).size +END CopyFromSimpleView; + +PROCEDURE (v: View) Restore (f: Views.Frame; l, t, r, b: INTEGER); +BEGIN (* fill view with a red square of size v.size *) + IF v.size = 0 THEN v.size := predef[0] END; (* lazy initialization of size *) + f.DrawRect(0, 0, v.size, v.size, Ports.fill, Ports.red) +END Restore; + +PROCEDURE (v: View) HandlePropMsg (VAR msg: Views.PropMessage); +BEGIN + WITH msg: Properties.SizePref DO + IF v.size = 0 THEN v.size := predef[0] END; (* lazy initialization of size *) + msg.w := v.size; msg.h := v.size (* tell environment about desired width and height *) + ELSE (* ignore other messages *) + END +END HandlePropMsg; + +(* notifiers *) + +PROCEDURE ClassNotify* (op, from, to: INTEGER); +BEGIN (* react to change in data.class *) + IF op = Dialog.changed THEN + IF (to = beginner) OR (to = advanced) & (data.list.index > 3) THEN + (* if class is reduced, make sure that selection contains legal elements *) + data.list.index := 0; data.width := predef[0]; (* modify interactor *) + Dialog.Update(data) (* redraw controls where necessary *) + END; + SetList; + Dialog.UpdateList(data.list) (* reconstruct list box contents *) + END +END ClassNotify; + +PROCEDURE ListNotify* (op, from, to: INTEGER); +BEGIN (* reacto to change in data.list (index to was selected) *) + IF op = Dialog.changed THEN + data.width := predef[to]; (* modify interactor *) + Dialog.Update(data) (* redraw controls where necessary *) + END +END ListNotify; + +(* guards *) + +PROCEDURE ListGuard* (VAR par: Dialog.Par); +BEGIN (* disable list box for a beginner *) + par.disabled := data.class = beginner +END ListGuard; + +PROCEDURE WidthGuard* (VAR par: Dialog.Par); +BEGIN (* make text entry field read-only if user is not guru *) + par.readOnly := data.class # guru +END WidthGuard; + +(* commands *) + +PROCEDURE Open*; + VAR v: View; +BEGIN + NEW(v); (* create and initialize a new view *) + v.size := data.width * Ports.mm; (* define view's size in function of class *) + Views.OpenAux(v, "Example") (* open the view in a window *) +END Open; + +BEGIN (* initialization of global variables *) + predef[0] := 40; predef[1] := 30; predef[2] := 50; (* predefined sizes *) + predef[3] := 70; predef[4] := 20; predef[5] := 100; + data.class := beginner; (* default values *) + data.list.index := 0; + data.width := predef[0]; + SetList +END ObxControls. diff --git a/samples/Component Pascal/Example2.cps b/samples/Component Pascal/Example2.cps new file mode 100644 index 00000000..4c4b3930 --- /dev/null +++ b/samples/Component Pascal/Example2.cps @@ -0,0 +1,71 @@ +MODULE ObxFact; +(** + project = "BlackBox" + organization = "www.oberon.ch" + contributors = "Oberon microsystems" + version = "System/Rsrc/About" + copyright = "System/Rsrc/About" + license = "Docu/BB-License" + changes = "" + issues = "" + +**) + +IMPORT + Stores, Models, TextModels, TextControllers, Integers; + +PROCEDURE Read(r: TextModels.Reader; VAR x: Integers.Integer); + VAR i, len, beg: INTEGER; ch: CHAR; buf: POINTER TO ARRAY OF CHAR; +BEGIN + r.ReadChar(ch); + WHILE ~r.eot & (ch <= " ") DO r.ReadChar(ch) END; + ASSERT(~r.eot & (((ch >= "0") & (ch <= "9")) OR (ch = "-"))); + beg := r.Pos() - 1; len := 0; + REPEAT INC(len); r.ReadChar(ch) UNTIL r.eot OR (ch < "0") OR (ch > "9"); + NEW(buf, len + 1); + i := 0; r.SetPos(beg); + REPEAT r.ReadChar(buf[i]); INC(i) UNTIL i = len; + buf[i] := 0X; + Integers.ConvertFromString(buf^, x) +END Read; + +PROCEDURE Write(w: TextModels.Writer; x: Integers.Integer); + VAR i: INTEGER; +BEGIN + IF Integers.Sign(x) < 0 THEN w.WriteChar("-") END; + i := Integers.Digits10Of(x); + IF i # 0 THEN + REPEAT DEC(i); w.WriteChar(Integers.ThisDigit10(x, i)) UNTIL i = 0 + ELSE w.WriteChar("0") + END +END Write; + +PROCEDURE Compute*; + VAR beg, end, i, n: INTEGER; ch: CHAR; + s: Stores.Operation; + r: TextModels.Reader; w: TextModels.Writer; attr: TextModels.Attributes; + c: TextControllers.Controller; + x: Integers.Integer; +BEGIN + c := TextControllers.Focus(); + IF (c # NIL) & c.HasSelection() THEN + c.GetSelection(beg, end); + r := c.text.NewReader(NIL); r.SetPos(beg); r.ReadChar(ch); + WHILE ~r.eot & (beg < end) & (ch <= " ") DO r.ReadChar(ch); INC(beg) END; + IF ~r.eot & (beg < end) THEN + r.ReadPrev; Read(r, x); + end := r.Pos(); r.ReadPrev; attr :=r.attr; + IF (Integers.Sign(x) > 0) & (Integers.Compare(x, Integers.Long(MAX(LONGINT))) <= 0) THEN + n := SHORT(Integers.Short(x)); i := 2; x := Integers.Long(1); + WHILE i <= n DO x := Integers.Product(x, Integers.Long(i)); INC(i) END; + Models.BeginScript(c.text, "computation", s); + c.text.Delete(beg, end); + w := c.text.NewWriter(NIL); w.SetPos(beg); w.SetAttr(attr); + Write(w, x); + Models.EndScript(c.text, s) + END + END + END +END Compute; + +END ObxFact. \ No newline at end of file diff --git a/samples/Crystal/const_spec.cr b/samples/Crystal/const_spec.cr new file mode 100644 index 00000000..3ab20f14 --- /dev/null +++ b/samples/Crystal/const_spec.cr @@ -0,0 +1,169 @@ +#!/usr/bin/env bin/crystal --run +require "../../spec_helper" + +describe "Codegen: const" do + it "define a constant" do + run("A = 1; A").to_i.should eq(1) + end + + it "support nested constant" do + run("class B; A = 1; end; B::A").to_i.should eq(1) + end + + it "support constant inside a def" do + run(" + class Foo + A = 1 + + def foo + A + end + end + + Foo.new.foo + ").to_i.should eq(1) + end + + it "finds nearest constant first" do + run(" + A = 1 + + class Foo + A = 2.5_f32 + + def foo + A + end + end + + Foo.new.foo + ").to_f32.should eq(2.5) + end + + it "allows constants with same name" do + run(" + A = 1 + + class Foo + A = 2.5_f32 + + def foo + A + end + end + + A + Foo.new.foo + ").to_f32.should eq(2.5) + end + + it "constants with expression" do + run(" + A = 1 + 1 + A + ").to_i.should eq(2) + end + + it "finds global constant" do + run(" + A = 1 + + class Foo + def foo + A + end + end + + Foo.new.foo + ").to_i.should eq(1) + end + + it "define a constant in lib" do + run("lib Foo; A = 1; end; Foo::A").to_i.should eq(1) + end + + it "invokes block in const" do + run("require \"prelude\"; A = [\"1\"].map { |x| x.to_i }; A[0]").to_i.should eq(1) + end + + it "declare constants in right order" do + run("A = 1 + 1; B = true ? A : 0; B").to_i.should eq(2) + end + + it "uses correct types lookup" do + run(" + module A + class B + def foo + 1 + end + end + + C = B.new; + end + + def foo + A::C.foo + end + + foo + ").to_i.should eq(1) + end + + it "codegens variable assignment in const" do + run(" + class Foo + def initialize(@x) + end + + def x + @x + end + end + + A = begin + f = Foo.new(1) + f + end + + def foo + A.x + end + + foo + ").to_i.should eq(1) + end + + it "declaring var" do + run(" + BAR = begin + a = 1 + while 1 == 2 + b = 2 + end + a + end + class Foo + def compile + BAR + end + end + + Foo.new.compile + ").to_i.should eq(1) + end + + it "initialize const that might raise an exception" do + run(" + require \"prelude\" + CONST = (raise \"OH NO\" if 1 == 2) + + def doit + CONST + rescue + end + + doit.nil? + ").to_b.should be_true + end +end diff --git a/samples/Crystal/declare_var_spec.cr b/samples/Crystal/declare_var_spec.cr new file mode 100644 index 00000000..c6a44127 --- /dev/null +++ b/samples/Crystal/declare_var_spec.cr @@ -0,0 +1,79 @@ +#!/usr/bin/env bin/crystal --run +require "../../spec_helper" + +describe "Type inference: declare var" do + it "types declare var" do + assert_type("a :: Int32") { int32 } + end + + it "types declare var and reads it" do + assert_type("a :: Int32; a") { int32 } + end + + it "types declare var and changes its type" do + assert_type("a :: Int32; while 1 == 2; a = 'a'; end; a") { union_of(int32, char) } + end + + it "declares instance var which appears in initialize" do + result = assert_type(" + class Foo + @x :: Int32 + end + + Foo.new") { types["Foo"] } + + mod = result.program + + foo = mod.types["Foo"] as NonGenericClassType + foo.instance_vars["@x"].type.should eq(mod.int32) + end + + it "declares instance var of generic class" do + result = assert_type(" + class Foo(T) + @x :: T + end + + Foo(Int32).new") do + foo = types["Foo"] as GenericClassType + foo_i32 = foo.instantiate([int32] of Type | ASTNode) + foo_i32.lookup_instance_var("@x").type.should eq(int32) + foo_i32 + end + end + + it "declares instance var of generic class after reopen" do + result = assert_type(" + class Foo(T) + end + + f = Foo(Int32).new + + class Foo(T) + @x :: T + end + + f") do + foo = types["Foo"] as GenericClassType + foo_i32 = foo.instantiate([int32] of Type | ASTNode) + foo_i32.lookup_instance_var("@x").type.should eq(int32) + foo_i32 + end + end + + it "declares an instance variable in initialize" do + assert_type(" + class Foo + def initialize + @x :: Int32 + end + + def x + @x + end + end + + Foo.new.x + ") { int32 } + end +end diff --git a/samples/Crystal/transformer.cr b/samples/Crystal/transformer.cr new file mode 100644 index 00000000..8bb78fbe --- /dev/null +++ b/samples/Crystal/transformer.cr @@ -0,0 +1,515 @@ +module Crystal + class ASTNode + def transform(transformer) + transformer.before_transform self + node = transformer.transform self + transformer.after_transform self + node + end + end + + class Transformer + def before_transform(node) + end + + def after_transform(node) + end + + def transform(node : Expressions) + exps = [] of ASTNode + node.expressions.each do |exp| + new_exp = exp.transform(self) + if new_exp + if new_exp.is_a?(Expressions) + exps.concat new_exp.expressions + else + exps << new_exp + end + end + end + + if exps.length == 1 + exps[0] + else + node.expressions = exps + node + end + end + + def transform(node : Call) + if node_obj = node.obj + node.obj = node_obj.transform(self) + end + transform_many node.args + + if node_block = node.block + node.block = node_block.transform(self) + end + + if node_block_arg = node.block_arg + node.block_arg = node_block_arg.transform(self) + end + + node + end + + def transform(node : And) + node.left = node.left.transform(self) + node.right = node.right.transform(self) + node + end + + def transform(node : Or) + node.left = node.left.transform(self) + node.right = node.right.transform(self) + node + end + + def transform(node : StringInterpolation) + transform_many node.expressions + node + end + + def transform(node : ArrayLiteral) + transform_many node.elements + + if node_of = node.of + node.of = node_of.transform(self) + end + + node + end + + def transform(node : HashLiteral) + transform_many node.keys + transform_many node.values + + if of_key = node.of_key + node.of_key = of_key.transform(self) + end + + if of_value = node.of_value + node.of_value = of_value.transform(self) + end + + node + end + + def transform(node : If) + node.cond = node.cond.transform(self) + node.then = node.then.transform(self) + node.else = node.else.transform(self) + node + end + + def transform(node : Unless) + node.cond = node.cond.transform(self) + node.then = node.then.transform(self) + node.else = node.else.transform(self) + node + end + + def transform(node : IfDef) + node.cond = node.cond.transform(self) + node.then = node.then.transform(self) + node.else = node.else.transform(self) + node + end + + def transform(node : MultiAssign) + transform_many node.targets + transform_many node.values + node + end + + def transform(node : SimpleOr) + node.left = node.left.transform(self) + node.right = node.right.transform(self) + node + end + + def transform(node : Def) + transform_many node.args + node.body = node.body.transform(self) + + if receiver = node.receiver + node.receiver = receiver.transform(self) + end + + if block_arg = node.block_arg + node.block_arg = block_arg.transform(self) + end + + node + end + + def transform(node : Macro) + transform_many node.args + node.body = node.body.transform(self) + + if receiver = node.receiver + node.receiver = receiver.transform(self) + end + + if block_arg = node.block_arg + node.block_arg = block_arg.transform(self) + end + + node + end + + def transform(node : PointerOf) + node.exp = node.exp.transform(self) + node + end + + def transform(node : SizeOf) + node.exp = node.exp.transform(self) + node + end + + def transform(node : InstanceSizeOf) + node.exp = node.exp.transform(self) + node + end + + def transform(node : IsA) + node.obj = node.obj.transform(self) + node.const = node.const.transform(self) + node + end + + def transform(node : RespondsTo) + node.obj = node.obj.transform(self) + node + end + + def transform(node : Case) + node.cond = node.cond.transform(self) + transform_many node.whens + + if node_else = node.else + node.else = node_else.transform(self) + end + + node + end + + def transform(node : When) + transform_many node.conds + node.body = node.body.transform(self) + node + end + + def transform(node : ImplicitObj) + node + end + + def transform(node : ClassDef) + node.body = node.body.transform(self) + + if superclass = node.superclass + node.superclass = superclass.transform(self) + end + + node + end + + def transform(node : ModuleDef) + node.body = node.body.transform(self) + node + end + + def transform(node : While) + node.cond = node.cond.transform(self) + node.body = node.body.transform(self) + node + end + + def transform(node : Generic) + node.name = node.name.transform(self) + transform_many node.type_vars + node + end + + def transform(node : ExceptionHandler) + node.body = node.body.transform(self) + transform_many node.rescues + + if node_ensure = node.ensure + node.ensure = node_ensure.transform(self) + end + + node + end + + def transform(node : Rescue) + node.body = node.body.transform(self) + transform_many node.types + node + end + + def transform(node : Union) + transform_many node.types + node + end + + def transform(node : Hierarchy) + node.name = node.name.transform(self) + node + end + + def transform(node : Metaclass) + node.name = node.name.transform(self) + node + end + + def transform(node : Arg) + if default_value = node.default_value + node.default_value = default_value.transform(self) + end + + if restriction = node.restriction + node.restriction = restriction.transform(self) + end + + node + end + + def transform(node : BlockArg) + node.fun = node.fun.transform(self) + node + end + + def transform(node : Fun) + transform_many node.inputs + + if output = node.output + node.output = output.transform(self) + end + + node + end + + def transform(node : Block) + node.args.map! { |exp| exp.transform(self) as Var } + node.body = node.body.transform(self) + node + end + + def transform(node : FunLiteral) + node.def.body = node.def.body.transform(self) + node + end + + def transform(node : FunPointer) + if obj = node.obj + node.obj = obj.transform(self) + end + node + end + + def transform(node : Return) + transform_many node.exps + node + end + + def transform(node : Break) + transform_many node.exps + node + end + + def transform(node : Next) + transform_many node.exps + node + end + + def transform(node : Yield) + if scope = node.scope + node.scope = scope.transform(self) + end + transform_many node.exps + node + end + + def transform(node : Include) + node.name = node.name.transform(self) + node + end + + def transform(node : Extend) + node.name = node.name.transform(self) + node + end + + def transform(node : RangeLiteral) + node.from = node.from.transform(self) + node.to = node.to.transform(self) + node + end + + def transform(node : Assign) + node.target = node.target.transform(self) + node.value = node.value.transform(self) + node + end + + def transform(node : Nop) + node + end + + def transform(node : NilLiteral) + node + end + + def transform(node : BoolLiteral) + node + end + + def transform(node : NumberLiteral) + node + end + + def transform(node : CharLiteral) + node + end + + def transform(node : StringLiteral) + node + end + + def transform(node : SymbolLiteral) + node + end + + def transform(node : RegexLiteral) + node + end + + def transform(node : Var) + node + end + + def transform(node : MetaVar) + node + end + + def transform(node : InstanceVar) + node + end + + def transform(node : ClassVar) + node + end + + def transform(node : Global) + node + end + + def transform(node : Require) + node + end + + def transform(node : Path) + node + end + + def transform(node : Self) + node + end + + def transform(node : LibDef) + node.body = node.body.transform(self) + node + end + + def transform(node : FunDef) + if body = node.body + node.body = body.transform(self) + end + node + end + + def transform(node : TypeDef) + node + end + + def transform(node : StructDef) + node + end + + def transform(node : UnionDef) + node + end + + def transform(node : EnumDef) + node + end + + def transform(node : ExternalVar) + node + end + + def transform(node : IndirectRead) + node.obj = node.obj.transform(self) + node + end + + def transform(node : IndirectWrite) + node.obj = node.obj.transform(self) + node.value = node.value.transform(self) + node + end + + def transform(node : TypeOf) + transform_many node.expressions + node + end + + def transform(node : Primitive) + node + end + + def transform(node : Not) + node + end + + def transform(node : TypeFilteredNode) + node + end + + def transform(node : TupleLiteral) + transform_many node.exps + node + end + + def transform(node : Cast) + node.obj = node.obj.transform(self) + node.to = node.to.transform(self) + node + end + + def transform(node : DeclareVar) + node.var = node.var.transform(self) + node.declared_type = node.declared_type.transform(self) + node + end + + def transform(node : Alias) + node.value = node.value.transform(self) + node + end + + def transform(node : TupleIndexer) + node + end + + def transform(node : Attribute) + node + end + + def transform_many(exps) + exps.map! { |exp| exp.transform(self) } if exps + end + end +end diff --git a/samples/Dogescript/example.djs b/samples/Dogescript/example.djs new file mode 100644 index 00000000..6903cc5a --- /dev/null +++ b/samples/Dogescript/example.djs @@ -0,0 +1,16 @@ +quiet + wow + such language + very syntax + github recognized wow +loud + +such language much friendly + rly friendly is true + plz console.loge with 'such friend, very inclusive' + but + plz console.loge with 'no love for doge' + wow +wow + +module.exports is language \ No newline at end of file diff --git a/samples/E/Extends.E b/samples/E/Extends.E new file mode 100644 index 00000000..002a9105 --- /dev/null +++ b/samples/E/Extends.E @@ -0,0 +1,31 @@ +# from +# http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/Objects_and_Functions +def makeVehicle(self) { + def vehicle { + to milesTillEmpty() { + return self.milesPerGallon() * self.getFuelRemaining() + } + } + return vehicle +} + +def makeCar() { + var fuelRemaining := 20 + def car extends makeVehicle(car) { + to milesPerGallon() {return 19} + to getFuelRemaining() {return fuelRemaining} + } + return car +} + +def makeJet() { + var fuelRemaining := 2000 + def jet extends makeVehicle(jet) { + to milesPerGallon() {return 2} + to getFuelRemaining() {return fuelRemaining} + } + return jet +} + +def car := makeCar() +println(`The car can go ${car.milesTillEmpty()} miles.`) diff --git a/samples/E/Functions.E b/samples/E/Functions.E new file mode 100644 index 00000000..086e4f7a --- /dev/null +++ b/samples/E/Functions.E @@ -0,0 +1,21 @@ +# from +# http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/Objects_and_Functions +def makeCar(var name) { + var x := 0 + var y := 0 + def car { + to moveTo(newX,newY) { + x := newX + y := newY + } + to getX() {return x} + to getY() {return y} + to setName(newName) {name := newName} + to getName() {return name} + } + return car +} +# Now use the makeCar function to make a car, which we will move and print +def sportsCar := makeCar("Ferrari") +sportsCar.moveTo(10,20) +println(`The car ${sportsCar.getName()} is at X location ${sportsCar.getX()}`) diff --git a/samples/E/Guards.E b/samples/E/Guards.E new file mode 100644 index 00000000..e3e841ae --- /dev/null +++ b/samples/E/Guards.E @@ -0,0 +1,69 @@ +# from +# http://wiki.erights.org/wiki/Walnut/Advanced_Topics/Build_your_Own_Guards +def makeVOCPair(brandName :String) :near { + + var myTempContents := def none {} + + def brand { + to __printOn(out :TextWriter) :void { + out.print(brandName) + } + } + + def ProveAuth { + to __printOn(out :TextWriter) :void { + out.print(`<$brandName prover>`) + } + to getBrand() :near { return brand } + to coerce(specimen, optEjector) :near { + def sealedBox { + to getBrand() :near { return brand } + to offerContent() :void { + myTempContents := specimen + } + } + return sealedBox + } + } + def CheckAuth { + to __printOn(out :TextWriter) :void { + out.print(`<$brandName checker template>`) + } + to getBrand() :near { return brand } + match [`get`, authList :any[]] { + def checker { + to __printOn(out :TextWriter) :void { + out.print(`<$brandName checker>`) + } + to getBrand() :near { return brand } + to coerce(specimenBox, optEjector) :any { + myTempContents := null + if (specimenBox.__respondsTo("offerContent", 0)) { + # XXX Using __respondsTo/2 here is a kludge + specimenBox.offerContent() + } else { + myTempContents := specimenBox + } + for auth in authList { + if (auth == myTempContents) { + return auth + } + } + myTempContents := none + throw.eject(optEjector, + `Unmatched $brandName authorization`) + } + } + } + match [`__respondsTo`, [`get`, _]] { + true + } + match [`__respondsTo`, [_, _]] { + false + } + match [`__getAllegedType`, []] { + null.__getAllegedType() + } + } + return [ProveAuth, CheckAuth] +} diff --git a/samples/E/IO.E b/samples/E/IO.E new file mode 100644 index 00000000..e96e41ad --- /dev/null +++ b/samples/E/IO.E @@ -0,0 +1,14 @@ +# E sample from +# http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/InputOutput +#File objects for hardwired files: +def file1 := +def file2 := + +#Using a variable for a file name: +def filePath := "c:\\docs\\myFile.txt" +def file3 := [filePath] + +#Using a single character to specify a Windows drive +def file4 := +def file5 := +def file6 := diff --git a/samples/E/Promises.E b/samples/E/Promises.E new file mode 100644 index 00000000..ae03c6ec --- /dev/null +++ b/samples/E/Promises.E @@ -0,0 +1,9 @@ +# E snippet from +# http://wiki.erights.org/wiki/Walnut/Distributed_Computing/Promises +when (tempVow) -> { + #...use tempVow +} catch prob { + #.... report problem +} finally { + #....log event +} diff --git a/samples/E/minChat.E b/samples/E/minChat.E new file mode 100644 index 00000000..b422a71e --- /dev/null +++ b/samples/E/minChat.E @@ -0,0 +1,18 @@ +# from +# http://wiki.erights.org/wiki/Walnut/Secure_Distributed_Computing/Auditing_minChat +pragma.syntax("0.9") +to send(message) { + when (friend<-receive(message)) -> { + chatUI.showMessage("self", message) + } catch prob {chatUI.showMessage("system", "connection lost")} +} +to receive(message) {chatUI.showMessage("friend", message)} +to receiveFriend(friendRcvr) { + bind friend := friendRcvr + chatUI.showMessage("system", "friend has arrived") +} +to save(file) {file.setText(makeURIFromObject(chatController))} +to load(file) { + bind friend := getObjectFromURI(file.getText()) + friend <- receiveFriend(chatController) +} diff --git a/samples/Eagle/Eagle.brd b/samples/Eagle/Eagle.brd new file mode 100644 index 00000000..27f3cbdd --- /dev/null +++ b/samples/Eagle/Eagle.brd @@ -0,0 +1,1396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>Resistors, Capacitors, Inductors</b><p> +Based on the previous libraries: +<ul> +<li>r.lbr +<li>cap.lbr +<li>cap-fe.lbr +<li>captant.lbr +<li>polcap.lbr +<li>ipc-smd.lbr +</ul> +All SMD packages are defined according to the IPC specifications and CECC<p> +<author>Created by librarian@cadsoft.de</author><p> +<p> +for Electrolyt Capacitors see also :<p> +www.bccomponents.com <p> +www.panasonic.com<p> +www.kemet.com<p> +http://www.secc.co.jp/pdf/os_e/2004/e_os_all.pdf <b>(SANYO)</b> +<p> +for trimmer refence see : <u>www.electrospec-inc.com/cross_references/trimpotcrossref.asp</u><p> + +<table border=0 cellspacing=0 cellpadding=0 width="100%" cellpaddding=0> +<tr valign="top"> + +<! <td width="10">&nbsp;</td> +<td width="90%"> + +<b><font color="#0000FF" size="4">TRIM-POT CROSS REFERENCE</font></b> +<P> +<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2> + <TR> + <TD COLSPAN=8> + <FONT SIZE=3 FACE=ARIAL><B>RECTANGULAR MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">BOURNS</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">BI&nbsp;TECH</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">DALE-VISHAY</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">PHILIPS/MEPCO</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">MURATA</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">PANASONIC</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">SPECTROL</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">MILSPEC</FONT> + </B> + </TD><TD>&nbsp;</TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3 > + 3005P<BR> + 3006P<BR> + 3006W<BR> + 3006Y<BR> + 3009P<BR> + 3009W<BR> + 3009Y<BR> + 3057J<BR> + 3057L<BR> + 3057P<BR> + 3057Y<BR> + 3059J<BR> + 3059L<BR> + 3059P<BR> + 3059Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 89P<BR> + 89W<BR> + 89X<BR> + 89PH<BR> + 76P<BR> + 89XH<BR> + 78SLT<BR> + 78L&nbsp;ALT<BR> + 56P&nbsp;ALT<BR> + 78P&nbsp;ALT<BR> + T8S<BR> + 78L<BR> + 56P<BR> + 78P<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + T18/784<BR> + 783<BR> + 781<BR> + -<BR> + -<BR> + -<BR> + 2199<BR> + 1697/1897<BR> + 1680/1880<BR> + 2187<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 8035EKP/CT20/RJ-20P<BR> + -<BR> + RJ-20X<BR> + -<BR> + -<BR> + -<BR> + 1211L<BR> + 8012EKQ&nbsp;ALT<BR> + 8012EKR&nbsp;ALT<BR> + 1211P<BR> + 8012EKJ<BR> + 8012EKL<BR> + 8012EKQ<BR> + 8012EKR<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 2101P<BR> + 2101W<BR> + 2101Y<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 2102L<BR> + 2102S<BR> + 2102Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + EVMCOG<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 43P<BR> + 43W<BR> + 43Y<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 40L<BR> + 40P<BR> + 40Y<BR> + 70Y-T602<BR> + 70L<BR> + 70P<BR> + 70Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + RT/RTR12<BR> + RT/RTR12<BR> + RT/RTR12<BR> + -<BR> + RJ/RJR12<BR> + RJ/RJR12<BR> + RJ/RJR12<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=8>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=8> + <FONT SIZE=4 FACE=ARIAL><B>SQUARE MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BOURN</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MURATA</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>SPECTROL</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MILSPEC</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3250L<BR> + 3250P<BR> + 3250W<BR> + 3250X<BR> + 3252P<BR> + 3252W<BR> + 3252X<BR> + 3260P<BR> + 3260W<BR> + 3260X<BR> + 3262P<BR> + 3262W<BR> + 3262X<BR> + 3266P<BR> + 3266W<BR> + 3266X<BR> + 3290H<BR> + 3290P<BR> + 3290W<BR> + 3292P<BR> + 3292W<BR> + 3292X<BR> + 3296P<BR> + 3296W<BR> + 3296X<BR> + 3296Y<BR> + 3296Z<BR> + 3299P<BR> + 3299W<BR> + 3299X<BR> + 3299Y<BR> + 3299Z<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66X&nbsp;ALT<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66X&nbsp;ALT<BR> + -<BR> + 64W&nbsp;ALT<BR> + -<BR> + 64P&nbsp;ALT<BR> + 64W&nbsp;ALT<BR> + 64X&nbsp;ALT<BR> + 64P<BR> + 64W<BR> + 64X<BR> + 66X&nbsp;ALT<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66P<BR> + 66W<BR> + 66X<BR> + 67P<BR> + 67W<BR> + 67X<BR> + 67Y<BR> + 67Z<BR> + 68P<BR> + 68W<BR> + 68X<BR> + 67Y&nbsp;ALT<BR> + 67Z&nbsp;ALT<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 5050<BR> + 5091<BR> + 5080<BR> + 5087<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + T63YB<BR> + T63XB<BR> + -<BR> + -<BR> + -<BR> + 5887<BR> + 5891<BR> + 5880<BR> + -<BR> + -<BR> + -<BR> + T93Z<BR> + T93YA<BR> + T93XA<BR> + T93YB<BR> + T93XB<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 8026EKP<BR> + 8026EKW<BR> + 8026EKM<BR> + 8026EKP<BR> + 8026EKB<BR> + 8026EKM<BR> + 1309X<BR> + 1309P<BR> + 1309W<BR> + 8024EKP<BR> + 8024EKW<BR> + 8024EKN<BR> + RJ-9P/CT9P<BR> + RJ-9W<BR> + RJ-9X<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3103P<BR> + 3103Y<BR> + 3103Z<BR> + 3103P<BR> + 3103Y<BR> + 3103Z<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3105P/3106P<BR> + 3105W/3106W<BR> + 3105X/3106X<BR> + 3105Y/3106Y<BR> + 3105Z/3105Z<BR> + 3102P<BR> + 3102W<BR> + 3102X<BR> + 3102Y<BR> + 3102Z<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + EVMCBG<BR> + EVMCCG<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 55-1-X<BR> + 55-4-X<BR> + 55-3-X<BR> + 55-2-X<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 50-2-X<BR> + 50-4-X<BR> + 50-3-X<BR> + -<BR> + -<BR> + -<BR> + 64P<BR> + 64W<BR> + 64X<BR> + 64Y<BR> + 64Z<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + RT/RTR22<BR> + RT/RTR22<BR> + RT/RTR22<BR> + RT/RTR22<BR> + RJ/RJR22<BR> + RJ/RJR22<BR> + RJ/RJR22<BR> + RT/RTR26<BR> + RT/RTR26<BR> + RT/RTR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RT/RTR24<BR> + RT/RTR24<BR> + RT/RTR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=8>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=8> + <FONT SIZE=4 FACE=ARIAL><B>SINGLE TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BOURN</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MURATA</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>SPECTROL</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MILSPEC</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3323P<BR> + 3323S<BR> + 3323W<BR> + 3329H<BR> + 3329P<BR> + 3329W<BR> + 3339H<BR> + 3339P<BR> + 3339W<BR> + 3352E<BR> + 3352H<BR> + 3352K<BR> + 3352P<BR> + 3352T<BR> + 3352V<BR> + 3352W<BR> + 3362H<BR> + 3362M<BR> + 3362P<BR> + 3362R<BR> + 3362S<BR> + 3362U<BR> + 3362W<BR> + 3362X<BR> + 3386B<BR> + 3386C<BR> + 3386F<BR> + 3386H<BR> + 3386K<BR> + 3386M<BR> + 3386P<BR> + 3386S<BR> + 3386W<BR> + 3386X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 25P<BR> + 25S<BR> + 25RX<BR> + 82P<BR> + 82M<BR> + 82PA<BR> + -<BR> + -<BR> + -<BR> + 91E<BR> + 91X<BR> + 91T<BR> + 91B<BR> + 91A<BR> + 91V<BR> + 91W<BR> + 25W<BR> + 25V<BR> + 25P<BR> + -<BR> + 25S<BR> + 25U<BR> + 25RX<BR> + 25X<BR> + 72XW<BR> + 72XL<BR> + 72PM<BR> + 72RX<BR> + -<BR> + 72PX<BR> + 72P<BR> + 72RXW<BR> + 72RXL<BR> + 72X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + T7YB<BR> + T7YA<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + TXD<BR> + TYA<BR> + TYP<BR> + -<BR> + TYD<BR> + TX<BR> + -<BR> + 150SX<BR> + 100SX<BR> + 102T<BR> + 101S<BR> + 190T<BR> + 150TX<BR> + 101<BR> + -<BR> + -<BR> + 101SX<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ET6P<BR> + ET6S<BR> + ET6X<BR> + RJ-6W/8014EMW<BR> + RJ-6P/8014EMP<BR> + RJ-6X/8014EMX<BR> + TM7W<BR> + TM7P<BR> + TM7X<BR> + -<BR> + 8017SMS<BR> + -<BR> + 8017SMB<BR> + 8017SMA<BR> + -<BR> + -<BR> + CT-6W<BR> + CT-6H<BR> + CT-6P<BR> + CT-6R<BR> + -<BR> + CT-6V<BR> + CT-6X<BR> + -<BR> + -<BR> + 8038EKV<BR> + -<BR> + 8038EKX<BR> + -<BR> + -<BR> + 8038EKP<BR> + 8038EKZ<BR> + 8038EKW<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + 3321H<BR> + 3321P<BR> + 3321N<BR> + 1102H<BR> + 1102P<BR> + 1102T<BR> + RVA0911V304A<BR> + -<BR> + RVA0911H413A<BR> + RVG0707V100A<BR> + RVA0607V(H)306A<BR> + RVA1214H213A<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3104B<BR> + 3104C<BR> + 3104F<BR> + 3104H<BR> + -<BR> + 3104M<BR> + 3104P<BR> + 3104S<BR> + 3104W<BR> + 3104X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + EVMQ0G<BR> + EVMQIG<BR> + EVMQ3G<BR> + EVMS0G<BR> + EVMQ0G<BR> + EVMG0G<BR> + -<BR> + -<BR> + -<BR> + EVMK4GA00B<BR> + EVM30GA00B<BR> + EVMK0GA00B<BR> + EVM38GA00B<BR> + EVMB6<BR> + EVLQ0<BR> + -<BR> + EVMMSG<BR> + EVMMBG<BR> + EVMMAG<BR> + -<BR> + -<BR> + EVMMCS<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + EVMM1<BR> + -<BR> + -<BR> + EVMM0<BR> + -<BR> + -<BR> + EVMM3<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + 62-3-1<BR> + 62-1-2<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 67R<BR> + -<BR> + 67P<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 67X<BR> + 63V<BR> + 63S<BR> + 63M<BR> + -<BR> + -<BR> + 63H<BR> + 63P<BR> + -<BR> + -<BR> + 63X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + RJ/RJR50<BR> + RJ/RJR50<BR> + RJ/RJR50<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> +</TABLE> +<P>&nbsp;<P> +<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3> + <TR> + <TD COLSPAN=7> + <FONT color="#0000FF" SIZE=4 FACE=ARIAL><B>SMD TRIM-POT CROSS REFERENCE</B></FONT> + <P> + <FONT SIZE=4 FACE=ARIAL><B>MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BOURNS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>TOCOS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>AUX/KYOCERA</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3224G<BR> + 3224J<BR> + 3224W<BR> + 3269P<BR> + 3269W<BR> + 3269X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 44G<BR> + 44J<BR> + 44W<BR> + 84P<BR> + 84W<BR> + 84X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + ST63Z<BR> + ST63Y<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + ST5P<BR> + ST5W<BR> + ST5X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=7>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=7> + <FONT SIZE=4 FACE=ARIAL><B>SINGLE TURN</B></FONT> + </TD> + </TR> + <TR> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BOURNS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>TOCOS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>AUX/KYOCERA</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3314G<BR> + 3314J<BR> + 3364A/B<BR> + 3364C/D<BR> + 3364W/X<BR> + 3313G<BR> + 3313J<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 23B<BR> + 23A<BR> + 21X<BR> + 21W<BR> + -<BR> + 22B<BR> + 22A<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ST5YL/ST53YL<BR> + ST5YJ/5T53YJ<BR> + ST-23A<BR> + ST-22B<BR> + ST-22<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ST-4B<BR> + ST-4A<BR> + -<BR> + -<BR> + -<BR> + ST-3B<BR> + ST-3A<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + EVM-6YS<BR> + EVM-1E<BR> + EVM-1G<BR> + EVM-1D<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + G4B<BR> + G4A<BR> + TR04-3S1<BR> + TRG04-2S1<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + DVR-43A<BR> + CVR-42C<BR> + CVR-42A/C<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> +</TABLE> +<P> +<FONT SIZE=4 FACE=ARIAL><B>ALT =&nbsp;ALTERNATE</B></FONT> +<P> + +&nbsp; +<P> +</td> +</tr> +</table> + + +<b>RESISTOR</b><p> + + + + + + + + +>NAME +>VALUE + + + + + + + +<b>Pin Header Connectors</b><p> +<author>Created by librarian@cadsoft.de</author> + + +<b>PIN HEADER</b> + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +<b>EAGLE Design Rules</b> +<p> +Die Standard-Design-Rules sind so gewählt, dass sie für +die meisten Anwendungen passen. Sollte ihre Platine +besondere Anforderungen haben, treffen Sie die erforderlichen +Einstellungen hier und speichern die Design Rules unter +einem neuen Namen ab. +<b>EAGLE Design Rules</b> +<p> +The default Design Rules have been set to cover +a wide range of applications. Your particular design +may have different requirements, so please make the +necessary adjustments and save your customized +design rules under a new name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/Eagle/Eagle.sch b/samples/Eagle/Eagle.sch new file mode 100644 index 00000000..5a72a868 --- /dev/null +++ b/samples/Eagle/Eagle.sch @@ -0,0 +1,3612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>Frames for Sheet and Layout</b> + + + + + + + + + + + + + + + + + + + + +>DRAWING_NAME +>LAST_DATE_TIME +>SHEET +Sheet: + + + + + +<b>FRAME</b><p> +DIN A4, landscape with location and doc. field + + + + + + + + + + + + + + +<b>Resistors, Capacitors, Inductors</b><p> +Based on the previous libraries: +<ul> +<li>r.lbr +<li>cap.lbr +<li>cap-fe.lbr +<li>captant.lbr +<li>polcap.lbr +<li>ipc-smd.lbr +</ul> +All SMD packages are defined according to the IPC specifications and CECC<p> +<author>Created by librarian@cadsoft.de</author><p> +<p> +for Electrolyt Capacitors see also :<p> +www.bccomponents.com <p> +www.panasonic.com<p> +www.kemet.com<p> +http://www.secc.co.jp/pdf/os_e/2004/e_os_all.pdf <b>(SANYO)</b> +<p> +for trimmer refence see : <u>www.electrospec-inc.com/cross_references/trimpotcrossref.asp</u><p> + +<table border=0 cellspacing=0 cellpadding=0 width="100%" cellpaddding=0> +<tr valign="top"> + +<! <td width="10">&nbsp;</td> +<td width="90%"> + +<b><font color="#0000FF" size="4">TRIM-POT CROSS REFERENCE</font></b> +<P> +<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2> + <TR> + <TD COLSPAN=8> + <FONT SIZE=3 FACE=ARIAL><B>RECTANGULAR MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">BOURNS</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">BI&nbsp;TECH</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">DALE-VISHAY</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">PHILIPS/MEPCO</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">MURATA</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">PANASONIC</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">SPECTROL</FONT> + </B> + </TD> + <TD ALIGN=CENTER> + <B> + <FONT SIZE=3 FACE=ARIAL color="#FF0000">MILSPEC</FONT> + </B> + </TD><TD>&nbsp;</TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3 > + 3005P<BR> + 3006P<BR> + 3006W<BR> + 3006Y<BR> + 3009P<BR> + 3009W<BR> + 3009Y<BR> + 3057J<BR> + 3057L<BR> + 3057P<BR> + 3057Y<BR> + 3059J<BR> + 3059L<BR> + 3059P<BR> + 3059Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 89P<BR> + 89W<BR> + 89X<BR> + 89PH<BR> + 76P<BR> + 89XH<BR> + 78SLT<BR> + 78L&nbsp;ALT<BR> + 56P&nbsp;ALT<BR> + 78P&nbsp;ALT<BR> + T8S<BR> + 78L<BR> + 56P<BR> + 78P<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + T18/784<BR> + 783<BR> + 781<BR> + -<BR> + -<BR> + -<BR> + 2199<BR> + 1697/1897<BR> + 1680/1880<BR> + 2187<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 8035EKP/CT20/RJ-20P<BR> + -<BR> + RJ-20X<BR> + -<BR> + -<BR> + -<BR> + 1211L<BR> + 8012EKQ&nbsp;ALT<BR> + 8012EKR&nbsp;ALT<BR> + 1211P<BR> + 8012EKJ<BR> + 8012EKL<BR> + 8012EKQ<BR> + 8012EKR<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 2101P<BR> + 2101W<BR> + 2101Y<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 2102L<BR> + 2102S<BR> + 2102Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + EVMCOG<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 43P<BR> + 43W<BR> + 43Y<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 40L<BR> + 40P<BR> + 40Y<BR> + 70Y-T602<BR> + 70L<BR> + 70P<BR> + 70Y<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + RT/RTR12<BR> + RT/RTR12<BR> + RT/RTR12<BR> + -<BR> + RJ/RJR12<BR> + RJ/RJR12<BR> + RJ/RJR12<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=8>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=8> + <FONT SIZE=4 FACE=ARIAL><B>SQUARE MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BOURN</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MURATA</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>SPECTROL</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MILSPEC</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3250L<BR> + 3250P<BR> + 3250W<BR> + 3250X<BR> + 3252P<BR> + 3252W<BR> + 3252X<BR> + 3260P<BR> + 3260W<BR> + 3260X<BR> + 3262P<BR> + 3262W<BR> + 3262X<BR> + 3266P<BR> + 3266W<BR> + 3266X<BR> + 3290H<BR> + 3290P<BR> + 3290W<BR> + 3292P<BR> + 3292W<BR> + 3292X<BR> + 3296P<BR> + 3296W<BR> + 3296X<BR> + 3296Y<BR> + 3296Z<BR> + 3299P<BR> + 3299W<BR> + 3299X<BR> + 3299Y<BR> + 3299Z<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66X&nbsp;ALT<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66X&nbsp;ALT<BR> + -<BR> + 64W&nbsp;ALT<BR> + -<BR> + 64P&nbsp;ALT<BR> + 64W&nbsp;ALT<BR> + 64X&nbsp;ALT<BR> + 64P<BR> + 64W<BR> + 64X<BR> + 66X&nbsp;ALT<BR> + 66P&nbsp;ALT<BR> + 66W&nbsp;ALT<BR> + 66P<BR> + 66W<BR> + 66X<BR> + 67P<BR> + 67W<BR> + 67X<BR> + 67Y<BR> + 67Z<BR> + 68P<BR> + 68W<BR> + 68X<BR> + 67Y&nbsp;ALT<BR> + 67Z&nbsp;ALT<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 5050<BR> + 5091<BR> + 5080<BR> + 5087<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + T63YB<BR> + T63XB<BR> + -<BR> + -<BR> + -<BR> + 5887<BR> + 5891<BR> + 5880<BR> + -<BR> + -<BR> + -<BR> + T93Z<BR> + T93YA<BR> + T93XA<BR> + T93YB<BR> + T93XB<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 8026EKP<BR> + 8026EKW<BR> + 8026EKM<BR> + 8026EKP<BR> + 8026EKB<BR> + 8026EKM<BR> + 1309X<BR> + 1309P<BR> + 1309W<BR> + 8024EKP<BR> + 8024EKW<BR> + 8024EKN<BR> + RJ-9P/CT9P<BR> + RJ-9W<BR> + RJ-9X<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3103P<BR> + 3103Y<BR> + 3103Z<BR> + 3103P<BR> + 3103Y<BR> + 3103Z<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3105P/3106P<BR> + 3105W/3106W<BR> + 3105X/3106X<BR> + 3105Y/3106Y<BR> + 3105Z/3105Z<BR> + 3102P<BR> + 3102W<BR> + 3102X<BR> + 3102Y<BR> + 3102Z<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + EVMCBG<BR> + EVMCCG<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 55-1-X<BR> + 55-4-X<BR> + 55-3-X<BR> + 55-2-X<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 50-2-X<BR> + 50-4-X<BR> + 50-3-X<BR> + -<BR> + -<BR> + -<BR> + 64P<BR> + 64W<BR> + 64X<BR> + 64Y<BR> + 64Z<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + RT/RTR22<BR> + RT/RTR22<BR> + RT/RTR22<BR> + RT/RTR22<BR> + RJ/RJR22<BR> + RJ/RJR22<BR> + RJ/RJR22<BR> + RT/RTR26<BR> + RT/RTR26<BR> + RT/RTR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RJ/RJR26<BR> + RT/RTR24<BR> + RT/RTR24<BR> + RT/RTR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + RJ/RJR24<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=8>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=8> + <FONT SIZE=4 FACE=ARIAL><B>SINGLE TURN</B></FONT> + </TD> + </TR> + <TR> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BOURN</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MURATA</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>SPECTROL</B></FONT> + </TD> + <TD ALIGN=CENTER> + <FONT SIZE=3 FACE=ARIAL><B>MILSPEC</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3323P<BR> + 3323S<BR> + 3323W<BR> + 3329H<BR> + 3329P<BR> + 3329W<BR> + 3339H<BR> + 3339P<BR> + 3339W<BR> + 3352E<BR> + 3352H<BR> + 3352K<BR> + 3352P<BR> + 3352T<BR> + 3352V<BR> + 3352W<BR> + 3362H<BR> + 3362M<BR> + 3362P<BR> + 3362R<BR> + 3362S<BR> + 3362U<BR> + 3362W<BR> + 3362X<BR> + 3386B<BR> + 3386C<BR> + 3386F<BR> + 3386H<BR> + 3386K<BR> + 3386M<BR> + 3386P<BR> + 3386S<BR> + 3386W<BR> + 3386X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 25P<BR> + 25S<BR> + 25RX<BR> + 82P<BR> + 82M<BR> + 82PA<BR> + -<BR> + -<BR> + -<BR> + 91E<BR> + 91X<BR> + 91T<BR> + 91B<BR> + 91A<BR> + 91V<BR> + 91W<BR> + 25W<BR> + 25V<BR> + 25P<BR> + -<BR> + 25S<BR> + 25U<BR> + 25RX<BR> + 25X<BR> + 72XW<BR> + 72XL<BR> + 72PM<BR> + 72RX<BR> + -<BR> + 72PX<BR> + 72P<BR> + 72RXW<BR> + 72RXL<BR> + 72X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + T7YB<BR> + T7YA<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + TXD<BR> + TYA<BR> + TYP<BR> + -<BR> + TYD<BR> + TX<BR> + -<BR> + 150SX<BR> + 100SX<BR> + 102T<BR> + 101S<BR> + 190T<BR> + 150TX<BR> + 101<BR> + -<BR> + -<BR> + 101SX<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ET6P<BR> + ET6S<BR> + ET6X<BR> + RJ-6W/8014EMW<BR> + RJ-6P/8014EMP<BR> + RJ-6X/8014EMX<BR> + TM7W<BR> + TM7P<BR> + TM7X<BR> + -<BR> + 8017SMS<BR> + -<BR> + 8017SMB<BR> + 8017SMA<BR> + -<BR> + -<BR> + CT-6W<BR> + CT-6H<BR> + CT-6P<BR> + CT-6R<BR> + -<BR> + CT-6V<BR> + CT-6X<BR> + -<BR> + -<BR> + 8038EKV<BR> + -<BR> + 8038EKX<BR> + -<BR> + -<BR> + 8038EKP<BR> + 8038EKZ<BR> + 8038EKW<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + 3321H<BR> + 3321P<BR> + 3321N<BR> + 1102H<BR> + 1102P<BR> + 1102T<BR> + RVA0911V304A<BR> + -<BR> + RVA0911H413A<BR> + RVG0707V100A<BR> + RVA0607V(H)306A<BR> + RVA1214H213A<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 3104B<BR> + 3104C<BR> + 3104F<BR> + 3104H<BR> + -<BR> + 3104M<BR> + 3104P<BR> + 3104S<BR> + 3104W<BR> + 3104X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + EVMQ0G<BR> + EVMQIG<BR> + EVMQ3G<BR> + EVMS0G<BR> + EVMQ0G<BR> + EVMG0G<BR> + -<BR> + -<BR> + -<BR> + EVMK4GA00B<BR> + EVM30GA00B<BR> + EVMK0GA00B<BR> + EVM38GA00B<BR> + EVMB6<BR> + EVLQ0<BR> + -<BR> + EVMMSG<BR> + EVMMBG<BR> + EVMMAG<BR> + -<BR> + -<BR> + EVMMCS<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + EVMM1<BR> + -<BR> + -<BR> + EVMM0<BR> + -<BR> + -<BR> + EVMM3<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + 62-3-1<BR> + 62-1-2<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 67R<BR> + -<BR> + 67P<BR> + -<BR> + -<BR> + -<BR> + -<BR> + 67X<BR> + 63V<BR> + 63S<BR> + 63M<BR> + -<BR> + -<BR> + 63H<BR> + 63P<BR> + -<BR> + -<BR> + 63X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + RJ/RJR50<BR> + RJ/RJR50<BR> + RJ/RJR50<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> +</TABLE> +<P>&nbsp;<P> +<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3> + <TR> + <TD COLSPAN=7> + <FONT color="#0000FF" SIZE=4 FACE=ARIAL><B>SMD TRIM-POT CROSS REFERENCE</B></FONT> + <P> + <FONT SIZE=4 FACE=ARIAL><B>MULTI-TURN</B></FONT> + </TD> + </TR> + <TR> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BOURNS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>TOCOS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>AUX/KYOCERA</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3224G<BR> + 3224J<BR> + 3224W<BR> + 3269P<BR> + 3269W<BR> + 3269X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 44G<BR> + 44J<BR> + 44W<BR> + 84P<BR> + 84W<BR> + 84X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + ST63Z<BR> + ST63Y<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + ST5P<BR> + ST5W<BR> + ST5X<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> + <TR> + <TD COLSPAN=7>&nbsp; + </TD> + </TR> + <TR> + <TD COLSPAN=7> + <FONT SIZE=4 FACE=ARIAL><B>SINGLE TURN</B></FONT> + </TD> + </TR> + <TR> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BOURNS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>BI&nbsp;TECH</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>DALE-VISHAY</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PHILIPS/MEPCO</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>PANASONIC</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>TOCOS</B></FONT> + </TD> + <TD> + <FONT SIZE=3 FACE=ARIAL><B>AUX/KYOCERA</B></FONT> + </TD> + </TR> + <TR> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 3314G<BR> + 3314J<BR> + 3364A/B<BR> + 3364C/D<BR> + 3364W/X<BR> + 3313G<BR> + 3313J<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + 23B<BR> + 23A<BR> + 21X<BR> + 21W<BR> + -<BR> + 22B<BR> + 22A<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ST5YL/ST53YL<BR> + ST5YJ/5T53YJ<BR> + ST-23A<BR> + ST-22B<BR> + ST-22<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + ST-4B<BR> + ST-4A<BR> + -<BR> + -<BR> + -<BR> + ST-3B<BR> + ST-3A<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + EVM-6YS<BR> + EVM-1E<BR> + EVM-1G<BR> + EVM-1D<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + G4B<BR> + G4A<BR> + TR04-3S1<BR> + TRG04-2S1<BR> + -<BR> + -<BR> + -<BR></FONT> + </TD> + <TD BGCOLOR="#cccccc" ALIGN=CENTER><FONT FACE=ARIAL SIZE=3> + -<BR> + -<BR> + DVR-43A<BR> + CVR-42C<BR> + CVR-42A/C<BR> + -<BR> + -<BR></FONT> + </TD> + </TR> +</TABLE> +<P> +<FONT SIZE=4 FACE=ARIAL><B>ALT =&nbsp;ALTERNATE</B></FONT> +<P> + +&nbsp; +<P> +</td> +</tr> +</table> + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> wave soldering<p> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +wave soldering + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +Source: http://download.siliconexpert.com/pdfs/2005/02/24/Semi_Ap/2/VSH/Resistor/dcrcwfre.pdf + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> wave soldering<p> +Source: http://download.siliconexpert.com/pdfs/2005/02/24/Semi_Ap/2/VSH/Resistor/dcrcwfre.pdf + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.10 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.25 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.12 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.10 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.25 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.25 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.12 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +MELF 0.25 W + + + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b><p> +type 0204, grid 5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0204, grid 7.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0207, grid 10 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0207, grid 12 mm + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + +<b>RESISTOR</b><p> +type 0207, grid 15mm + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + +<b>RESISTOR</b><p> +type 0207, grid 2.5 mm + + + + + + + +>NAME +>VALUE + + +<b>RESISTOR</b><p> +type 0207, grid 5 mm + + + + + + + +>NAME +>VALUE + + +<b>RESISTOR</b><p> +type 0207, grid 7.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0309, grid 10mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0309, grid 12.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0411, grid 12.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0411, grid 15 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0411, grid 3.81 mm + + + + + + +>NAME +>VALUE + + + +<b>RESISTOR</b><p> +type 0414, grid 15 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0414, grid 5 mm + + + + + + +>NAME +>VALUE + + + +<b>RESISTOR</b><p> +type 0617, grid 17.5 mm + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0617, grid 22.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0617, grid 5 mm + + + + + + +>NAME +>VALUE + + + +<b>RESISTOR</b><p> +type 0922, grid 22.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + +<b>RESISTOR</b><p> +type 0613, grid 5 mm + + + + + + +>NAME +>VALUE + + + +<b>RESISTOR</b><p> +type 0613, grid 15 mm + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type 0817, grid 22.5 mm + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE +0817 + + + + +<b>RESISTOR</b><p> +type 0817, grid 6.35 mm + + + + + + +>NAME +>VALUE +0817 + + + +<b>RESISTOR</b><p> +type V234, grid 12.5 mm + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type V235, grid 17.78 mm + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR</b><p> +type V526-0, grid 2.5 mm + + + + + + + + + + +>NAME +>VALUE + + +<b>Mini MELF 0102 Axial</b> + + + + +>NAME +>VALUE + + + +<b>RESISTOR</b><p> +type 0922, grid 7.5 mm + + + + + + +>NAME +>VALUE +0922 + + + +<b>CECC Size RC2211</b> Reflow Soldering<p> +source Beyschlag + + + + + + +>NAME +>VALUE + + +<b>CECC Size RC2211</b> Wave Soldering<p> +source Beyschlag + + + + + + +>NAME +>VALUE + + +<b>CECC Size RC3715</b> Reflow Soldering<p> +source Beyschlag + + + + + + + + +>NAME +>VALUE + + +<b>CECC Size RC3715</b> Wave Soldering<p> +source Beyschlag + + + + + + + + +>NAME +>VALUE + + +<b>CECC Size RC6123</b> Reflow Soldering<p> +source Beyschlag + + + + + + + + +>NAME +>VALUE + + +<b>CECC Size RC6123</b> Wave Soldering<p> +source Beyschlag + + + + + + + + +>NAME +>VALUE + + +<b>RESISTOR</b><p> +type RDH, grid 15 mm + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE +RDH + + + + +<b>RESISTOR</b><p> +type 0204, grid 2.5 mm + + + + + + +>NAME +>VALUE + + +<b>RESISTOR</b><p> +type 0309, grid 2.5 mm + + + + + + +>NAME +>VALUE + + + + + +<b>RESISTOR</b> chip<p> +Source: http://www.vishay.com/docs/20008/dcrcw.pdf + + +>NAME +>VALUE + + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RNC55<br> +Source: VISHAY .. vta56.pdf + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RNC60<br> +Source: VISHAY .. vta56.pdf + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RBR52<br> +Source: VISHAY .. vta56.pdf + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RBR53<br> +Source: VISHAY .. vta56.pdf + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RBR54<br> +Source: VISHAY .. vta56.pdf + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RBR55<br> +Source: VISHAY .. vta56.pdf + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Bulk Metal® Foil Technology</b>, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements<p> +MIL SIZE RBR56<br> +Source: VISHAY .. vta56.pdf + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Package 4527</b><p> +Source: http://www.vishay.com/docs/31059/wsrhigh.pdf + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + +>NAME +>VALUE + + +<b>Wirewound Resistors, Precision Power</b><p> +Source: VISHAY wscwsn.pdf + + + + + + +>NAME +>VALUE + + +<b>CRCW1218 Thick Film, Rectangular Chip Resistors</b><p> +Source: http://www.vishay.com .. dcrcw.pdf + + + + +>NAME +>VALUE + + + + +<b>Chip Monolithic Ceramic Capacitors</b> Medium Voltage High Capacitance for General Use<p> +Source: http://www.murata.com .. GRM43DR72E224KW01.pdf + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + +<B>RESISTOR</B>, American symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>Pin Header Connectors</b><p> +<author>Created by librarian@cadsoft.de</author> + + +<b>PIN HEADER</b> + + + + + + + + + +>NAME +>VALUE + + + + + + + + + +>NAME +>VALUE + + + + + +<b>PIN HEADER</b> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/Frege/CommandLineClock.fr b/samples/Frege/CommandLineClock.fr new file mode 100644 index 00000000..5bdde621 --- /dev/null +++ b/samples/Frege/CommandLineClock.fr @@ -0,0 +1,44 @@ +{-- + This program displays the + current time on stdandard output + every other second. + -} + +module examples.CommandLineClock where + +data Date = native java.util.Date where + native new :: () -> IO (MutableIO Date) -- new Date() + native toString :: Mutable s Date -> ST s String -- d.toString() + +--- 'IO' action to give us the current time as 'String' +current :: IO String +current = do + d <- Date.new () + d.toString + +{- + "java.lang.Thread.sleep" takes a "long" and + returns nothing, but may throw an InterruptedException. + This is without doubt an IO action. + + public static void sleep(long millis) + throws InterruptedException + + Encoded in Frege: + - argument type long Long + - result void () + - does IO IO () + - throws ... throws .... + +-} +-- .... defined in frege.java.Lang +-- native sleep java.lang.Thread.sleep :: Long -> IO () throws InterruptedException + + +main args = + forever do + current >>= print + print "\r" + stdout.flush + Thread.sleep 999 + \ No newline at end of file diff --git a/samples/Frege/Concurrent.fr b/samples/Frege/Concurrent.fr new file mode 100644 index 00000000..5f9df994 --- /dev/null +++ b/samples/Frege/Concurrent.fr @@ -0,0 +1,147 @@ +module examples.Concurrent where + +import System.Random +import Java.Net (URL) +import Control.Concurrent as C + +main2 args = do + m <- newEmptyMVar + forkIO do + m.put 'x' + m.put 'y' + m.put 'z' + replicateM_ 3 do + c <- m.take + print "got: " + println c + + +example1 = do + forkIO (replicateM_ 100000 (putChar 'a')) + replicateM_ 100000 (putChar 'b') + +example2 = do + s <- getLine + case s.long of + Right n -> forkIO (setReminder n) >> example2 + Left _ -> println ("exiting ...") + +setReminder :: Long -> IO () +setReminder n = do + println ("Ok, I remind you in " ++ show n ++ " seconds") + Thread.sleep (1000L*n) + println (show n ++ " seconds is up!") + +table = "table" + +mainPhil _ = do + [fork1,fork2,fork3,fork4,fork5] <- mapM MVar.new [1..5] + forkIO (philosopher "Kant" fork5 fork1) + forkIO (philosopher "Locke" fork1 fork2) + forkIO (philosopher "Wittgenstein" fork2 fork3) + forkIO (philosopher "Nozick" fork3 fork4) + forkIO (philosopher "Mises" fork4 fork5) + return () + +philosopher :: String -> MVar Int -> MVar Int -> IO () +philosopher me left right = do + g <- Random.newStdGen + let phil g = do + let (tT,g1) = Random.randomR (60L, 120L) g + (eT, g2) = Random.randomR (80L, 160L) g1 + thinkTime = 300L * tT + eatTime = 300L * eT + + println(me ++ " is going to the dining room and takes his seat.") + fl <- left.take + println (me ++ " takes up left fork (" ++ show fl ++ ")") + rFork <- right.poll + case rFork of + Just fr -> do + println (me ++ " takes up right fork. (" ++ show fr ++ ")") + println (me ++ " is going to eat for " ++ show eatTime ++ "ms") + Thread.sleep eatTime + println (me ++ " finished eating.") + right.put fr + println (me ++ " took down right fork.") + left.put fl + println (me ++ " took down left fork.") + table.notifyAll + println(me ++ " is going to think for " ++ show thinkTime ++ "ms.") + Thread.sleep thinkTime + phil g2 + Nothing -> do + println (me ++ " finds right fork is already in use.") + left.put fl + println (me ++ " took down left fork.") + table.notifyAll + println (me ++ " is going to the bar to await notifications from table.") + table.wait + println (me ++ " got notice that something changed at the table.") + phil g2 + + inter :: InterruptedException -> IO () + inter _ = return () + + phil g `catch` inter + + +getURL xx = do + url <- URL.new xx + con <- url.openConnection + con.connect + is <- con.getInputStream + typ <- con.getContentType + -- stderr.println ("content-type is " ++ show typ) + ir <- InputStreamReader.new is (fromMaybe "UTF-8" (charset typ)) + `catch` unsupportedEncoding is + br <- BufferedReader.new ir + br.getLines + where + unsupportedEncoding :: InputStream -> UnsupportedEncodingException -> IO InputStreamReader + unsupportedEncoding is x = do + stderr.println x.catched + InputStreamReader.new is "UTF-8" + + charset ctyp = do + typ <- ctyp + case typ of + m~´charset=(\S+)´ -> m.group 1 + _ -> Nothing + + +type SomeException = Throwable + +main ["dining"] = mainPhil [] + +main _ = do + m1 <- MVar.newEmpty + m2 <- MVar.newEmpty + m3 <- MVar.newEmpty + + forkIO do + r <- (catchAll . getURL) "http://www.wikipedia.org/wiki/Haskell" + m1.put r + + forkIO do + r <- (catchAll . getURL) "htto://www.wikipedia.org/wiki/Java" + m2.put r + + forkIO do + r <- (catchAll . getURL) "http://www.wikipedia.org/wiki/Frege" + m3.put r + + r1 <- m1.take + r2 <- m2.take + r3 <- m3.take + println (result r1, result r2, result r3) + -- case r3 of + -- Right ss -> mapM_ putStrLn ss + -- Left _ -> return () + where + result :: (SomeException|[String]) -> (String|Int) + result (Left x) = Left x.getClass.getName + result (Right y) = (Right . sum . map length) y + -- mapM_ putStrLn r2 + + \ No newline at end of file diff --git a/samples/Frege/Sudoku.fr b/samples/Frege/Sudoku.fr new file mode 100644 index 00000000..88bfd966 --- /dev/null +++ b/samples/Frege/Sudoku.fr @@ -0,0 +1,561 @@ +package examples.Sudoku where + +import Data.TreeMap (Tree, keys) +import Data.List as DL hiding (find, union) + + +type Element = Int -- 1,2,3,4,5,6,7,8,9 +type Zelle = [Element] -- set of candidates +type Position = Int -- 0..80 +type Feld = (Position, Zelle) +type Brett = [Feld] + +--- data type for assumptions and conclusions +data Assumption = + !ISNOT Position Element + | !IS Position Element + + +derive Eq Assumption +derive Ord Assumption +instance Show Assumption where + show (IS p e) = pname p ++ "=" ++ e.show + show (ISNOT p e) = pname p ++ "/" ++ e.show + +showcs cs = joined " " (map Assumption.show cs) + +elements :: [Element] -- all possible elements +elements = [1 .. 9] + +{- + a b c d e f g h i + 0 1 2 | 3 4 5 | 6 7 8 1 + 9 10 11 |12 13 14 |15 16 17 2 + 18 19 20 |21 22 23 |24 25 26 3 + ---------|---------|-------- + 27 28 29 |30 31 32 |33 34 35 4 + 36 37 38 |39 40 41 |42 43 44 5 + 45 46 47 |48 49 50 |51 52 53 6 + ---------|---------|-------- + 54 55 56 |57 58 59 |60 61 62 7 + 63 64 65 |66 67 68 |69 70 71 8 + 72 73 74 |75 76 77 |78 79 80 9 +-} + +positions :: [Position] -- all possible positions +positions = [0..80] +rowstarts :: [Position] -- all positions where a row is starting +rowstarts = [0,9,18,27,36,45,54,63,72] +colstarts :: [Position] -- all positions where a column is starting +colstarts = [0,1,2,3,4,5,6,7,8] +boxstarts :: [Position] -- all positions where a box is starting +boxstarts = [0,3,6,27,30,33,54,57,60] +boxmuster :: [Position] -- pattern for a box, by adding upper left position results in real box +boxmuster = [0,1,2,9,10,11,18,19,20] + + +--- extract field for position +getf :: Brett -> Position -> Feld +getf (f:fs) p + | fst f == p = f + | otherwise = getf fs p +getf [] p = (p,[]) + + +--- extract cell for position +getc :: Brett -> Position -> Zelle +getc b p = snd (getf b p) + +--- compute the list of all positions that belong to the same row as a given position +row :: Position -> [Position] +row p = [z..(z+8)] where z = (p `quot` 9) * 9 + +--- compute the list of all positions that belong to the same col as a given position +col :: Position -> [Position] +col p = map (c+) rowstarts where c = p `mod` 9 + +--- compute the list of all positions that belong to the same box as a given position +box :: Position -> [Position] +box p = map (z+) boxmuster where + ri = p `div` 27 * 27 -- 0, 27 or 54, depending on row + ci = p `mod` 9 -- column index 0..8, 0,1,2 is left, 3,4,5 is middle, 6,7,8 is right + cs = ci `div` 3 * 3 -- 0, 3 or 6 + z = ri + cs + +--- check if candidate set has exactly one member, i.e. field has been solved +single :: Zelle -> Bool +single [_] = true +single _ = false + +unsolved :: Zelle -> Bool +unsolved [_] = false +unsolved _ = true + +-- list of rows, cols, boxes +allrows = map row rowstarts +allcols = map col colstarts +allboxs = map box boxstarts +allrcb = zip (repeat "row") allrows + ++ zip (repeat "col") allcols + ++ zip (repeat "box") allboxs + + +containers :: [(Position -> [Position], String)] +containers = [(row, "row"), (col, "col"), (box, "box")] + +-- ----------------- PRINTING ------------------------------------ +-- printable coordinate of field, upper left is a1, lower right is i9 +pname p = packed [chr (ord 'a' + p `mod` 9), chr (ord '1' + p `div` 9)] + +-- print board +printb b = mapM_ p1line allrows >> println "" + where + p1line row = do + print (joined "" (map pfld line)) + where line = map (getc b) row + +-- print field (brief) +-- ? = no candidate +-- 5 = field is 5 +-- . = some candidates +pfld [] = "?" +pfld [x] = show x +pfld zs = "0" + +-- print initial/final board +result msg b = do + println ("Result: " ++ msg) + print ("Board: ") + printb b + return b + +res012 b = case concatMap (getc b) [0,1,2] of + [a,b,c] -> a*100+b*10+c + _ -> 9999999 + +-- -------------------------- BOARD ALTERATION ACTIONS --------------------------------- +-- print a message about what is done to the board and return the new board +turnoff1 :: Position -> Zelle -> Brett -> IO Brett +turnoff1 i off b + | single nc = do + -- print (pname i) + -- print ": set to " + -- print (head nc) + -- println " (naked single)" + return newb + | otherwise = return newb + where + cell = getc b i + nc = filter (`notElem` off) cell + newb = (i, nc) : [ f | f <- b, fst f != i ] + +turnoff :: Int -> Zelle -> String -> Brett -> IO Brett +turnoff i off msg b = do + -- print (pname i) + -- print ": set to " + -- print nc + -- print " by clearing " + -- print off + -- print " " + -- println msg + return newb + where + cell = getc b i + nc = filter (`notElem` off) cell + newb = (i, nc) : [ f | f <- b, fst f != i ] + +turnoffh ps off msg b = foldM toh b ps + where + toh b p = turnoff p off msg b + +setto :: Position -> Element -> String -> Brett -> IO Brett +setto i n cname b = do + -- print (pname i) + -- print ": set to " + -- print n + -- print " (hidden single in " + -- print cname + -- println ")" + return newb + where + nf = [n] + newb = (i, nf) : [ f | f <- b, fst f != i ] + + +-- ----------------------------- SOLVING STRATEGIES --------------------------------------------- +-- reduce candidate sets that contains numbers already in same row, col or box +-- This finds (and logs) NAKED SINGLEs in passing. +reduce b = [ turnoff1 p sss | (p,cell) <- b, -- for each field + unsolved cell, -- with more than 1 candidate + -- single fields in containers that are candidates of that field + sss = [ s | (rcb, _) <- containers, [s] <- map (getc b) (rcb p), s `elem` cell], + sss != [] ] -- collect field index, elements to remove from candidate set + +-- look for a number that appears in exactly 1 candidate set of a container +-- this number can go in no other place (HIDDEN SINGLE) +hiddenSingle b = [ setto i n cname | -- select index, number, containername + (cname, rcb) <- allrcb, -- FOR rcb IN allrcb + n <- elements, -- FOR n IN elements + fs = filter (unsolved • snd) (map (getf b) rcb), + occurs = filter ((n `elem`) • snd) fs, + length occurs == 1, + (i, _) <- occurs ] + +-- look for NAKED PAIRS, TRIPLES, QUADS +nakedPair n b = [ turnoff p t ("(naked tuple in " ++ nm ++ ")") | -- SELECT pos, tuple, name + -- n <- [2,3,4], // FOR n IN [2,3,4] + (nm, rcb) <- allrcb, -- FOR rcb IN containers + fs = map (getf b) rcb, -- let fs = fields for rcb positions + u = (fold union [] . filter unsolved . map snd) fs, -- let u = union of non single candidates + t <- n `outof` u, -- FOR t IN n-tuples + hit = (filter ((`subset` t) . snd) . filter (unsolved . snd)) fs, + length hit == n, + (p, cell) <- fs, + p `notElem` map fst hit, + any (`elem` cell) t + ] + +-- look for HIDDEN PAIRS, TRIPLES or QUADS +hiddenPair n b = [ turnoff p off ("(hidden " ++ show t ++ " in " ++ nm ++ ")") | -- SELECT pos, tuple, name + -- n <- [2,3,4], // FOR n IN [2,3,4] + (nm, rcb) <- allrcb, -- FOR rcb IN containers + fs = map (getf b) rcb, -- let fs = fields for rcb positions + u = (fold union [] . filter ((>1) . length) . map snd) fs, -- let u = union of non single candidates + t <- n `outof` u, -- FOR t IN n-tuples + hit = (filter (any ( `elem` t) . snd) . filter (unsolved . snd)) fs, + length hit == n, + off = (fold union [] . map snd) hit `minus` t, + off != [], + (p, cell) <- hit, + ! (cell `subset` t) + ] + +a `subset` b = all (`elem` b) a +a `union` b = uniq (sort (a ++ b)) +a `minus` b = filter (`notElem` b) a +a `common` b = filter (`elem` b) a +n `outof` as + | length as < n = [] + | [] <- as = [] + | 1 >= n = map (:[]) as + | (a:bs) <- as = map (a:) ((n-1) `outof` bs) ++ (n `outof` bs) + | otherwise = undefined -- cannot happen because either as is empty or not + +same f a b = b `elem` f a + +intersectionlist = [(allboxs, row, "box/row intersection"), (allboxs, col, "box/col intersection"), + (allrows ++ allcols, box, "line/box intersection")] +intersections b = [ + turnoff pos [c] reason | -- SELECT position, candidate, reson + (from, container, reason) <- intersectionlist, + rcb <- from, + fs = (filter (unsolved . snd) . map (getf b)) rcb, -- fs = fields in from with more than 1 candidate + c <- (fold union [] • map snd) fs, -- FOR c IN union of candidates + cpos = (map fst • filter ((c `elem`) • snd)) fs, -- cpos = positions where c occurs + cpos != [], -- WHERE cpos is not empty + all (same container (head cpos)) (tail cpos), -- WHERE all positions are in the intersection + -- we can remove all occurences of c that are in container, but not in from + (pos, cell) <- map (getf b) (container (head cpos)), + c `elem` cell, + pos `notElem` rcb ] + + +-- look for an XY Wing +-- - there exists a cell A with candidates X and Y +-- - there exists a cell B with candidates X and Z that shares a container with A +-- - there exists a cell C with candidates Y and Z that shares a container with A +-- reasoning +-- - if A is X, B will be Z +-- - if A is Y, C will be Z +-- - since A will indeed be X or Y -> B or C will be Z +-- - thus, no cell that can see B and C can be Z +xyWing board = [ turnoff p [z] ("xy wing " ++ pname b ++ " " ++ pname c ++ " because of " ++ pname a) | + (a, [x,y]) <- board, -- there exists a cell a with candidates x and y + rcba = map (getf board) (row a ++ col a ++ box a), -- rcba = all fields that share a container with a + (b, [b1, b2]) <- rcba, + b != a, + b1 == x && b2 != y || b2 == x && b1 != y, -- there exists a cell B with candidates x and z + z = if b1 == x then b2 else b1, + (c, [c1, c2]) <- rcba, + c != a, c!= b, + c1 == y && c2 == z || c1 == z && c2 == y, -- there exists a cell C with candidates y and z + ps = (uniq . sort) ((row b ++ col b ++ box b) `common` (row c ++ col c ++ box c)), + -- remove z in ps + (p, cs) <- map (getf board) ps, + p != b, p != c, + z `elem` cs ] + +-- look for a N-Fish (2: X-Wing, 3: Swordfish, 4: Jellyfish) +-- When all candidates for a particular digit in N rows are located +-- in only N columns, we can eliminate all candidates from those N columns +-- which are not located on those N rows +fish n board = fish "row" allrows row col ++ fish "col" allcols col row where + fishname 2 = "X-Wing" + fishname 3 = "Swordfish" + fishname 4 = "Jellyfish" + fishname _ = "unknown fish" + fish nm allrows row col = [ turnoff p [x] (fishname n ++ " in " ++ nm ++ " " ++ show (map (pname . head) rset)) | + rset <- n `outof` allrows, -- take n rows (or cols) + x <- elements, -- look for certain number + rflds = map (filter ((>1) . length . snd) . map (getf board)) rset, -- unsolved fields in the rowset + colss = (map (map (head . col . fst) . filter ((x `elem`) . snd)) rflds), -- where x occurs in candidates + all ((>1) . length) colss, -- x must appear in at least 2 cols + cols = fold union [] colss, + length cols == n, + cstart <- cols, + (p, cell) <- map (getf board) (col cstart), + x `elem` cell, + all (p `notElem`) rset] + + +-- compute immediate consequences of an assumption of the form (p `IS` e) or (p `ISNOT` e) +conseq board (IS p e) = uniq (sort ([ p `ISNOT` x | x <- getc board p, x != e ] ++ + [ a `ISNOT` e | + (a,cs) <- map (getf board) (row p ++ col p ++ box p), + a != p, + e `elem` cs + ])) +conseq board (ISNOT p e) = uniq (sort ([ p `IS` x | cs = getc board p, length cs == 2, x <- cs, x != e ] ++ + [ a `IS` e | + cp <- [row p, box p, col p], + as = (filter ((e `elem`) . getc board) . filter (p!=)) cp, + length as == 1, + a = head as + ])) + +-- check if two assumptions contradict each other +contradicts (IS a x) (IS b y) = a==b && x!=y +contradicts (IS a x) (ISNOT b y) = a==b && x==y +contradicts (ISNOT a x) (IS b y) = a==b && x==y +contradicts (ISNOT _ _) (ISNOT _ _) = false + +-- get the Position of an Assumption +aPos (IS p _) = p +aPos (ISNOT p _) = p + +-- get List of elements that must be turned off when assumption is true/false +toClear board true (IS p x) = filter (x!=) (getc board p) +toClear board false (IS p x) = [x] +toClear board true (ISNOT p x) = [x] +toClear board false (ISNOT p x) = filter (x!=) (getc board p) + + +-- look for assumptions whose implications contradict themself +chain board paths = [ solution a (head cs) (reverse cs) | + (a, css) <- paths, + cs <- take 1 [ cs | cs <- css, contradicts a (head cs) ] + ] + where + solution a c cs = turnoff (aPos a) (toClear board false a) reason where + reason = "Assumption " ++ show a ++ " implies " ++ show c ++ "\n\t" + ++ showcs cs ++ "\n\t" + ++ "Therefore, " ++ show a ++ " must be false." + +-- look for an assumption that yields to contradictory implications +-- this assumption must be false +chainContra board paths = [ solution a (reverse pro) (reverse contra) | + (a, css) <- paths, -- FOR ALL assumptions "a" with list of conlusions "css" + (pro, contra) <- take 1 [ (pro, contra) | + pro <- (uniqBy (using head) . sortBy (comparing head)) css, -- FOR ALL conslusion chains "pro" + c = head pro, -- LET "c" BE the final conclusion + contra <- take 1 (filter ((contradicts c) . head) css) -- THE FIRST conclusion that contradicts c + ] + ] + where + solution a pro con = turnoff (aPos a) (toClear board false a) reason where + reason = ("assumption " ++ show a ++ " leads to contradictory conclusions\n\t" + ++ showcs pro ++ "\n\t" ++ showcs con) + + + +-- look for a common implication c of some assumptions ai, where at least 1 ai is true +-- so that (a0 OR a1 OR a2 OR ...) IMPLIES c +-- For all cells pi in same container that have x as candidate, we can construct (p0==x OR p1==x OR ... OR pi==x) +-- For a cell p with candidates ci, we can construct (p==c0 OR p==c1) +cellRegionChain board paths = [ solution b as (map head os) | + as <- cellas ++ regionas, -- one of as must be true + iss = filter ((`elem` as) . fst) paths, -- the implications for as + (a, ass) <- take 1 iss, -- implications for first assumption + fs <- (uniqBy (using head) . sortBy (comparing head)) ass, + b = head fs, -- final conclusions of first assumption + os = [fs] : map (take 1 . filter ((b==) . head) . snd) (tail iss), -- look for implications with same conclusion + all ([]!=) os] + where + cellas = [ map (p `IS`) candidates | (p, candidates@(_:_:_)) <- board ] + regionas = [ map (`IS` e) ps | + region <- map (map (getf board)) (allrows ++ allcols ++ allboxs), + e <- elements, + ps = map fst (filter ((e `elem`) . snd) region), + length ps > 1 ] + solution b as oss = turnoff (aPos b) (toClear board true b) reason where + reason = "all of the assumptions " ++ joined ", " (map show as) ++ " imply " ++ show b ++ "\n\t" + ++ joined "\n\t" (map (showcs . reverse) oss) ++ "\n\t" + ++ "One of them must be true, so " ++ show b ++ " must be true." + + +{- + Wir brauchen für einige Funktionen eine Datenstruktur wie + [ (Assumption, [[Assumption]]) ] + d.i. eine Liste von möglichen Annahmen samt aller Schlußketten. + Idealerweise sollte die Schlußkette in umgekehrter Reihenfolge vorliegen, + dann kann man einfach finden: + - Annahmen, die zum Selbstwiderspruch führen. + - alles, was aus einer bestimmten Annahme folgt (map (map head) [[a]]) + -... +-} +--- Liste aller Annahmen für ein bestimmtes Brett +assumptions :: Brett -> [Assumption] +assumptions board = [ a | + (p, cs) <- board, + !(single cs), + a <- map (ISNOT p) cs ++ map (IS p) cs ] + +consequences :: Brett -> [Assumption] -> [[Assumption]] +consequences board as = map (conseq board) as + +acstree :: Brett -> Tree Assumption [Assumption] +acstree board = Tree.fromList (zip as cs) + where + as = assumptions board + cs = consequences board as + +-- bypass maybe on tree lookup +find :: Tree Assumption [Assumption] -> Assumption -> [Assumption] +find t a + | Just cs <- t.lookup a = cs + | otherwise = error ("no consequences for " ++ show a) + +-- for performance resons, we confine ourselves to implication chains of length 20 per assumption +mkPaths :: Tree Assumption [Assumption] -> [ (Assumption, [[Assumption]]) ] +mkPaths acst = map impl (keys acst) -- {[a1], [a2], [a3] ] + where + -- [Assumption] -> [(a, [chains, ordered by length] + impl a = (a, impls [[a]]) + impls ns = (take 1000 • concat • takeUntil null • iterate expandchain) ns + -- expandchain :: [[Assumption]] -> [[Assumption]] + expandchain css = [ (n:a:as) | + (a : as) <- css, -- list of assumptions + n <- find acst a, -- consequences of a + n `notElem` as -- avoid loops + ] + -- uni (a:as) = a : uni (filter ((head a !=) • head) as) + -- uni [] = empty + -- empty = [] + + +-- ------------------ SOLVE A SUDOKU -------------------------- +-- Apply all available strategies until nothing changes anymore +-- Strategy functions are supposed to return a list of +-- functions, which, when applied to a board, give a changed board. +-- When a strategy does not find anything to alter, +-- it returns [], and the next strategy can be tried. +solve b + | all (single . snd) b = result "Solved" b + | any (([]==) . snd) b = result "not solvable" b + | res@(_:_) <- reduce b = apply b res >>=solve -- compute smallest candidate sets + -- comment "candidate sets are up to date" = () + | res@(_:_) <- hiddenSingle b = apply b res >>= solve -- find HIDDEN SINGLES + -- comment "no more hidden singles" = () + | res@(_:_) <- intersections b = apply b res >>= solve -- find locked candidates + -- comment "no more intersections" = () + | res@(_:_) <- nakedPair 2 b = apply b res >>= solve -- find NAKED PAIRS, TRIPLES or QUADRUPELS + -- comment "no more naked pairs" = () + | res@(_:_) <- hiddenPair 2 b = apply b res >>= solve -- find HIDDEN PAIRS, TRIPLES or QUADRUPELS + -- comment "no more hidden pairs" = () + -- res@(_:_) <- nakedPair 3 b = apply b res >>= solve // find NAKED PAIRS, TRIPLES or QUADRUPELS + -- | comment "no more naked triples" = () + -- res@(_:_) <- hiddenPair 3 b = apply b res >>= solve // find HIDDEN PAIRS, TRIPLES or QUADRUPELS + -- | comment "no more hidden triples" = () + -- res@(_:_) <- nakedPair 4 b = apply b res >>=solve // find NAKED PAIRS, TRIPLES or QUADRUPELS + -- | comment "no more naked quadruples" = () + -- res@(_:_) <- hiddenPair 4 b = apply b res >>=solve // find HIDDEN PAIRS, TRIPLES or QUADRUPELS + -- | comment "no more hidden quadruples" = () + | res@(_:_) <- xyWing b = apply b res >>=solve -- find XY WINGS + -- comment "no more xy wings" = () + | res@(_:_) <- fish 2 b = apply b res >>=solve -- find 2-FISH + -- comment "no more x-wings" = () + -- res@(_:_) <- fish 3 b = apply b res >>=solve // find 3-FISH + -- | comment "no more swordfish" = () + -- res@(_:_) <- fish 4 b = apply b res >>=solve // find 4-FISH + -- | comment "no more jellyfish" = () + -- | comment pcomment = () + | res@(_:_) <- chain b paths = apply b (take 9 res) >>= solve -- find forcing chains + | res@(_:_) <- cellRegionChain b paths = apply b (take 9 res) >>= solve -- find common conclusion for true assumption + | res@(_:_) <- chainContra b paths = apply b (take 9 res) >>= solve -- find assumptions that allow to infer both a and !a + -- comment "consistent conclusions only" = () + + | otherwise = result "ambiguous" b + where + apply brd fs = foldM (\b\f -> f b) brd fs + paths = mkPaths (acstree b) + -- pcomment = show (length paths) ++ " assumptions with " ++ show (fold (+) 0 (map (length <~ snd) paths)) + -- ++ " implication chains" + +-- comment com = do stderr << com << "\n" for false +-- log com = do stderr << com << "\n" for true + +--- turn a string into a row +mkrow :: String -> [Zelle] +mkrow s = mkrow1 xs + where + xs = s ++ "---------" -- make sure at least 9 elements + mkrow1 xs = (take 9 • filter ([]!=) • map f • unpacked) xs + f x | x >= '1' && x <= '9' = [ord x - ord '0'] + | x == ' ' = [] -- ignored + | otherwise = elements + +main ["-h"] = main [] +main ["-help"] = main [] +main [] = do + mapM_ stderr.println [ + "usage: java Sudoku file ...", + " java Sudoku position", + "where position is a 81 char string consisting of digits", + "One can get such a string by going to", + "http://www.sudokuoftheday.com/pages/s-o-t-d.php", + "Right click on the puzzle and open it in new tab", + "Copy the 81 digits from the URL in the address field of your browser.", + "", + "There is also a file with hard sudokus in examples/top95.txt\n"] + return () + + +main [s@#^[0-9\W]{81}$#] = solve board >> return () + where + board = zip positions felder + felder = decode s + +main files = forM_ files sudoku + where + sudoku file = do + br <- openReader file + lines <- BufferedReader.getLines br + bs <- process lines + ss <- mapM (\b -> print "Puzzle: " >> printb b >> solve b) bs + println ("Euler: " ++ show (sum (map res012 ss))) + return () + +-- "--3-" => [1..9, 1..9, [3], 1..9] +decode s = map candi (unpacked s) where + candi c | c >= '1' && c <= '9' = [(ord c - ord '0')] + | otherwise = elements +process [] = return [] +process (s:ss) + | length s == 81 = consider b1 + | length s == 9, + length acht == 8, + all ((9==) • length) acht = consider b2 + | otherwise = do + stderr.println ("skipped line: " ++ s) + process ss + where + acht = take 8 ss + neun = fold (++) "" (s:acht) + b1 = zip positions (decode s) + b2 = zip positions (decode neun) + consider b = do + -- print "Puzzle: " + -- printb b + bs <- process ss + return (b:bs) + diff --git a/samples/Frege/SwingExamples.fr b/samples/Frege/SwingExamples.fr new file mode 100644 index 00000000..73569546 --- /dev/null +++ b/samples/Frege/SwingExamples.fr @@ -0,0 +1,79 @@ +package examples.SwingExamples where + +import Java.Awt (ActionListener) +import Java.Swing + + +main _ = do + rs <- mapM Runnable.new [helloWorldGUI, buttonDemoGUI, celsiusConverterGUI] + mapM_ invokeLater rs + println "Hit enter to end ...." + s <- getLine + return () + +celsiusConverterGUI = do + tempTextField <- JTextField.new() + celsiusLabel <- JLabel.new () + convertButton <- JButton.new () + fahrenheitLabel <- JLabel.new () + frame <- JFrame.new () + frame.setDefaultCloseOperation JFrame.dispose_on_close + frame.setTitle "Celsius Converter" + celsiusLabel.setText "Celsius" + convertButton.setText "Convert" + let convertButtonActionPerformed _ = do + celsius <- tempTextField.getText + case celsius.double of + Left _ -> fahrenheitLabel.setText ("not a valid number: " ++ celsius) + Right c -> fahrenheitLabel.setText (show (c*1.8 + 32.0).long ++ " Fahrenheit") + return () + ActionListener.new convertButtonActionPerformed >>= convertButton.addActionListener + fahrenheitLabel.setText "Fahrenheit" + contentPane <- frame.getContentPane + layout <- GroupLayout.new contentPane + contentPane.setLayout layout + -- TODO continue + -- http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/learn/CelsiusConverterProject/src/learn/CelsiusConverterGUI.java + frame.pack + frame.setVisible true + +helloWorldGUI = do + frame <- JFrame.new "Hello World Frege" + frame.setDefaultCloseOperation(JFrame.dispose_on_close) + label <- JLabel.new "Hello World!" + cp <- frame.getContentPane + cp.add label + frame.pack + frame.setVisible true + +buttonDemoGUI = do + frame <- JFrame.new "Button Demo" + frame.setDefaultCloseOperation(JFrame.dispose_on_close) + newContentPane <- JPanel.new () + b1::JButton <- JButton.new "Disable middle button" + b1.setVerticalTextPosition SwingConstants.center + b1.setHorizontalTextPosition SwingConstants.leading + b2::JButton <- JButton.new "Middle button" + b2.setVerticalTextPosition SwingConstants.center + b2.setHorizontalTextPosition SwingConstants.leading + b3::JButton <- JButton.new "Enable middle button" + b3.setVerticalTextPosition SwingConstants.center + b3.setHorizontalTextPosition SwingConstants.leading + b3.setEnabled false + let action1 _ = do + b2.setEnabled false + b1.setEnabled false + b3.setEnabled true + action3 _ = do + b2.setEnabled true + b1.setEnabled true + b3.setEnabled false + ActionListener.new action1 >>= b1.addActionListener + ActionListener.new action3 >>= b3.addActionListener + newContentPane.add b1 + newContentPane.add b2 + newContentPane.add b3 + newContentPane.setOpaque true + frame.setContentPane newContentPane + frame.pack + frame.setVisible true diff --git a/samples/GAMS/transport.gms b/samples/GAMS/transport.gms new file mode 100644 index 00000000..fb6ccbc9 --- /dev/null +++ b/samples/GAMS/transport.gms @@ -0,0 +1,76 @@ +*Basic example of transport model from GAMS model library + +$Title A Transportation Problem (TRNSPORT,SEQ=1) +$Ontext + +This problem finds a least cost shipping schedule that meets +requirements at markets and supplies at factories. + + +Dantzig, G B, Chapter 3.3. In Linear Programming and Extensions. +Princeton University Press, Princeton, New Jersey, 1963. + +This formulation is described in detail in: +Rosenthal, R E, Chapter 2: A GAMS Tutorial. In GAMS: A User's Guide. +The Scientific Press, Redwood City, California, 1988. + +The line numbers will not match those in the book because of these +comments. + +$Offtext + + + Sets + i canning plants / seattle, san-diego / + j markets / new-york, chicago, topeka / ; + Parameters + a(i) capacity of plant i in cases + / seattle 350 + san-diego 600 / + b(j) demand at market j in cases + / new-york 325 + chicago 300 + topeka 275 / ; + Table d(i,j) distance in thousands of miles + new-york chicago topeka + seattle 2.5 1.7 1.8 + san-diego 2.5 1.8 1.4 ; + Scalar f freight in dollars per case per thousand miles /90/ ; + Parameter c(i,j) transport cost in thousands of dollars per case ; + c(i,j) = f * d(i,j) / 1000 ; + Variables + x(i,j) shipment quantities in cases + z total transportation costs in thousands of dollars ; + + Positive Variable x ; + + Equations + cost define objective function + supply(i) observe supply limit at plant i + demand(j) satisfy demand at market j ; + + cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ; + + supply(i) .. sum(j, x(i,j)) =l= a(i) ; + + demand(j) .. sum(i, x(i,j)) =g= b(j) ; + + Model transport /all/ ; + + Solve transport using lp minimizing z ; + + Display x.l, x.m ; + +$ontext +#user model library stuff +Main topic Basic GAMS +Featured item 1 Trnsport model +Featured item 2 +Featured item 3 +Featured item 4 +Description +Basic example of transport model from GAMS model library + + + +$offtext \ No newline at end of file diff --git a/samples/GAP/Magic.gd b/samples/GAP/Magic.gd new file mode 100644 index 00000000..cdd8baec --- /dev/null +++ b/samples/GAP/Magic.gd @@ -0,0 +1,307 @@ +############################################################################# +## +## Magic.gd AutoDoc package +## +## Copyright 2013, Max Horn, JLU Giessen +## Sebastian Gutsche, University of Kaiserslautern +## +############################################################################# + + +#! @Description +#! This is the main function of the &AutoDoc; package. It can perform +#! any combination of the following three tasks: +#! +#! +#! It can (re)generate a scaffold for your package manual. +#! That is, it can produce two XML files in &GAPDoc; format to be used as part +#! of your manual: First, a file named doc/PACKAGENAME.xml +#! (with your package's name substituted) which is used as +#! main file for the package manual, i.e. this file sets the +#! XML DOCTYPE and defines various XML entities, includes +#! other XML files (both those generated by &AutoDoc; as well +#! as additional files created by other means), tells &GAPDoc; +#! to generate a table of content and an index, and more. +#! Secondly, it creates a file doc/title.xml containing a title +#! page for your documentation, with information about your package +#! (name, description, version), its authors and more, based +#! on the data in your PackageInfo.g. +#! +#! +#! It can scan your package for &AutoDoc; based documentation (by using &AutoDoc; +#! tags and the Autodoc command. +#! This will +#! produce further XML files to be used as part of the package manual. +#! +#! +#! It can use &GAPDoc; to generate PDF, text and HTML (with +#! MathJaX enabled) documentation from the &GAPDoc; XML files it +#! generated as well as additional such files provided by you. For +#! this, it invokes +#! to convert the XML sources, and it also instructs &GAPDoc; to copy +#! supplementary files (such as CSS style files) into your doc directory +#! (see ). +#! +#! +#! For more information and some examples, please refer to Chapter . +#!

+#! The parameters have the following meanings: +#! +#! +#! package_name +#! +#! The name of the package whose documentation should be(re)generated. +#! +#! +#! +#! option_record +#! +#! option_record can be a record with some additional options. +#! The following are currently supported: +#! +#! dir +#! +#! This should be a string containing a (relative) path or a +#! Directory() object specifying where the package documentation +#! (i.e. the &GAPDoc; XML files) are stored. +#!
+#! Default value: "doc/". +#!
+#! scaffold +#! +#! This controls whether and how to generate scaffold XML files +#! for the main and title page of the package's documentation. +#!

+#! The value should be either true, false or a +#! record. If it is a record or true (the latter is +#! equivalent to specifying an empty record), then this feature is +#! enabled. It is also enabled if opt.scaffold is missing but the +#! package's info record in PackageInfo.g has an AutoDoc entry. +#! In all other cases (in particular if opt.scaffold is +#! false), scaffolding is disabled. +#!

+#! +#! If opt.scaffold is a record, it may contain the following entries. +#! +#### TODO: mention merging with PackageInfo.AutoDoc! +#! +#! +#! includes +#! +#! A list of XML files to be included in the body of the main XML file. +#! If you specify this list and also are using &AutoDoc; to document +#! your operations with &AutoDoc; comments, +#! you can add AutoDocMainFile.xml to this list +#! to control at which point the documentation produced by &AutoDoc; +#! is inserted. If you do not do this, it will be added after the last +#! of your own XML files. +#! +#! +#! appendix +#! +#! This entry is similar to opt.scaffold.includes but is used +#! to specify files to include after the main body of the manual, +#! i.e. typically appendices. +#! +#! +#! bib +#! +#! The name of a bibliography file, in Bibtex or XML format. +#! If this key is not set, but there is a file doc/PACKAGENAME.bib +#! then it is assumed that you want to use this as your bibliography. +#! +#! +#### TODO: The 'entities' param is a bit strange. We should probably change it to be a bit more +#### general, as one might want to define other entities... For now, we do not document it +#### to leave us the choice of revising how it works. +#### +#### entities +#### +#### A list of package names or other entities which are used to define corresponding XML entities. +#### For example, if set to a list containing the string SomePackage, +#### then the following is added to the XML preamble: +####

SomePackage'>]]> +#### This allows you to write &SomePackage; in your documentation +#### to reference that package. If another type of entity is desired, one can simply add, +#### instead of a string, add a two entry list a to the list. It will be handled as +#### a[ 2 ]'>]]>, +#### so please be careful. +####
+#! +#! TitlePage +#! +#! A record whose entries are used to embellish the generated titlepage +#! for the package manual with extra information, such as a copyright +#! statement or acknowledgments. To this end, the names of the record +#! components are used as XML element names, and the values of the +#! components are outputted as content of these XML elements. For +#! example, you could pass the following record to set a custom +#! acknowledgements text: +#! +#! For a list of valid entries in the titlepage, please refer to the +#! &GAPDoc; manual, specifically section +#! and following. +#! +#! document_class +#! +#! Sets the document class of the resulting pdf. The value can either be a string +#! which has to be the name of the new document class, a list containing this string, or +#! a list of two strings. Then the first one has to be the document class name, the second one +#! the option string ( contained in [ ] ) in LaTeX. +#! +#! latex_header_file +#! +#! Replaces the standard header from &GAPDoc; completely with the header in this LaTeX file. +#! Please be careful here, and look at GAPDoc's latexheader.tex file for an example. +#! +#! gapdoc_latex_options +#! +#! Must be a record with entries which can be understood by SetGapDocLaTeXOptions. Each entry can be a string, which +#! will be given to &GAPDoc; directly, or a list containing of two entries: The first one must be the string "file", +#! the second one a filename. This file will be read and then its content is passed to &GAPDoc; as option with the name +#! of the entry. +#! +#! +#!
+#!
+#! +#! +#! autodoc +#! +#! This controls whether and how to generate addition XML documentation files +#! by scanning for &AutoDoc; documentation comments. +#!

+#! The value should be either true, false or a +#! record. If it is a record or true (the latter is +#! equivalent to specifying an empty record), then this feature is +#! enabled. It is also enabled if opt.autodoc is missing but the +#! package depends (directly) on the &AutoDoc; package. +#! In all other cases (in particular if opt.autodoc is +#! false), this feature is disabled. +#!

+#! +#! If opt.autodoc is a record, it may contain the following entries. +#! +#! +#! +#! files +#! +#! A list of files (given by paths relative to the package directory) +#! to be scanned for &AutoDoc; documentation comments. +#! Usually it is more convenient to use autodoc.scan_dirs, see below. +#! +#! +#! scan_dirs +#! +#! A list of subdirectories of the package directory (given as relative paths) +#! which &AutoDoc; then scans for .gi, .gd and .g files; all of these files +#! are then scanned for &AutoDoc; documentation comments. +#!
+#! Default value: [ "gap", "lib", "examples", "examples/doc" ]. +#!
+#! +#! level +#! +#! This defines the level of the created documentation. The default value is 0. +#! When parts of the manual are declared with a higher value +#! they will not be printed into the manual. +#! +#! +#### TODO: Document section_intros later on. +#### However, note that thanks to the new AutoDoc comment syntax, the only remaining +#### use for this seems to be the ability to specify the order of chapters and +#### sections. +#### section_intros +#### +#### TODO. +#### +#! +#!
+#! +#! +#! +#! gapdoc +#! +#! This controls whether and how to invoke &GAPDoc; to create HTML, PDF and text +#! files from your various XML files. +#!

+#! The value should be either true, false or a +#! record. If it is a record or true (the latter is +#! equivalent to specifying an empty record), then this feature is +#! enabled. It is also enabled if opt.gapdoc is missing. +#! In all other cases (in particular if opt.gapdoc is +#! false), this feature is disabled. +#!

+#! +#! If opt.gapdoc is a record, it may contain the following entries. +#! +#! +#! +#! +#### Note: 'main' is strictly speaking also used for the scaffold. +#### However, if one uses the scaffolding mechanism, then it is not +#### really necessary to specify a custom name for the main XML file. +#### Thus, the purpose of this parameter is to cater for packages +#### that have existing documentation using a different XML name, +#### and which do not wish to use scaffolding. +#### +#### This explain why we only allow specifying gapdoc.main. +#### The scaffolding code will still honor it, though, just in case. +#! main +#! +#! The name of the main XML file of the package manual. +#! This exists primarily to support packages with existing manual +#! which use a filename here which differs from the default. +#! In particular, specifying this is unnecessary when using scaffolding. +#!
+#! Default value: PACKAGENAME.xml. +#!
+#! +#! files +#! +#! A list of files (given by paths relative to the package directory) +#! to be scanned for &GAPDoc; documentation comments. +#! Usually it is more convenient to use gapdoc.scan_dirs, see below. +#! +#! +#! scan_dirs +#! +#! A list of subdirectories of the package directory (given as relative paths) +#! which &AutoDoc; then scans for .gi, .gd and .g files; all of these files +#! are then scanned for &GAPDoc; documentation comments. +#!
+#! Default value: [ "gap", "lib", "examples", "examples/doc" ]. +#!
+#! +#!
+#! +## This is the maketest part. Still under construction. +#! maketest +#! +#! The maketest item can be true or a record. When it is true, +#! a simple maketest.g is created in the main package directory, +#! which can be used to test the examples from the manual. As a record, +#! the entry can have the following entries itself, to specify some options. +#! +#! filename +#! +#! Sets the name of the test file. +#! +#! commands +#! +#! A list of strings, each one a command, which +#! will be executed at the beginning of the test file. +#! +#! +#! +#! +#! +#! +#! +#! +#! @Returns nothing +#! @Arguments package_name[, option_record ] +#! @ChapterInfo AutoDoc, The AutoDoc() function +DeclareGlobalFunction( "AutoDoc" ); + diff --git a/samples/GAP/Magic.gi b/samples/GAP/Magic.gi new file mode 100644 index 00000000..5202a1de --- /dev/null +++ b/samples/GAP/Magic.gi @@ -0,0 +1,534 @@ +############################################################################# +## +## Magic.gi AutoDoc package +## +## Copyright 2013, Max Horn, JLU Giessen +## Sebastian Gutsche, University of Kaiserslautern +## +############################################################################# + +# Check if a string has the given suffix or not. Another +# name for this would "StringEndsWithOtherString". +# For example, AUTODOC_HasSuffix("file.gi", ".gi") returns +# true while AUTODOC_HasSuffix("file.txt", ".gi") returns false. +BindGlobal( "AUTODOC_HasSuffix", +function(str, suffix) + local n, m; + n := Length(str); + m := Length(suffix); + return n >= m and str{[n-m+1..n]} = suffix; +end ); + +# Given a string containing a ".", , return its suffix, +# i.e. the bit after the last ".". For example, given "test.txt", +# it returns "txt". +BindGlobal( "AUTODOC_GetSuffix", +function(str) + local i; + i := Length(str); + while i > 0 and str[i] <> '.' do i := i - 1; od; + if i < 0 then return ""; fi; + return str{[i+1..Length(str)]}; +end ); + +# Check whether the given directory exists, and if not, attempt +# to create it. +BindGlobal( "AUTODOC_CreateDirIfMissing", +function(d) + local tmp; + if not IsDirectoryPath(d) then + tmp := CreateDir(d); # Note: CreateDir is currently undocumented + if tmp = fail then + Error("Cannot create directory ", d, "\n", + "Error message: ", LastSystemError().message, "\n"); + return false; + fi; + fi; + return true; +end ); + + +# Scan the given (by name) subdirs of a package dir for +# files with one of the given extensions, and return the corresponding +# filenames, as relative paths (relative to the package dir). +# +# For example, the invocation +# AUTODOC_FindMatchingFiles("AutoDoc", [ "gap/" ], [ "gi", "gd" ]); +# might return a list looking like +# [ "gap/AutoDocMainFunction.gd", "gap/AutoDocMainFunction.gi", ... ] +BindGlobal( "AUTODOC_FindMatchingFiles", +function (pkg, subdirs, extensions) + local d_rel, d, tmp, files, result; + + result := []; + + for d_rel in subdirs do + # Get the absolute path to the directory in side the package... + d := DirectoriesPackageLibrary( pkg, d_rel ); + if IsEmpty( d ) then + continue; + fi; + d := d[1]; + # ... but also keep the relative path (such as "gap") + d_rel := Directory( d_rel ); + + files := DirectoryContents( d ); + Sort( files ); + for tmp in files do + if not AUTODOC_GetSuffix( tmp ) in [ "g", "gi", "gd", "autodoc" ] then + continue; + fi; + if not IsReadableFile( Filename( d, tmp ) ) then + continue; + fi; + Add( result, Filename( d_rel, tmp ) ); + od; + od; + return result; +end ); + + +# AutoDoc(pkg[, opt]) +# +## Make this function callable with the package_name AutoDocWorksheet. +## Which will then create a worksheet! +InstallGlobalFunction( AutoDoc, +function( arg ) + local pkg, package_info, opt, scaffold, gapdoc, maketest, + autodoc, pkg_dir, doc_dir, doc_dir_rel, d, tmp, + title_page, tree, is_worksheet, position_document_class, i, gapdoc_latex_option_record; + + pkg := arg[1]; + + if LowercaseString( pkg ) = "autodocworksheet" then + is_worksheet := true; + package_info := rec( ); + pkg_dir := DirectoryCurrent( ); + else + is_worksheet := false; + package_info := PackageInfo( pkg )[ 1 ]; + pkg_dir := DirectoriesPackageLibrary( pkg, "" )[1]; + fi; + + if Length(arg) >= 2 then + opt := arg[2]; + else + opt := rec(); + fi; + + # Check for certain user supplied options, and if present, add them + # to the opt record. + tmp := function( key ) + local val; + val := ValueOption( key ); + if val <> fail then + opt.(key) := val; + fi; + end; + + tmp( "dir" ); + tmp( "scaffold" ); + tmp( "autodoc" ); + tmp( "gapdoc" ); + tmp( "maketest" ); + + # + # Setup the output directory + # + if not IsBound( opt.dir ) then + doc_dir := "doc"; + elif IsString( opt.dir ) or IsDirectory( opt.dir ) then + doc_dir := opt.dir; + else + Error( "opt.dir must be a string containing a path, or a directory object" ); + fi; + + if IsString( doc_dir ) then + # Record the relative version of the path + doc_dir_rel := Directory( doc_dir ); + + # We intentionally do not use + # DirectoriesPackageLibrary( pkg, "doc" ) + # because it returns an empty list if the subdirectory is missing. + # But we want to handle that case by creating the directory. + doc_dir := Filename(pkg_dir, doc_dir); + doc_dir := Directory(doc_dir); + + else + # TODO: doc_dir_rel = ... ? + fi; + + # Ensure the output directory exists, create it if necessary + AUTODOC_CreateDirIfMissing(Filename(doc_dir, "")); + + # Let the developer know where we are generating the documentation. + # This helps diagnose problems where multiple instances of a package + # are visible to GAP and the wrong one is used for generating the + # documentation. + # TODO: Using Info() instead of Print? + Print( "Generating documentation in ", doc_dir, "\n" ); + + # + # Extract scaffolding settings, which can be controlled via + # opt.scaffold or package_info.AutoDoc. The former has precedence. + # + if not IsBound(opt.scaffold) then + # Default: enable scaffolding if and only if package_info.AutoDoc is present + if IsBound( package_info.AutoDoc ) then + scaffold := rec( ); + fi; + elif IsRecord(opt.scaffold) then + scaffold := opt.scaffold; + elif IsBool(opt.scaffold) then + if opt.scaffold = true then + scaffold := rec(); + fi; + else + Error("opt.scaffold must be a bool or a record"); + fi; + + # Merge package_info.AutoDoc into scaffold + if IsBound(scaffold) and IsBound( package_info.AutoDoc ) then + AUTODOC_APPEND_RECORD_WRITEONCE( scaffold, package_info.AutoDoc ); + fi; + + if IsBound( scaffold ) then + AUTODOC_WriteOnce( scaffold, "TitlePage", true ); + AUTODOC_WriteOnce( scaffold, "MainPage", true ); + fi; + + + # + # Extract AutoDoc settings + # + if not IsBound(opt.autodoc) and not is_worksheet then + # Enable AutoDoc support if the package depends on AutoDoc. + tmp := Concatenation( package_info.Dependencies.NeededOtherPackages, + package_info.Dependencies.SuggestedOtherPackages ); + if ForAny( tmp, x -> LowercaseString(x[1]) = "autodoc" ) then + autodoc := rec(); + fi; + elif IsRecord(opt.autodoc) then + autodoc := opt.autodoc; + elif IsBool(opt.autodoc) and opt.autodoc = true then + autodoc := rec(); + fi; + + if IsBound(autodoc) then + if not IsBound( autodoc.files ) then + autodoc.files := [ ]; + fi; + + if not IsBound( autodoc.scan_dirs ) and not is_worksheet then + autodoc.scan_dirs := [ "gap", "lib", "examples", "examples/doc" ]; + elif not IsBound( autodoc.scan_dirs ) and is_worksheet then + autodoc.scan_dirs := [ ]; + fi; + + if not IsBound( autodoc.level ) then + autodoc.level := 0; + fi; + + PushOptions( rec( level_value := autodoc.level ) ); + + if not is_worksheet then + Append( autodoc.files, AUTODOC_FindMatchingFiles(pkg, autodoc.scan_dirs, [ "g", "gi", "gd" ]) ); + fi; + fi; + + # + # Extract GAPDoc settings + # + if not IsBound( opt.gapdoc ) then + # Enable GAPDoc support by default + gapdoc := rec(); + elif IsRecord( opt.gapdoc ) then + gapdoc := opt.gapdoc; + elif IsBool( opt.gapdoc ) and opt.gapdoc = true then + gapdoc := rec(); + fi; + + # + # Extract test settings + # + + if IsBound( opt.maketest ) then + if IsRecord( opt.maketest ) then + maketest := opt.maketest; + elif opt.maketest = true then + maketest := rec( ); + fi; + fi; + + if IsBound( gapdoc ) then + + if not IsBound( gapdoc.main ) then + gapdoc.main := pkg; + fi; + + # FIXME: the following may break if a package uses more than one book + if IsBound( package_info.PackageDoc ) and IsBound( package_info.PackageDoc[1].BookName ) then + gapdoc.bookname := package_info.PackageDoc[1].BookName; + elif not is_worksheet then + # Default: book name = package name + gapdoc.bookname := pkg; + + Print("\n"); + Print("WARNING: PackageInfo.g is missing a PackageDoc entry!\n"); + Print("Without this, your package manual will not be recognized by the GAP help system.\n"); + Print("You can correct this by adding the following to your PackageInfo.g:\n"); + Print("PackageDoc := rec(\n"); + Print(" BookName := ~.PackageName,\n"); + #Print(" BookName := \"", pkg, "\",\n"); + Print(" ArchiveURLSubset := [\"doc\"],\n"); + Print(" HTMLStart := \"doc/chap0.html\",\n"); + Print(" PDFFile := \"doc/manual.pdf\",\n"); + Print(" SixFile := \"doc/manual.six\",\n"); + Print(" LongTitle := ~.Subtitle,\n"); + Print("),\n"); + Print("\n"); + fi; + + if not IsBound( gapdoc.files ) then + gapdoc.files := []; + fi; + + if not IsBound( gapdoc.scan_dirs ) and not is_worksheet then + gapdoc.scan_dirs := [ "gap", "lib", "examples", "examples/doc" ]; + fi; + + if not is_worksheet then + Append( gapdoc.files, AUTODOC_FindMatchingFiles(pkg, gapdoc.scan_dirs, [ "g", "gi", "gd" ]) ); + fi; + + # Attempt to weed out duplicates as they may confuse GAPDoc (this + # won't work if there are any non-normalized paths in the list). + gapdoc.files := Set( gapdoc.files ); + + # Convert the file paths in gapdoc.files, which are relative to + # the package directory, to paths which are relative to the doc directory. + # For this, we assume that doc_dir_rel is normalized (e.g. + # it does not contains '//') and relative. + d := Number( Filename( doc_dir_rel, "" ), x -> x = '/' ); + d := Concatenation( ListWithIdenticalEntries(d, "../") ); + gapdoc.files := List( gapdoc.files, f -> Concatenation( d, f ) ); + fi; + + + # read tree + # FIXME: shouldn't tree be declared inside of an 'if IsBound(autodoc)' section? + tree := DocumentationTree( ); + + if IsBound( autodoc ) then + if IsBound( autodoc.section_intros ) then + AUTODOC_PROCESS_INTRO_STRINGS( autodoc.section_intros : Tree := tree ); + fi; + + AutoDocScanFiles( autodoc.files : PackageName := pkg, Tree := tree ); + fi; + + if is_worksheet then + # FIXME: We use scaffold and autodoc here without checking whether + # they are bound. Does that mean worksheets always use them? + if IsRecord( scaffold.TitlePage ) and IsBound( scaffold.TitlePage.Title ) then + pkg := scaffold.TitlePage.Title; + + elif IsBound( tree!.TitlePage.Title ) then + pkg := tree!.TitlePage.Title; + + elif IsBound( autodoc.files ) and Length( autodoc.files ) > 0 then + pkg := autodoc.files[ 1 ]; + + while Position( pkg, '/' ) <> fail do + Remove( pkg, 1 ); + od; + + while Position( pkg, '.' ) <> fail do + Remove( pkg, Length( pkg ) ); + od; + + else + Error( "could not figure out a title." ); + fi; + + if not IsString( pkg ) then + pkg := JoinStringsWithSeparator( pkg, " " ); + fi; + + gapdoc.main := ReplacedString( pkg, " ", "_" ); + gapdoc.bookname := ReplacedString( pkg, " ", "_" ); + fi; + + # + # Generate scaffold + # + gapdoc_latex_option_record := rec( ); + + if IsBound( scaffold ) then + ## Syntax is [ "class", [ "options" ] ] + if IsBound( scaffold.document_class ) then + position_document_class := PositionSublist( GAPDoc2LaTeXProcs.Head, "documentclass" ); + + if IsString( scaffold.document_class ) then + scaffold.document_class := [ scaffold.document_class ]; + fi; + + if position_document_class = fail then + Error( "something is wrong with the LaTeX header" ); + fi; + + GAPDoc2LaTeXProcs.Head := Concatenation( + GAPDoc2LaTeXProcs.Head{[ 1 .. PositionSublist( GAPDoc2LaTeXProcs.Head, "{", position_document_class ) ]}, + scaffold.document_class[ 1 ], + GAPDoc2LaTeXProcs.Head{[ PositionSublist( GAPDoc2LaTeXProcs.Head, "}", position_document_class ) .. Length( GAPDoc2LaTeXProcs.Head ) ]} ); + + if Length( scaffold.document_class ) = 2 then + + GAPDoc2LaTeXProcs.Head := Concatenation( + GAPDoc2LaTeXProcs.Head{[ 1 .. PositionSublist( GAPDoc2LaTeXProcs.Head, "[", position_document_class ) ]}, + scaffold.document_class[ 2 ], + GAPDoc2LaTeXProcs.Head{[ PositionSublist( GAPDoc2LaTeXProcs.Head, "]", position_document_class ) .. Length( GAPDoc2LaTeXProcs.Head ) ]} ); + fi; + fi; + + if IsBound( scaffold.latex_header_file ) then + GAPDoc2LaTeXProcs.Head := StringFile( scaffold.latex_header_file ); + fi; + + if IsBound( scaffold.gapdoc_latex_options ) then + if IsRecord( scaffold.gapdoc_latex_options ) then + for i in RecNames( scaffold.gapdoc_latex_options ) do + if not IsString( scaffold.gapdoc_latex_options.( i ) ) + and IsList( scaffold.gapdoc_latex_options.( i ) ) + and LowercaseString( scaffold.gapdoc_latex_options.( i )[ 1 ] ) = "file" then + scaffold.gapdoc_latex_options.( i ) := StringFile( scaffold.gapdoc_latex_options.( i )[ 2 ] ); + fi; + od; + + gapdoc_latex_option_record := scaffold.gapdoc_latex_options; + fi; + fi; + + if not IsBound( scaffold.includes ) then + scaffold.includes := [ ]; + fi; + + if IsBound( autodoc ) then + # If scaffold.includes is already set, then we add + # AutoDocMainFile.xml to it, but *only* if it not already + # there. This way, package authors can control where + # it is put in their includes list. + if not "AutoDocMainFile.xml" in scaffold.includes then + Add( scaffold.includes, "AutoDocMainFile.xml" ); + fi; + fi; + + if IsBound( scaffold.bib ) and IsBool( scaffold.bib ) then + if scaffold.bib = true then + scaffold.bib := Concatenation( pkg, ".bib" ); + else + Unbind( scaffold.bib ); + fi; + elif not IsBound( scaffold.bib ) then + # If there is a doc/PKG.bib file, assume that we want to reference it in the scaffold. + if IsReadableFile( Filename( doc_dir, Concatenation( pkg, ".bib" ) ) ) then + scaffold.bib := Concatenation( pkg, ".bib" ); + fi; + fi; + + AUTODOC_WriteOnce( scaffold, "index", true ); + + if IsBound( gapdoc ) then + if AUTODOC_GetSuffix( gapdoc.main ) = "xml" then + scaffold.main_xml_file := gapdoc.main; + else + scaffold.main_xml_file := Concatenation( gapdoc.main, ".xml" ); + fi; + fi; + + # TODO: It should be possible to only rebuild the title page. (Perhaps also only the main page? but this is less important) + if IsBound( scaffold.TitlePage ) then + if IsRecord( scaffold.TitlePage ) then + title_page := scaffold.TitlePage; + else + title_page := rec( ); + fi; + + AUTODOC_WriteOnce( title_page, "dir", doc_dir ); + AUTODOC_APPEND_RECORD_WRITEONCE( title_page, tree!.TitlePage ); + + if not is_worksheet then + AUTODOC_APPEND_RECORD_WRITEONCE( title_page, ExtractTitleInfoFromPackageInfo( pkg ) ); + fi; + + CreateTitlePage( title_page ); + fi; + + if IsBound( scaffold.MainPage ) and scaffold.MainPage <> false then + scaffold.dir := doc_dir; + scaffold.book_name := pkg; + CreateMainPage( scaffold ); + fi; + fi; + + # + # Run AutoDoc + # + if IsBound( autodoc ) then + WriteDocumentation( tree, doc_dir ); + fi; + + + # + # Run GAPDoc + # + if IsBound( gapdoc ) then + + # Ask GAPDoc to use UTF-8 as input encoding for LaTeX, as the XML files + # of the documentation are also in UTF-8 encoding, and may contain characters + # not contained in the default Latin 1 encoding. + SetGapDocLaTeXOptions( "utf8", gapdoc_latex_option_record ); + + MakeGAPDocDoc( doc_dir, gapdoc.main, gapdoc.files, gapdoc.bookname, "MathJax" ); + + CopyHTMLStyleFiles( Filename( doc_dir, "" ) ); + + # The following (undocumented) API is there for compatibility + # with old-style gapmacro.tex based package manuals. It + # produces a manual.lab file which those packages can use if + # they wish to link to things in the manual we are currently + # generating. This can probably be removed eventually, but for + # now, doing it does not hurt. + + # FIXME: It seems that this command does not work if pdflatex + # is not present. Maybe we should remove it. + + if not is_worksheet then + GAPDocManualLab( pkg ); + fi; + + fi; + + if IsBound( maketest ) then + + AUTODOC_WriteOnce( maketest, "filename", "maketest.g" ); + AUTODOC_WriteOnce( maketest, "folder", pkg_dir ); + AUTODOC_WriteOnce( maketest, "scan_dir", doc_dir ); + AUTODOC_WriteOnce( maketest, "files_to_scan", gapdoc.files ); + + if IsString( maketest.folder ) then + maketest.folder := Directory( maketest.folder ); + fi; + + if IsString( maketest.scan_dir ) then + maketest.scan_dir := Directory( maketest.scan_dir ); + fi; + + AUTODOC_WriteOnce( maketest, "commands", [ ] ); + AUTODOC_WriteOnce( maketest, "book_name", gapdoc.main ); + + CreateMakeTest( maketest ); + fi; + + return true; +end ); diff --git a/samples/GAP/PackageInfo.g b/samples/GAP/PackageInfo.g new file mode 100644 index 00000000..68e5ecdb --- /dev/null +++ b/samples/GAP/PackageInfo.g @@ -0,0 +1,115 @@ +############################################################################# +## +## PackageInfo.g for the package `cvec' Max Neunhoeffer +## +## (created from Frank Lübeck's PackageInfo.g template file) +## + +SetPackageInfo( rec( + +PackageName := "cvec", +Subtitle := "Compact vectors over finite fields", +Version := "2.5.1", +Date := "04/04/2014", # dd/mm/yyyy format + +## Information about authors and maintainers. +Persons := [ + rec( + LastName := "Neunhoeffer", + FirstNames := "Max", + IsAuthor := true, + IsMaintainer := false, + Email := "neunhoef@mcs.st-and.ac.uk", + WWWHome := "http://www-groups.mcs.st-and.ac.uk/~neunhoef/", + PostalAddress := Concatenation( [ + "School of Mathematics and Statistics\n", + "University of St Andrews\n", + "Mathematical Institute\n", + "North Haugh\n", + "St Andrews, Fife KY16 9SS\n", + "Scotland, UK" ] ), + Place := "St Andrews", + Institution := "University of St Andrews" + ), +], + +## Status information. Currently the following cases are recognized: +## "accepted" for successfully refereed packages +## "deposited" for packages for which the GAP developers agreed +## to distribute them with the core GAP system +## "dev" for development versions of packages +## "other" for all other packages +## +# Status := "accepted", +Status := "deposited", + +## You must provide the next two entries if and only if the status is +## "accepted" because is was successfully refereed: +# format: 'name (place)' +# CommunicatedBy := "Mike Atkinson (St. Andrews)", +#CommunicatedBy := "", +# format: mm/yyyy +# AcceptDate := "08/1999", +#AcceptDate := "", + +PackageWWWHome := "http://neunhoef.github.io/cvec/", +README_URL := Concatenation(~.PackageWWWHome, "README"), +PackageInfoURL := Concatenation(~.PackageWWWHome, "PackageInfo.g"), +ArchiveURL := Concatenation("https://github.com/neunhoef/cvec/", + "releases/download/v", ~.Version, + "/cvec-", ~.Version), +ArchiveFormats := ".tar.gz .tar.bz2", + +## Here you must provide a short abstract explaining the package content +## in HTML format (used on the package overview Web page) and an URL +## for a Webpage with more detailed information about the package +## (not more than a few lines, less is ok): +## Please, use 'GAP' and +## 'MyPKG' for specifing package names. +## +AbstractHTML := + "This package provides an implementation of compact vectors over finite\ + fields. Contrary to earlier implementations no table lookups are used\ + but only word-based processor arithmetic. This allows for bigger finite\ + fields and higher speed.", + +PackageDoc := rec( + BookName := "cvec", + ArchiveURLSubset := ["doc"], + HTMLStart := "doc/chap0.html", + PDFFile := "doc/manual.pdf", + SixFile := "doc/manual.six", + LongTitle := "Compact vectors over finite fields", +), + +Dependencies := rec( + GAP := ">=4.5.5", + NeededOtherPackages := [ + ["GAPDoc", ">= 1.2"], + ["IO", ">= 4.1"], + ["orb", ">= 4.2"], + ], + SuggestedOtherPackages := [], + ExternalConditions := [] +), + +AvailabilityTest := function() + if not "cvec" in SHOW_STAT() and + Filename(DirectoriesPackagePrograms("cvec"), "cvec.so") = fail then + #Info(InfoWarning, 1, "cvec: kernel cvec functions not available."); + return fail; + fi; + return true; +end, + +## *Optional*, but recommended: path relative to package root to a file which +## contains as many tests of the package functionality as sensible. +#TestFile := "tst/testall.g", + +## *Optional*: Here you can list some keyword related to the topic +## of the package. +Keywords := [] + +)); + + diff --git a/samples/GAP/example.gd b/samples/GAP/example.gd new file mode 100644 index 00000000..c285ea32 --- /dev/null +++ b/samples/GAP/example.gd @@ -0,0 +1,23 @@ +############################################################################# +## +#W example.gd +## +## This file contains a sample of a GAP declaration file. +## +DeclareProperty( "SomeProperty", IsLeftModule ); +DeclareGlobalFunction( "SomeGlobalFunction" ); + + +############################################################################# +## +#C IsQuuxFrobnicator() +## +## +## +## +## +## Tests whether R is a quux frobnicator. +## +## +## +DeclareSynonym( "IsQuuxFrobnicator", IsField and IsGroup ); diff --git a/samples/GAP/example.gi b/samples/GAP/example.gi new file mode 100644 index 00000000..c9c5e55d --- /dev/null +++ b/samples/GAP/example.gi @@ -0,0 +1,64 @@ +############################################################################# +## +#W example.gd +## +## This file contains a sample of a GAP implementation file. +## + + +############################################################################# +## +#M SomeOperation( ) +## +## performs some operation on +## +InstallMethod( SomeProperty, + "for left modules", + [ IsLeftModule ], 0, + function( M ) + if IsFreeLeftModule( M ) and not IsTrivial( M ) then + return true; + fi; + TryNextMethod(); + end ); + + + +############################################################################# +## +#F SomeGlobalFunction( ) +## +## A global variadic funfion. +## +InstallGlobalFunction( SomeGlobalFunction, function( arg ) + if Length( arg ) = 3 then + return arg[1] + arg[2] * arg[3]; + elif Length( arg ) = 2 then + return arg[1] - arg[2] + else + Error( "usage: SomeGlobalFunction( , [, ] )" ); + fi; + end ); + + +# +# A plain function. +# +SomeFunc := function(x, y) + local z, func, tmp, j; + z := x * 1.0; + y := 17^17 - y; + func := a -> a mod 5; + tmp := List( [1..50], func ); + while y > 0 do + for j in tmp do + Print(j, "\n"); + od; + repeat + y := y - 1; + until 0 < 1; + y := y -1; + od; + return z; +end; + \ No newline at end of file diff --git a/samples/GAP/vspc.gd b/samples/GAP/vspc.gd new file mode 100644 index 00000000..d381e6f1 --- /dev/null +++ b/samples/GAP/vspc.gd @@ -0,0 +1,822 @@ +############################################################################# +## +#W vspc.gd GAP library Thomas Breuer +## +## +#Y Copyright (C) 1997, Lehrstuhl D für Mathematik, RWTH Aachen, Germany +#Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland +#Y Copyright (C) 2002 The GAP Group +## +## This file declares the operations for vector spaces. +## +## The operations for bases of free left modules can be found in the file +## lib/basis.gd. +## + + +############################################################################# +## +#C IsLeftOperatorRing() +## +## +## +## +## +## +## +## +DeclareSynonym( "IsLeftOperatorRing", + IsLeftOperatorAdditiveGroup and IsRing and IsAssociativeLOpDProd ); +#T really? + + +############################################################################# +## +#C IsLeftOperatorRingWithOne() +## +## +## +## +## +## +## +## +DeclareSynonym( "IsLeftOperatorRingWithOne", + IsLeftOperatorAdditiveGroup and IsRingWithOne + and IsAssociativeLOpDProd ); +#T really? + + +############################################################################# +## +#C IsLeftVectorSpace( ) +#C IsVectorSpace( ) +## +## <#GAPDoc Label="IsLeftVectorSpace"> +## +## +## +## +## +## A vector space in &GAP; is a free left module +## (see ) over a division ring +## (see Chapter ). +##

+## Whenever we talk about an F-vector space V then V is +## an additive group (see ) on which the +## division ring F acts via multiplication from the left such that +## this action and the addition in V are left and right distributive. +## The division ring F can be accessed as value of the attribute +## . +##

+## Vector spaces in &GAP; are always left vector spaces, +## and are +## synonyms. +## +## +## <#/GAPDoc> +## +DeclareSynonym( "IsLeftVectorSpace", + IsLeftModule and IsLeftActedOnByDivisionRing ); + +DeclareSynonym( "IsVectorSpace", IsLeftVectorSpace ); + +InstallTrueMethod( IsFreeLeftModule, + IsLeftModule and IsLeftActedOnByDivisionRing ); + + +############################################################################# +## +#F IsGaussianSpace( ) +## +## <#GAPDoc Label="IsGaussianSpace"> +## +## +## +## +## The filter (see ) +## for the row space (see ) +## or matrix space (see ) V +## over the field F, say, +## indicates that the entries of all row vectors or matrices in V, +## respectively, are all contained in F. +## In this case, V is called a Gaussian vector space. +## Bases for Gaussian spaces can be computed using Gaussian elimination for +## a given list of vector space generators. +## mats:= [ [[1,1],[2,2]], [[3,4],[0,1]] ];; +## gap> V:= VectorSpace( Rationals, mats );; +## gap> IsGaussianSpace( V ); +## true +## gap> mats[1][1][1]:= E(4);; # an element in an extension field +## gap> V:= VectorSpace( Rationals, mats );; +## gap> IsGaussianSpace( V ); +## false +## gap> V:= VectorSpace( Field( Rationals, [ E(4) ] ), mats );; +## gap> IsGaussianSpace( V ); +## true +## ]]> +## +## +## <#/GAPDoc> +## +DeclareFilter( "IsGaussianSpace", IsVectorSpace ); + +InstallTrueMethod( IsGaussianSpace, + IsVectorSpace and IsFullMatrixModule ); + +InstallTrueMethod( IsGaussianSpace, + IsVectorSpace and IsFullRowModule ); + + +############################################################################# +## +#C IsDivisionRing( ) +## +## <#GAPDoc Label="IsDivisionRing"> +## +## +## +## +## A division ring in &GAP; is a nontrivial associative algebra +## D with a multiplicative inverse for each nonzero element. +## In &GAP; every division ring is a vector space over a division ring +## (possibly over itself). +## Note that being a division ring is thus not a property that a ring can +## get, because a ring is usually not represented as a vector space. +##

+## The field of coefficients is stored as the value of the attribute +## of D. +## +## +## <#/GAPDoc> +## +DeclareSynonymAttr( "IsDivisionRing", + IsMagmaWithInversesIfNonzero + and IsLeftOperatorRingWithOne + and IsLeftVectorSpace + and IsNonTrivial + and IsAssociative + and IsEuclideanRing ); + + +############################################################################# +## +#A GeneratorsOfLeftVectorSpace( ) +#A GeneratorsOfVectorSpace( ) +## +## <#GAPDoc Label="GeneratorsOfLeftVectorSpace"> +## +## +## +## +## +## For an F-vector space V, +## returns a list of vectors in +## V that generate V as an F-vector space. +## GeneratorsOfVectorSpace( FullRowSpace( Rationals, 3 ) ); +## [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonymAttr( "GeneratorsOfLeftVectorSpace", + GeneratorsOfLeftOperatorAdditiveGroup ); + +DeclareSynonymAttr( "GeneratorsOfVectorSpace", + GeneratorsOfLeftOperatorAdditiveGroup ); + + +############################################################################# +## +#A CanonicalBasis( ) +## +## <#GAPDoc Label="CanonicalBasis"> +## +## +## +## +## If the vector space V supports a canonical basis then +## returns this basis, +## otherwise fail is returned. +##

+## The defining property of a canonical basis is that its vectors are +## uniquely determined by the vector space. +## If canonical bases exist for two vector spaces over the same left acting +## domain (see ) then the equality of +## these vector spaces can be decided by comparing the canonical bases. +##

+## The exact meaning of a canonical basis depends on the type of V. +## Canonical bases are defined for example for Gaussian row and matrix +## spaces (see ). +##

+## If one designs a new kind of vector spaces +## (see ) and +## defines a canonical basis for these spaces then the +## method one installs +## (see ) +## must not call . +## On the other hand, one probably should install a +## method that simply calls , +## the value of the method +## (see  and +## ) +## being CANONICAL_BASIS_FLAGS. +## vecs:= [ [ 1, 2, 3 ], [ 1, 1, 1 ], [ 1, 1, 1 ] ];; +## gap> V:= VectorSpace( Rationals, vecs );; +## gap> B:= CanonicalBasis( V ); +## CanonicalBasis( ) +## gap> BasisVectors( B ); +## [ [ 1, 0, -1 ], [ 0, 1, 2 ] ] +## ]]> +## +## +## <#/GAPDoc> +## +DeclareAttribute( "CanonicalBasis", IsFreeLeftModule ); + + +############################################################################# +## +#F IsRowSpace( ) +## +## <#GAPDoc Label="IsRowSpace"> +## +## +## +## +## A row space in &GAP; is a vector space that consists of +## row vectors (see Chapter ). +## +## +## <#/GAPDoc> +## +DeclareSynonym( "IsRowSpace", IsRowModule and IsVectorSpace ); + + +############################################################################# +## +#F IsGaussianRowSpace( ) +## +## +## +## +## +## A row space is Gaussian if the left acting domain contains all +## scalars that occur in the vectors. +## Thus one can use Gaussian elimination in the calculations. +##

+## (Otherwise the space is non-Gaussian. +## We will need a flag for this to write down methods that delegate from +## non-Gaussian spaces to Gaussian ones.) +## +## +## +## +DeclareSynonym( "IsGaussianRowSpace", IsGaussianSpace and IsRowSpace ); + + +############################################################################# +## +#F IsNonGaussianRowSpace( ) +## +## +## +## +## +## If an F-vector space V is in the filter +## then this expresses that V +## consists of row vectors (see ) such +## that not all entries in these row vectors are contained in F +## (so Gaussian elimination cannot be used to compute an F-basis +## from a list of vector space generators), +## and that V is handled via the mechanism of nice bases +## (see ) in the following way. +## Let K be the field spanned by the entries of all vectors in +## V. +## Then the value of V is +## a basis B of the field extension K / ( K \cap F ), +## and the value of v \in V +## is defined by replacing each entry of v by the list of its +## B-coefficients, and then forming the concatenation. +##

+## So the associated nice vector space is a Gaussian row space +## (see ). +## +## +## +DeclareHandlingByNiceBasis( "IsNonGaussianRowSpace", + "for non-Gaussian row spaces" ); + + +############################################################################# +## +#F IsMatrixSpace( ) +## +## <#GAPDoc Label="IsMatrixSpace"> +## +## +## +## +## A matrix space in &GAP; is a vector space that consists of matrices +## (see Chapter ). +## +## +## <#/GAPDoc> +## +DeclareSynonym( "IsMatrixSpace", IsMatrixModule and IsVectorSpace ); + + +############################################################################# +## +#F IsGaussianMatrixSpace( ) +## +## +## +## +## +## A matrix space is Gaussian if the left acting domain contains all +## scalars that occur in the vectors. +## Thus one can use Gaussian elimination in the calculations. +##

+## (Otherwise the space is non-Gaussian. +## We will need a flag for this to write down methods that delegate from +## non-Gaussian spaces to Gaussian ones.) +## +## +## +DeclareSynonym( "IsGaussianMatrixSpace", IsGaussianSpace and IsMatrixSpace ); + + +############################################################################# +## +#F IsNonGaussianMatrixSpace( ) +## +## +## +## +## +## If an F-vector space V is in the filter +## +## then this expresses that V consists of matrices +## (see ) +## such that not all entries in these matrices are contained in F +## (so Gaussian elimination cannot be used to compute an F-basis +## from a list of vector space generators), +## and that V is handled via the mechanism of nice bases +## (see ) in the following way. +## Let K be the field spanned by the entries of all vectors in V. +## The value of V is irrelevant, +## and the value of v \in V +## is defined as the concatenation of the rows of v. +##

+## So the associated nice vector space is a (not necessarily Gaussian) +## row space (see ). +## +## +## +DeclareHandlingByNiceBasis( "IsNonGaussianMatrixSpace", + "for non-Gaussian matrix spaces" ); + + +############################################################################# +## +#A NormedRowVectors( ) . . . normed vectors in a Gaussian row space +## +## <#GAPDoc Label="NormedRowVectors"> +## +## +## +## +## For a finite Gaussian row space V +## (see , ), +## returns a list of those nonzero +## vectors in V that have a one in the first nonzero component. +##

+## The result list can be used as action domain for the action of a matrix +## group via , which yields the natural action on +## one-dimensional subspaces of V +## (see also ). +## vecs:= NormedRowVectors( GF(3)^2 ); +## [ [ 0*Z(3), Z(3)^0 ], [ Z(3)^0, 0*Z(3) ], [ Z(3)^0, Z(3)^0 ], +## [ Z(3)^0, Z(3) ] ] +## gap> Action( GL(2,3), vecs, OnLines ); +## Group([ (3,4), (1,2,4) ]) +## ]]> +## +## +## <#/GAPDoc> +## +DeclareAttribute( "NormedRowVectors", IsGaussianSpace ); + + +############################################################################# +## +#A TrivialSubspace( ) +## +## <#GAPDoc Label="TrivialSubspace"> +## +## +## +## +## For a vector space V, returns the +## subspace of V that consists of the zero vector in V. +## V:= GF(3)^3;; +## gap> triv:= TrivialSubspace( V ); +## +## gap> AsSet( triv ); +## [ [ 0*Z(3), 0*Z(3), 0*Z(3) ] ] +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonymAttr( "TrivialSubspace", TrivialSubmodule ); + + +############################################################################# +## +#F VectorSpace( , [, ][, "basis"] ) +## +## <#GAPDoc Label="VectorSpace"> +## +## +## +## +## For a field F and a collection gens of vectors, +## returns the F-vector space spanned by +## the elements in gens. +##

+## The optional argument zero can be used to specify the zero element +## of the space; zero must be given if gens is empty. +## The optional string "basis" indicates that gens is known to +## be linearly independent over F, in particular the dimension of the +## vector space is immediately set; +## note that need not return the basis formed by +## gens if the string "basis" is given as an argument. +## +## V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] ); +## +## ]]> +## +## +## <#/GAPDoc> +## +DeclareGlobalFunction( "VectorSpace" ); + + +############################################################################# +## +#F Subspace( , [, "basis"] ) . subspace of generated by +#F SubspaceNC( , [, "basis"] ) +## +## <#GAPDoc Label="Subspace"> +## +## +## +## +## +## For an F-vector space V and a list or collection +## gens that is a subset of V, +## returns the F-vector space spanned by +## gens; if gens is empty then the trivial subspace +## (see ) of V is returned. +## The parent (see ) of the returned vector space +## is set to V. +##

+## does the same as , +## except that it omits the check whether gens is a subset of +## V. +##

+## The optional string "basis" indicates that gens is known to +## be linearly independent over F. +## In this case the dimension of the subspace is immediately set, +## and both and do +## not check whether gens really is linearly independent and +## whether gens is a subset of V. +## +## V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] );; +## gap> W:= Subspace( V, [ [ 0, 1, 2 ] ] ); +## +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonym( "Subspace", Submodule ); + +DeclareSynonym( "SubspaceNC", SubmoduleNC ); + + +############################################################################# +## +#O AsVectorSpace( , ) . . . . . . . . . view as -vector space +## +## <#GAPDoc Label="AsVectorSpace"> +## +## +## +## +## Let F be a division ring and D a domain. +## If the elements in D form an F-vector space then +## returns this F-vector space, +## otherwise fail is returned. +##

+## can be used for example to view a given +## vector space as a vector space over a smaller or larger division ring. +## V:= FullRowSpace( GF( 27 ), 3 ); +## ( GF(3^3)^3 ) +## gap> Dimension( V ); LeftActingDomain( V ); +## 3 +## GF(3^3) +## gap> W:= AsVectorSpace( GF( 3 ), V ); +## +## gap> Dimension( W ); LeftActingDomain( W ); +## 9 +## GF(3) +## gap> AsVectorSpace( GF( 9 ), V ); +## fail +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonym( "AsVectorSpace", AsLeftModule ); + + +############################################################################# +## +#O AsSubspace( , ) . . . . . . . . . . . view as subspace of +## +## <#GAPDoc Label="AsSubspace"> +## +## +## +## +## Let V be an F-vector space, and U a collection. +## If U is a subset of V such that the elements of U +## form an F-vector space then returns this +## vector space, with parent set to V +## (see ). +## Otherwise fail is returned. +## V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] );; +## gap> W:= VectorSpace( Rationals, [ [ 1/2, 1/2, 1/2 ] ] );; +## gap> U:= AsSubspace( V, W ); +## +## gap> Parent( U ) = V; +## true +## gap> AsSubspace( V, [ [ 1, 1, 1 ] ] ); +## fail +## ]]> +## +## +## <#/GAPDoc> +## +DeclareOperation( "AsSubspace", [ IsVectorSpace, IsCollection ] ); + + +############################################################################# +## +#F Intersection2Spaces( , , ) +## +## +## +## +## +## is a function that takes two arguments V and W which must +## be finite dimensional vector spaces, +## and returns the intersection of V and W. +##

+## If the left acting domains are different then let F be their +## intersection. +## The intersection of V and W is computed as intersection of +## AsStruct( F, V ) and +## AsStruct( F, V ). +##

+## If the left acting domains are equal to F then the intersection of +## V and W is returned either as F-Substruct +## with the common parent of V and W or as +## F-Struct, in both cases with known basis. +##

+## This function is used to handle the intersections of two vector spaces, +## two algebras, two algebras-with-one, two left ideals, two right ideals, +## two two-sided ideals. +## +## +## +DeclareGlobalFunction( "Intersection2Spaces" ); + + +############################################################################# +## +#F FullRowSpace( , ) +## +## <#GAPDoc Label="FullRowSpace"> +## +## +## +## +## +## For a field F and a nonnegative integer n, +## returns the F-vector space that +## consists of all row vectors (see ) of +## length n with entries in F. +##

+## An alternative to construct this vector space is via +## F^n. +## FullRowSpace( GF( 9 ), 3 ); +## ( GF(3^2)^3 ) +## gap> GF(9)^3; # the same as above +## ( GF(3^2)^3 ) +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonym( "FullRowSpace", FullRowModule ); +DeclareSynonym( "RowSpace", FullRowModule ); + + +############################################################################# +## +#F FullMatrixSpace( , , ) +## +## <#GAPDoc Label="FullMatrixSpace"> +## +## +## +## +## +## For a field F and two positive integers m and n, +## returns the F-vector space that +## consists of all m by n matrices +## (see ) with entries in F. +##

+## If m = n then the result is in fact an algebra +## (see ). +##

+## An alternative to construct this vector space is via +## F^[m,n]. +## FullMatrixSpace( GF(2), 4, 5 ); +## ( GF(2)^[ 4, 5 ] ) +## gap> GF(2)^[ 4, 5 ]; # the same as above +## ( GF(2)^[ 4, 5 ] ) +## ]]> +## +## +## <#/GAPDoc> +## +DeclareSynonym( "FullMatrixSpace", FullMatrixModule ); +DeclareSynonym( "MatrixSpace", FullMatrixModule ); +DeclareSynonym( "MatSpace", FullMatrixModule ); + + +############################################################################# +## +#C IsSubspacesVectorSpace( ) +## +## <#GAPDoc Label="IsSubspacesVectorSpace"> +## +## +## +## +## The domain of all subspaces of a (finite) vector space or of all +## subspaces of fixed dimension, as returned by +## (see ) lies in the category +## . +## D:= Subspaces( GF(3)^3 ); +## Subspaces( ( GF(3)^3 ) ) +## gap> Size( D ); +## 28 +## gap> iter:= Iterator( D );; +## gap> NextIterator( iter ); +## +## gap> NextIterator( iter ); +## +## gap> IsSubspacesVectorSpace( D ); +## true +## ]]> +## +## +## <#/GAPDoc> +## +DeclareCategory( "IsSubspacesVectorSpace", IsDomain ); + + +############################################################################# +## +#M IsFinite( ) . . . . . . . . . . . . . . . . . for a subspaces domain +## +## Returns `true' if is finite. +## We allow subspaces domains in `IsSubspacesVectorSpace' only for finite +## vector spaces. +## +InstallTrueMethod( IsFinite, IsSubspacesVectorSpace ); + + +############################################################################# +## +#A Subspaces( [, ] ) +## +## <#GAPDoc Label="Subspaces"> +## +## +## +## +## Called with a finite vector space v, +## returns the domain of all subspaces of V. +##

+## Called with V and a nonnegative integer k, +## returns the domain of all k-dimensional +## subspaces of V. +##

+## Special and methods are +## provided for these domains. +## +## +## +## <#/GAPDoc> +## +DeclareAttribute( "Subspaces", IsLeftModule ); +DeclareOperation( "Subspaces", [ IsLeftModule, IsInt ] ); + + +############################################################################# +## +#F IsSubspace( , ) +## +## +## +## +## +## check that U is a vector space that is contained in V +## +## +## +## +DeclareGlobalFunction( "IsSubspace" ); + + +############################################################################# +## +#A OrthogonalSpaceInFullRowSpace( ) +## +## +## +## +## +## For a Gaussian row space U over F, +## +## returns a complement of U in the full row space of same vector +## dimension as U over F. +## +## +## +DeclareAttribute( "OrthogonalSpaceInFullRowSpace", IsGaussianSpace ); + + +############################################################################# +## +#P IsVectorSpaceHomomorphism( ) +## +## +## +## +## +## A mapping f is a vector space homomorphism (or linear mapping) +## if the source and range are vector spaces +## (see ) +## over the same division ring D +## (see ), +## and if f( a + b ) = f(a) + f(b) and f( s * a ) = s * f(a) +## hold for all elements a, b in the source of f and +## s \in D. +## +## +## +DeclareProperty( "IsVectorSpaceHomomorphism", IsGeneralMapping ); + + +############################################################################# +## +#E + diff --git a/samples/GAP/vspc.gi b/samples/GAP/vspc.gi new file mode 100644 index 00000000..b7a88871 --- /dev/null +++ b/samples/GAP/vspc.gi @@ -0,0 +1,651 @@ +############################################################################# +## +#W vspc.gi GAP library Thomas Breuer +## +## +#Y Copyright (C) 1997, Lehrstuhl D für Mathematik, RWTH Aachen, Germany +#Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland +#Y Copyright (C) 2002 The GAP Group +## +## This file contains generic methods for vector spaces. +## + + +############################################################################# +## +#M SetLeftActingDomain( , ) +## +## check whether the left acting domain of the external left set +## knows that it is a division ring. +## This is used, e.g., to tell a free module over a division ring +## that it is a vector space. +## +InstallOtherMethod( SetLeftActingDomain, + "method to set also 'IsLeftActedOnByDivisionRing'", + [ IsAttributeStoringRep and IsLeftActedOnByRing, IsObject ],0, + function( extL, D ) + if HasIsDivisionRing( D ) and IsDivisionRing( D ) then + SetIsLeftActedOnByDivisionRing( extL, true ); + fi; + TryNextMethod(); + end ); + + +############################################################################# +## +#M IsLeftActedOnByDivisionRing( ) +## +InstallMethod( IsLeftActedOnByDivisionRing, + "method for external left set that is left acted on by a ring", + [ IsExtLSet and IsLeftActedOnByRing ], + function( M ) + if IsIdenticalObj( M, LeftActingDomain( M ) ) then + TryNextMethod(); + else + return IsDivisionRing( LeftActingDomain( M ) ); + fi; + end ); + + +############################################################################# +## +#F VectorSpace( , [, ][, "basis"] ) +## +## The only difference between `VectorSpace' and `FreeLeftModule' shall be +## that the left acting domain of a vector space must be a division ring. +## +InstallGlobalFunction( VectorSpace, function( arg ) + if Length( arg ) = 0 or not IsDivisionRing( arg[1] ) then + Error( "usage: VectorSpace( , [, ][, \"basis\"] )" ); + fi; + return CallFuncList( FreeLeftModule, arg ); + end ); + + +############################################################################# +## +#M AsSubspace( , ) . . . . . . . for a vector space and a collection +## +InstallMethod( AsSubspace, + "for a vector space and a collection", + [ IsVectorSpace, IsCollection ], + function( V, C ) + local newC; + + if not IsSubset( V, C ) then + return fail; + fi; + newC:= AsVectorSpace( LeftActingDomain( V ), C ); + if newC = fail then + return fail; + fi; + SetParent( newC, V ); + UseIsomorphismRelation( C, newC ); + UseSubsetRelation( C, newC ); + + return newC; + end ); + + +############################################################################# +## +#M AsLeftModule( , ) . . . . . . for division ring and vector space +## +## View the vector space as a vector space over the division ring . +## +InstallMethod( AsLeftModule, + "method for a division ring and a vector space", + [ IsDivisionRing, IsVectorSpace ], + function( F, V ) + + local W, # the space, result + base, # basis vectors of field extension + gen, # loop over generators of 'V' + b, # loop over 'base' + gens, # generators of 'V' + newgens; # extended list of generators + + if Characteristic( F ) <> Characteristic( LeftActingDomain( V ) ) then + + # This is impossible. + return fail; + + elif F = LeftActingDomain( V ) then + + # No change of the left acting domain is necessary. + return V; + + elif IsSubset( F, LeftActingDomain( V ) ) then + + # Check whether 'V' is really a space over the bigger field, + # that is, whether the set of elements does not change. + base:= BasisVectors( Basis( AsField( LeftActingDomain( V ), F ) ) ); + for gen in GeneratorsOfLeftModule( V ) do + for b in base do + if not b * gen in V then + + # The field extension would change the set of elements. + return fail; + + fi; + od; + od; + + # Construct the space. + W:= LeftModuleByGenerators( F, GeneratorsOfLeftModule(V), Zero(V) ); + + elif IsSubset( LeftActingDomain( V ), F ) then + + # View 'V' as a space over a smaller field. + # For that, the list of generators must be extended. + gens:= GeneratorsOfLeftModule( V ); + if IsEmpty( gens ) then + W:= LeftModuleByGenerators( F, [], Zero( V ) ); + else + + base:= BasisVectors( Basis( AsField( F, LeftActingDomain( V ) ) ) ); + newgens:= []; + for b in base do + for gen in gens do + Add( newgens, b * gen ); + od; + od; + W:= LeftModuleByGenerators( F, newgens ); + + fi; + + else + + # View 'V' first as space over the intersection of fields, + # and then over the desired field. + return AsLeftModule( F, + AsLeftModule( Intersection( F, + LeftActingDomain( V ) ), V ) ); + + fi; + + UseIsomorphismRelation( V, W ); + UseSubsetRelation( V, W ); + return W; + end ); + + +############################################################################# +## +#M ViewObj( ) . . . . . . . . . . . . . . . . . . . view a vector space +## +## print left acting domain, if known also dimension or no. of generators +## +InstallMethod( ViewObj, + "for vector space with known generators", + [ IsVectorSpace and HasGeneratorsOfLeftModule ], + function( V ) + Print( "" ); + end ); + +InstallMethod( ViewObj, + "for vector space with known dimension", + [ IsVectorSpace and HasDimension ], + 1, # override method for known generators + function( V ) + Print( "" ); + end ); + +InstallMethod( ViewObj, + "for vector space", + [ IsVectorSpace ], + function( V ) + Print( "" ); + end ); + + +############################################################################# +## +#M PrintObj( ) . . . . . . . . . . . . . . . . . . . for a vector space +## +InstallMethod( PrintObj, + "method for vector space with left module generators", + [ IsVectorSpace and HasGeneratorsOfLeftModule ], + function( V ) + Print( "VectorSpace( ", LeftActingDomain( V ), ", ", + GeneratorsOfLeftModule( V ) ); + if IsEmpty( GeneratorsOfLeftModule( V ) ) and HasZero( V ) then + Print( ", ", Zero( V ), " )" ); + else + Print( " )" ); + fi; + end ); + +InstallMethod( PrintObj, + "method for vector space", + [ IsVectorSpace ], + function( V ) + Print( "VectorSpace( ", LeftActingDomain( V ), ", ... )" ); + end ); + + +############################################################################# +## +#M \/( , ) . . . . . . . . . factor of a vector space by a subspace +#M \/( , ) . . . . . . factor of a vector space by a subspace +## +InstallOtherMethod( \/, + "method for vector space and collection", + IsIdenticalObj, + [ IsVectorSpace, IsCollection ], + function( V, vectors ) + if IsVectorSpace( vectors ) then + TryNextMethod(); + else + return V / Subspace( V, vectors ); + fi; + end ); + +InstallOtherMethod( \/, + "generic method for two vector spaces", + IsIdenticalObj, + [ IsVectorSpace, IsVectorSpace ], + function( V, W ) + return ImagesSource( NaturalHomomorphismBySubspace( V, W ) ); + end ); + + +############################################################################# +## +#M Intersection2Spaces( , , ) +## +InstallGlobalFunction( Intersection2Spaces, + function( AsStructure, Substructure, Structure ) + return function( V, W ) + local inters, # intersection, result + F, # coefficients field + gensV, # list of generators of 'V' + gensW, # list of generators of 'W' + VW, # sum of 'V' and 'W' + B; # basis of 'VW' + + if LeftActingDomain( V ) <> LeftActingDomain( W ) then + + # Compute the intersection as vector space over the intersection + # of the coefficients fields. + # (Note that the characteristic is the same.) + F:= Intersection2( LeftActingDomain( V ), LeftActingDomain( W ) ); + return Intersection2( AsStructure( F, V ), AsStructure( F, W ) ); + + elif IsFiniteDimensional( V ) and IsFiniteDimensional( W ) then + + # Compute the intersection of two spaces over the same field. + gensV:= GeneratorsOfLeftModule( V ); + gensW:= GeneratorsOfLeftModule( W ); + if IsEmpty( gensV ) then + if Zero( V ) in W then + inters:= V; + else + inters:= []; + fi; + elif IsEmpty( gensW ) then + if Zero( V ) in W then + inters:= W; + else + inters:= []; + fi; + else + # Compute a common coefficient space. + VW:= LeftModuleByGenerators( LeftActingDomain( V ), + Concatenation( gensV, gensW ) ); + B:= Basis( VW ); + + # Construct the coefficient subspaces corresponding to 'V' and 'W'. + gensV:= List( gensV, x -> Coefficients( B, x ) ); + gensW:= List( gensW, x -> Coefficients( B, x ) ); + + # Construct the intersection of row spaces, and carry back to VW. + inters:= List( SumIntersectionMat( gensV, gensW )[2], + x -> LinearCombination( B, x ) ); + + # Construct the intersection space, if possible with a parent. + if HasParent( V ) and HasParent( W ) + and IsIdenticalObj( Parent( V ), Parent( W ) ) then + inters:= Substructure( Parent( V ), inters, "basis" ); + elif IsEmpty( inters ) then + inters:= Substructure( V, inters, "basis" ); + SetIsTrivial( inters, true ); + else + inters:= Structure( LeftActingDomain( V ), inters, "basis" ); + fi; + + # Run implications by the subset relation. + UseSubsetRelation( V, inters ); + UseSubsetRelation( W, inters ); + fi; + + # Return the result. + return inters; + + else + TryNextMethod(); + fi; + end; +end ); + + +############################################################################# +## +#M Intersection2( , ) . . . . . . . . . . . . . for two vector spaces +## +InstallMethod( Intersection2, + "method for two vector spaces", + IsIdenticalObj, + [ IsVectorSpace, IsVectorSpace ], + Intersection2Spaces( AsLeftModule, SubspaceNC, VectorSpace ) ); + + +############################################################################# +## +#M ClosureLeftModule( , ) . . . . . . . . . closure of a vector space +## +InstallMethod( ClosureLeftModule, + "method for a vector space with basis, and a vector", + IsCollsElms, + [ IsVectorSpace and HasBasis, IsVector ], + function( V, w ) + local B; # basis of 'V' + + # We can test membership easily. + B:= Basis( V ); +#T why easily? + if Coefficients( B, w ) = fail then + + # In the case of a vector space, we know a basis of the closure. + B:= Concatenation( BasisVectors( B ), [ w ] ); + V:= LeftModuleByGenerators( LeftActingDomain( V ), B ); + UseBasis( V, B ); + + fi; + return V; + end ); + + +############################################################################# +## +## Methods for collections of subspaces of a vector space +## + + +############################################################################# +## +#R IsSubspacesVectorSpaceDefaultRep( ) +## +## is the representation of domains of subspaces of a vector space , +## with the components 'structure' (with value ) and 'dimension' +## (with value either the dimension of the subspaces in the domain +## or the string '\"all\"', which means that the domain contains all +## subspaces of ). +## +DeclareRepresentation( + "IsSubspacesVectorSpaceDefaultRep", + IsComponentObjectRep, + [ "dimension", "structure" ] ); +#T not IsAttributeStoringRep? + + +############################################################################# +## +#M PrintObj( ) . . . . . . . . . . . . . . . . . for a subspaces domain +## +InstallMethod( PrintObj, + "method for a subspaces domain", + [ IsSubspacesVectorSpace and IsSubspacesVectorSpaceDefaultRep ], + function( D ) + if IsInt( D!.dimension ) then + Print( "Subspaces( ", D!.structure, ", ", D!.dimension, " )" ); + else + Print( "Subspaces( ", D!.structure, " )" ); + fi; + end ); + + +############################################################################# +## +#M Size( ) . . . . . . . . . . . . . . . . . . . for a subspaces domain +## +## The number of $k$-dimensional subspaces in a $n$-dimensional space over +## the field with $q$ elements is +## $$ +## a(n,k) = \prod_{i=0}^{k-1} \frac{q^n-q^i}{q^k-q^i} = +## \prod_{i=0}^{k-1} \frac{q^{n-i}-1}{q^{k-i}-1}. +## $$ +## We have the recursion +## $$ +## a(n,k+1) = a(n,k) \frac{q^{n-i}-1}{q^{i+1}-1}. +## $$ +## +## (The number of all subspaces is $\sum_{k=0}^n a(n,k)$.) +## +InstallMethod( Size, + "method for a subspaces domain", + [ IsSubspacesVectorSpace and IsSubspacesVectorSpaceDefaultRep ], + function( D ) + + local k, + n, + q, + size, + qn, + qd, + ank, + i; + + if D!.dimension = "all" then + + # all subspaces of the space + n:= Dimension( D!.structure ); + + q:= Size( LeftActingDomain( D!.structure ) ); + size:= 1; + qn:= q^n; + qd:= q; + + # $a(n,0)$ + ank:= 1; + + for k in [ 1 .. Int( (n-1)/2 ) ] do + + # Compute $a(n,k)$. + ank:= ank * ( qn - 1 ) / ( qd - 1 ); + qn:= qn / q; + qd:= qd * q; + + size:= size + ank; + + od; + + size:= 2 * size; + + if n mod 2 = 0 then + + # Add the number of spaces of dimension $n/2$. + size:= size + ank * ( qn - 1 ) / ( qd - 1 ); + fi; + + else + + # number of spaces of dimension 'k' only + n:= Dimension( D!.structure ); + if D!.dimension < 0 or + n < D!.dimension then + return 0; + elif n / 2 < D!.dimension then + k:= n - D!.dimension; + else + k:= D!.dimension; + fi; + + q:= Size( LeftActingDomain( D!.structure ) ); + size:= 1; + + qn:= q^n; + qd:= q; + for i in [ 1 .. k ] do + size:= size * ( qn - 1 ) / ( qd - 1 ); + qn:= qn / q; + qd:= qd * q; + od; + + fi; + + # Return the result. + return size; + end ); + + +############################################################################# +## +#M Enumerator( ) . . . . . . . . . . . . . . . . for a subspaces domain +## +## Use the iterator to compute the elements list. +#T This is not allowed! +## +InstallMethod( Enumerator, + "method for a subspaces domain", + [ IsSubspacesVectorSpace and IsSubspacesVectorSpaceDefaultRep ], + function( D ) + local iter, # iterator for 'D' + elms; # elements list, result + + iter:= Iterator( D ); + elms:= []; + while not IsDoneIterator( iter ) do + Add( elms, NextIterator( iter ) ); + od; + return elms; + end ); +#T necessary? + + +############################################################################# +## +#M Iterator( ) . . . . . . . . . . . . . . . . . for a subspaces domain +## +## uses the subspaces iterator for full row spaces and the mechanism of +## associated row spaces. +## +BindGlobal( "IsDoneIterator_Subspaces", + iter -> IsDoneIterator( iter!.associatedIterator ) ); + +BindGlobal( "NextIterator_Subspaces", function( iter ) + local next; + next:= NextIterator( iter!.associatedIterator ); + next:= List( GeneratorsOfLeftModule( next ), + x -> LinearCombination( iter!.basis, x ) ); + return Subspace( iter!.structure, next, "basis" ); + end ); + +BindGlobal( "ShallowCopy_Subspaces", + iter -> rec( structure := iter!.structure, + basis := iter!.basis, + associatedIterator := ShallowCopy( + iter!.associatedIterator ) ) ); + +InstallMethod( Iterator, + "for a subspaces domain", + [ IsSubspacesVectorSpace and IsSubspacesVectorSpaceDefaultRep ], + function( D ) + local V; # the vector space + + V:= D!.structure; + return IteratorByFunctions( rec( + IsDoneIterator := IsDoneIterator_Subspaces, + NextIterator := NextIterator_Subspaces, + ShallowCopy := ShallowCopy_Subspaces, + structure := V, + basis := Basis( V ), + associatedIterator := Iterator( + Subspaces( FullRowSpace( LeftActingDomain( V ), + Dimension( V ) ), + D!.dimension ) ) ) ); + end ); + + +############################################################################# +## +#M Subspaces( , ) +## +InstallMethod( Subspaces, + "for a vector space, and an integer", + [ IsVectorSpace, IsInt ], + function( V, dim ) + if IsFinite( V ) then + return Objectify( NewType( CollectionsFamily( FamilyObj( V ) ), + IsSubspacesVectorSpace + and IsSubspacesVectorSpaceDefaultRep ), + rec( + structure := V, + dimension := dim + ) + ); + else + TryNextMethod(); + fi; + end ); + + +############################################################################# +## +#M Subspaces( ) +## +InstallMethod( Subspaces, + "for a vector space", + [ IsVectorSpace ], + function( V ) + if IsFinite( V ) then + return Objectify( NewType( CollectionsFamily( FamilyObj( V ) ), + IsSubspacesVectorSpace + and IsSubspacesVectorSpaceDefaultRep ), + rec( + structure := V, + dimension := "all" + ) + ); + else + TryNextMethod(); + fi; + end ); + + +############################################################################# +## +#F IsSubspace( , ) . . . . . . . . . . . . . . . . . check <= +## +InstallGlobalFunction( IsSubspace, function( V, U ) + return IsVectorSpace( U ) and IsSubset( V, U ); +end ); + + +############################################################################# +## +#M IsVectorSpaceHomomorphism( ) +## +InstallMethod( IsVectorSpaceHomomorphism, + [ IsGeneralMapping ], + function( map ) + local S, R, F; + S:= Source( map ); + if not IsVectorSpace( S ) then + return false; + fi; + R:= Range( map ); + if not IsVectorSpace( R ) then + return false; + fi; + F:= LeftActingDomain( S ); + return ( F = LeftActingDomain( R ) ) and IsLinearMapping( F, map ); + end ); + + +############################################################################# +## +#E + diff --git a/samples/GLSL/SimpleLighting.gl2.frag b/samples/GLSL/SimpleLighting.gl2.frag new file mode 100644 index 00000000..bb851f86 --- /dev/null +++ b/samples/GLSL/SimpleLighting.gl2.frag @@ -0,0 +1,9 @@ +static const char* SimpleFragmentShader = STRINGIFY( + +varying vec4 FrontColor; + +void main(void) +{ + gl_FragColor = FrontColor; +} +); diff --git a/samples/GLSL/recurse1.frag b/samples/GLSL/recurse1.frag new file mode 100644 index 00000000..66b4c3fe --- /dev/null +++ b/samples/GLSL/recurse1.frag @@ -0,0 +1,48 @@ +#version 330 core + +// cross-unit recursion + +void main() {} + +// two-level recursion + +float cbar(int); + +void cfoo(float) +{ + cbar(2); +} + +// four-level, out of order + +void CB(); +void CD(); +void CA() { CB(); } +void CC() { CD(); } + +// high degree + +void CBT(); +void CDT(); +void CAT() { CBT(); CBT(); CBT(); } +void CCT() { CDT(); CDT(); CBT(); } + +// not recursive + +void norA() {} +void norB() { norA(); } +void norC() { norA(); } +void norD() { norA(); } +void norE() { norB(); } +void norF() { norB(); } +void norG() { norE(); } +void norH() { norE(); } +void norI() { norE(); } + +// not recursive, but with a call leading into a cycle if ignoring direction + +void norcA() { } +void norcB() { norcA(); } +void norcC() { norcB(); } +void norcD() { norcC(); norcB(); } // head of cycle +void norcE() { norcD(); } // lead into cycle diff --git a/samples/Game Maker Language/ClientBeginStep.gml b/samples/Game Maker Language/ClientBeginStep.gml new file mode 100644 index 00000000..64d14110 --- /dev/null +++ b/samples/Game Maker Language/ClientBeginStep.gml @@ -0,0 +1,642 @@ +/* + Originally from /Source/gg2/Scripts/Client/ClientBeginStep.gml in Gang Garrison 2 + + Copyright (C) 2008-2013 Faucet Software + http://www.ganggarrison.com + + This program is free software; + you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3 of the License, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, + see . + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +// receive and interpret the server's message(s) +var i, playerObject, playerID, player, otherPlayerID, otherPlayer, sameVersion, buffer, plugins, pluginsRequired, usePlugins; + +if(tcp_eof(global.serverSocket)) { + if(gotServerHello) + show_message("You have been disconnected from the server."); + else + show_message("Unable to connect to the server."); + instance_destroy(); + exit; +} + +if(room == DownloadRoom and keyboard_check(vk_escape)) +{ + instance_destroy(); + exit; +} + +if(downloadingMap) +{ + while(tcp_receive(global.serverSocket, min(1024, downloadMapBytes-buffer_size(downloadMapBuffer)))) + { + write_buffer(downloadMapBuffer, global.serverSocket); + if(buffer_size(downloadMapBuffer) == downloadMapBytes) + { + write_buffer_to_file(downloadMapBuffer, "Maps/" + downloadMapName + ".png"); + downloadingMap = false; + buffer_destroy(downloadMapBuffer); + downloadMapBuffer = -1; + exit; + } + } + exit; +} + +roomchange = false; +do { + if(tcp_receive(global.serverSocket,1)) { + switch(read_ubyte(global.serverSocket)) { + case HELLO: + gotServerHello = true; + global.joinedServerName = receivestring(global.serverSocket, 1); + downloadMapName = receivestring(global.serverSocket, 1); + advertisedMapMd5 = receivestring(global.serverSocket, 1); + receiveCompleteMessage(global.serverSocket, 1, global.tempBuffer); + pluginsRequired = read_ubyte(global.tempBuffer); + plugins = receivestring(global.serverSocket, 1); + if(string_pos("/", downloadMapName) != 0 or string_pos("\", downloadMapName) != 0) + { + show_message("Server sent illegal map name: "+downloadMapName); + instance_destroy(); + exit; + } + + if (!noReloadPlugins && string_length(plugins)) + { + usePlugins = pluginsRequired || !global.serverPluginsPrompt; + if (global.serverPluginsPrompt) + { + var prompt; + if (pluginsRequired) + { + prompt = show_question( + "This server requires the following plugins to play on it: " + + string_replace_all(plugins, ",", "#") + + '#They are downloaded from the source: "' + + PLUGIN_SOURCE + + '"#The source states: "' + + PLUGIN_SOURCE_NOTICE + + '"#Do you wish to download them and continue connecting?' + ); + if (!prompt) + { + instance_destroy(); + exit; + } + } + else + { + prompt = show_question( + "This server suggests the following optional plugins to play on it: " + + string_replace_all(plugins, ",", "#") + + '#They are downloaded from the source: "' + + PLUGIN_SOURCE + + '"#The source states: "' + + PLUGIN_SOURCE_NOTICE + + '"#Do you wish to download them and use them?' + ); + if (prompt) + { + usePlugins = true; + } + } + } + if (usePlugins) + { + if (!loadserverplugins(plugins)) + { + show_message("Error ocurred loading server-sent plugins."); + instance_destroy(); + exit; + } + global.serverPluginsInUse = true; + } + } + noReloadPlugins = false; + + if(advertisedMapMd5 != "") + { + var download; + download = not file_exists("Maps/" + downloadMapName + ".png"); + if(!download and CustomMapGetMapMD5(downloadMapName) != advertisedMapMd5) + { + if(show_question("The server's copy of the map (" + downloadMapName + ") differs from ours.#Would you like to download this server's version of the map?")) + download = true; + else + { + instance_destroy(); + exit; + } + } + + if(download) + { + write_ubyte(global.serverSocket, DOWNLOAD_MAP); + socket_send(global.serverSocket); + receiveCompleteMessage(global.serverSocket,4,global.tempBuffer); + downloadMapBytes = read_uint(global.tempBuffer); + downloadMapBuffer = buffer_create(); + downloadingMap = true; + roomchange=true; + } + } + ClientPlayerJoin(global.serverSocket); + if(global.rewardKey != "" and global.rewardId != "") + { + var rewardId; + rewardId = string_copy(global.rewardId, 0, 255); + write_ubyte(global.serverSocket, REWARD_REQUEST); + write_ubyte(global.serverSocket, string_length(rewardId)); + write_string(global.serverSocket, rewardId); + } + if(global.queueJumping == true) + { + write_ubyte(global.serverSocket, CLIENT_SETTINGS); + write_ubyte(global.serverSocket, global.queueJumping); + } + socket_send(global.serverSocket); + break; + + case JOIN_UPDATE: + receiveCompleteMessage(global.serverSocket,2,global.tempBuffer); + global.playerID = read_ubyte(global.tempBuffer); + global.currentMapArea = read_ubyte(global.tempBuffer); + break; + + case FULL_UPDATE: + deserializeState(FULL_UPDATE); + break; + + case QUICK_UPDATE: + deserializeState(QUICK_UPDATE); + break; + + case CAPS_UPDATE: + deserializeState(CAPS_UPDATE); + break; + + case INPUTSTATE: + deserializeState(INPUTSTATE); + break; + + case PLAYER_JOIN: + player = instance_create(0,0,Player); + player.name = receivestring(global.serverSocket, 1); + + ds_list_add(global.players, player); + if(ds_list_size(global.players)-1 == global.playerID) { + global.myself = player; + instance_create(0,0,PlayerControl); + } + break; + + case PLAYER_LEAVE: + // Delete player from the game, adjust own ID accordingly + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + playerID = read_ubyte(global.tempBuffer); + player = ds_list_find_value(global.players, playerID); + removePlayer(player); + if(playerID < global.playerID) { + global.playerID -= 1; + } + break; + + case PLAYER_DEATH: + var causeOfDeath, assistantPlayerID, assistantPlayer; + receiveCompleteMessage(global.serverSocket,4,global.tempBuffer); + playerID = read_ubyte(global.tempBuffer); + otherPlayerID = read_ubyte(global.tempBuffer); + assistantPlayerID = read_ubyte(global.tempBuffer); + causeOfDeath = read_ubyte(global.tempBuffer); + + player = ds_list_find_value(global.players, playerID); + + otherPlayer = noone; + if(otherPlayerID != 255) + otherPlayer = ds_list_find_value(global.players, otherPlayerID); + + assistantPlayer = noone; + if(assistantPlayerID != 255) + assistantPlayer = ds_list_find_value(global.players, assistantPlayerID); + + doEventPlayerDeath(player, otherPlayer, assistantPlayer, causeOfDeath); + break; + + case BALANCE: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + balanceplayer=read_ubyte(global.tempBuffer); + if balanceplayer == 255 { + if !instance_exists(Balancer) instance_create(x,y,Balancer); + with(Balancer) notice=0; + } else { + player = ds_list_find_value(global.players, balanceplayer); + if(player.object != -1) { + with(player.object) { + instance_destroy(); + } + player.object = -1; + } + if(player.team==TEAM_RED) { + player.team = TEAM_BLUE; + } else { + player.team = TEAM_RED; + } + if !instance_exists(Balancer) instance_create(x,y,Balancer); + Balancer.name=player.name; + with (Balancer) notice=1; + } + break; + + case PLAYER_CHANGETEAM: + receiveCompleteMessage(global.serverSocket,2,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + if(player.object != -1) { + with(player.object) { + instance_destroy(); + } + player.object = -1; + } + player.team = read_ubyte(global.tempBuffer); + break; + + case PLAYER_CHANGECLASS: + receiveCompleteMessage(global.serverSocket,2,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + if(player.object != -1) { + with(player.object) { + instance_destroy(); + } + player.object = -1; + } + player.class = read_ubyte(global.tempBuffer); + break; + + case PLAYER_CHANGENAME: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + player.name = receivestring(global.serverSocket, 1); + if player=global.myself { + global.playerName=player.name + } + break; + + case PLAYER_SPAWN: + receiveCompleteMessage(global.serverSocket,3,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventSpawn(player, read_ubyte(global.tempBuffer), read_ubyte(global.tempBuffer)); + break; + + case CHAT_BUBBLE: + var bubbleImage; + receiveCompleteMessage(global.serverSocket,2,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + setChatBubble(player, read_ubyte(global.tempBuffer)); + break; + + case BUILD_SENTRY: + receiveCompleteMessage(global.serverSocket,6,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + buildSentry(player, read_ushort(global.tempBuffer)/5, read_ushort(global.tempBuffer)/5, read_byte(global.tempBuffer)); + break; + + case DESTROY_SENTRY: + receiveCompleteMessage(global.serverSocket,4,global.tempBuffer); + playerID = read_ubyte(global.tempBuffer); + otherPlayerID = read_ubyte(global.tempBuffer); + assistantPlayerID = read_ubyte(global.tempBuffer); + causeOfDeath = read_ubyte(global.tempBuffer); + + player = ds_list_find_value(global.players, playerID); + if(otherPlayerID == 255) { + doEventDestruction(player, noone, noone, causeOfDeath); + } else { + otherPlayer = ds_list_find_value(global.players, otherPlayerID); + if (assistantPlayerID == 255) { + doEventDestruction(player, otherPlayer, noone, causeOfDeath); + } else { + assistantPlayer = ds_list_find_value(global.players, assistantPlayerID); + doEventDestruction(player, otherPlayer, assistantPlayer, causeOfDeath); + } + } + break; + + case GRAB_INTEL: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventGrabIntel(player); + break; + + case SCORE_INTEL: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventScoreIntel(player); + break; + + case DROP_INTEL: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventDropIntel(player); + break; + + case RETURN_INTEL: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + doEventReturnIntel(read_ubyte(global.tempBuffer)); + break; + + case GENERATOR_DESTROY: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + team = read_ubyte(global.tempBuffer); + doEventGeneratorDestroy(team); + break; + + case UBER_CHARGED: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventUberReady(player); + break; + + case UBER: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + doEventUber(player); + break; + + case OMNOMNOMNOM: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + if(player.object != -1) { + with(player.object) { + omnomnomnom=true; + if(hp < 200) + { + canEat = false; + alarm[6] = eatCooldown; //10 second cooldown + } + if(player.team == TEAM_RED) { + omnomnomnomindex=0; + omnomnomnomend=31; + } else if(player.team==TEAM_BLUE) { + omnomnomnomindex=32; + omnomnomnomend=63; + } + xscale=image_xscale; + } + } + break; + + case TOGGLE_ZOOM: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + player = ds_list_find_value(global.players, read_ubyte(global.tempBuffer)); + if player.object != -1 { + toggleZoom(player.object); + } + break; + + case PASSWORD_REQUEST: + if(!usePreviousPwd) + global.clientPassword = get_string("Enter Password:", ""); + write_ubyte(global.serverSocket, string_length(global.clientPassword)); + write_string(global.serverSocket, global.clientPassword); + socket_send(global.serverSocket); + break; + + case PASSWORD_WRONG: + show_message("Incorrect Password."); + instance_destroy(); + exit; + + case INCOMPATIBLE_PROTOCOL: + show_message("Incompatible server protocol version."); + instance_destroy(); + exit; + + case KICK: + receiveCompleteMessage(global.serverSocket,1,global.tempBuffer); + reason = read_ubyte(global.tempBuffer); + if reason == KICK_NAME kickReason = "Name Exploit"; + else if reason == KICK_BAD_PLUGIN_PACKET kickReason = "Invalid plugin packet ID"; + else if reason == KICK_MULTI_CLIENT kickReason = "There are too many connections from your IP"; + else kickReason = ""; + show_message("You have been kicked from the server. "+kickReason+"."); + instance_destroy(); + exit; + + case ARENA_STARTROUND: + doEventArenaStartRound(); + break; + + case ARENA_ENDROUND: + with ArenaHUD clientArenaEndRound(); + break; + + case ARENA_RESTART: + doEventArenaRestart(); + break; + + case UNLOCKCP: + doEventUnlockCP(); + break; + + case MAP_END: + global.nextMap=receivestring(global.serverSocket, 1); + receiveCompleteMessage(global.serverSocket,2,global.tempBuffer); + global.winners=read_ubyte(global.tempBuffer); + global.currentMapArea=read_ubyte(global.tempBuffer); + global.mapchanging = true; + if !instance_exists(ScoreTableController) instance_create(0,0,ScoreTableController); + instance_create(0,0,WinBanner); + break; + + case CHANGE_MAP: + roomchange=true; + global.mapchanging = false; + global.currentMap = receivestring(global.serverSocket, 1); + global.currentMapMD5 = receivestring(global.serverSocket, 1); + if(global.currentMapMD5 == "") { // if this is an internal map (signified by the lack of an md5) + if(findInternalMapRoom(global.currentMap)) + room_goto_fix(findInternalMapRoom(global.currentMap)); + else + { + show_message("Error:#Server went to invalid internal map: " + global.currentMap + "#Exiting."); + instance_destroy(); + exit; + } + } else { // it's an external map + if(string_pos("/", global.currentMap) != 0 or string_pos("\", global.currentMap) != 0) + { + show_message("Server sent illegal map name: "+global.currentMap); + instance_destroy(); + exit; + } + if(!file_exists("Maps/" + global.currentMap + ".png") or CustomMapGetMapMD5(global.currentMap) != global.currentMapMD5) + { // Reconnect to the server to download the map + var oldReturnRoom; + oldReturnRoom = returnRoom; + returnRoom = DownloadRoom; + if (global.serverPluginsInUse) + noUnloadPlugins = true; + event_perform(ev_destroy,0); + ClientCreate(); + if (global.serverPluginsInUse) + noReloadPlugins = true; + returnRoom = oldReturnRoom; + usePreviousPwd = true; + exit; + } + room_goto_fix(CustomMapRoom); + } + + for(i=0; i. + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ +// Downloading code. + +var downloadHandle, url, tmpfile, window_oldshowborder, window_oldfullscreen; +timeLeft = 0; +counter = 0; +AudioControlPlaySong(-1, false); +window_oldshowborder = window_get_showborder(); +window_oldfullscreen = window_get_fullscreen(); +window_set_fullscreen(false); +window_set_showborder(false); + +if(global.updaterBetaChannel) + url = UPDATE_SOURCE_BETA; +else + url = UPDATE_SOURCE; + +tmpfile = temp_directory + "\gg2update.zip"; + +downloadHandle = httpGet(url, -1); + +while(!httpRequestStatus(downloadHandle)) +{ // while download isn't finished + sleep(floor(1000/30)); // sleep for the equivalent of one frame + io_handle(); // this prevents GameMaker from appearing locked-up + httpRequestStep(downloadHandle); + + // check if the user cancelled the download with the esc key + if(keyboard_check(vk_escape)) + { + httpRequestDestroy(downloadHandle); + window_set_showborder(window_oldshowborder); + window_set_fullscreen(window_oldfullscreen); + room_goto_fix(Menu); + exit; + } + + if(counter == 0 || counter mod 60 == 0) + timer = random(359)+1; + draw_sprite(UpdaterBackgroundS,0,0,0); + draw_set_color(c_white); + draw_set_halign(fa_left); + draw_set_valign(fa_center); + minutes=floor(timer/60); + seconds=floor(timer-minutes*60); + draw_text(x,y-20,string(minutes) + " minutes " + string(seconds) + " seconds Remaining..."); + counter+=1; + var progress, size; + progress = httpRequestResponseBodyProgress(downloadHandle); + size = httpRequestResponseBodySize(downloadHandle); + if (size != -1) + { + progressBar = floor((progress/size) * 20); + offset = 3; + for(i=0;i. + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +xoffset = view_xview[0]; +yoffset = view_yview[0]; +xsize = view_wview[0]; +ysize = view_hview[0]; + +if (distance_to_point(xoffset+xsize/2,yoffset+ysize/2) > 800) + exit; + +var xr, yr; +xr = round(x); +yr = round(y); + +image_alpha = cloakAlpha; + +if (global.myself.team == team and canCloak) + image_alpha = cloakAlpha/2 + 0.5; + +if (invisible) + exit; + +if(stabbing) + image_alpha -= power(currentWeapon.stab.alpha, 2); + +if team == global.myself.team && (player != global.myself || global.showHealthBar == 1){ + draw_set_alpha(1); + draw_healthbar(xr-10, yr-30, xr+10, yr-25,hp*100/maxHp,c_black,c_red,c_green,0,true,true); +} +if(distance_to_point(mouse_x, mouse_y)<25) { + if cloak && team!=global.myself.team exit; + draw_set_alpha(1); + draw_set_halign(fa_center); + draw_set_valign(fa_bottom); + if(team==TEAM_RED) { + draw_set_color(c_red); + } else { + draw_set_color(c_blue); + } + draw_text(xr, yr-35, player.name); + + if(team == global.myself.team && global.showTeammateStats) + { + if(weapons[0] == Medigun) + draw_text(xr,yr+50, "Superburst: " + string(currentWeapon.uberCharge/20) + "%"); + else if(weapons[0] == Shotgun) + draw_text(xr,yr+50, "Nuts 'N' Bolts: " + string(nutsNBolts)); + else if(weapons[0] == Minegun) + draw_text(xr,yr+50, "Lobbed Mines: " + string(currentWeapon.lobbed)); + } +} + +draw_set_alpha(1); +if team == TEAM_RED ubercolour = c_red; +if team == TEAM_BLUE ubercolour = c_blue; + +var sprite, overlaySprite; +if zoomed +{ + if (team == TEAM_RED) + sprite = SniperCrouchRedS; + else + sprite = SniperCrouchBlueS; + overlaySprite = sniperCrouchOverlay; +} +else +{ + sprite = sprite_index; + overlaySprite = overlay; +} + +if (omnomnomnom) +{ + draw_sprite_ext_overlay(omnomnomnomSprite,omnomnomnomOverlay,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1); + if (ubered) + draw_sprite_ext_overlay(omnomnomnomSprite,omnomnomnomOverlay,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7); +} +else if (taunting) +{ + draw_sprite_ext_overlay(tauntsprite,tauntOverlay,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1); + if (ubered) + draw_sprite_ext_overlay(tauntsprite,tauntOverlay,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7); +} +else if (player.humiliated) + draw_sprite_ext(humiliationPoses,floor(animationImage)+humiliationOffset,xr,yr,image_xscale,image_yscale,image_angle,c_white,image_alpha); +else if (!taunting) +{ + if (cloak) + { + if (!ubered) + draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,image_alpha); + else if (ubered) + { + draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,1); + draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7); + } + } + else + { + if (!ubered) + draw_sprite_ext_overlay(sprite,overlaySprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,image_alpha); + else if (ubered) + { + draw_sprite_ext_overlay(sprite,overlaySprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,1); + draw_sprite_ext_overlay(sprite,overlaySprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7); + } + } +} +if (burnDuration > 0 or burnIntensity > 0) { + for(i = 0; i < numFlames * burnIntensity / maxIntensity; i += 1) + { + draw_sprite_ext(FlameS, alarm[5] + i + random(2), x + flameArray_x[i], y + flameArray_y[i], 1, 1, 0, c_white, burnDuration / maxDuration * 0.71 + 0.35); + } +} + +// Copied from Lorgan's itemserver "angels" with slight modifications +// All credit be upon him +if (demon != -1) +{ + demonX = median(x-40,demonX,x+40); + demonY = median(y-40,demonY,y); + demonOffset += demonDir; + if (abs(demonOffset) > 15) + demonDir *= -1; + + var dir; + if (demonX > x) + dir = -1; + else + dir = 1; + + if (demonFrame > sprite_get_number(demon)) + demonFrame = 0; + + if (stabbing || ubered) + draw_sprite_ext(demon,demonFrame+floor(animationImage)+7*player.team,demonX,demonY+demonOffset,dir*1,1,0,c_white,1); + else + draw_sprite_ext(demon,demonFrame+floor(animationImage)+7*player.team,demonX,demonY+demonOffset,dir*1,1,0,c_white,image_alpha); + + demonFrame += 1; +} diff --git a/samples/Game Maker Language/characterDrawEvent.gml b/samples/Game Maker Language/characterDrawEvent.gml new file mode 100644 index 00000000..6dcd8fcc --- /dev/null +++ b/samples/Game Maker Language/characterDrawEvent.gml @@ -0,0 +1,80 @@ +// Originally from /spelunky/Scripts/Platform Engine/characterDrawEvent.gml in the Spelunky Community Update Project + +/********************************************************************************** + Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC + + This file is part of Spelunky. + + You can redistribute and/or modify Spelunky, including its source code, under + the terms of the Spelunky User License. + + Spelunky is distributed in the hope that it will be entertaining and useful, + but WITHOUT WARRANTY. Please see the Spelunky User License for more details. + + The Spelunky User License should be available in "Game Information", which + can be found in the Resource Explorer, or as an external file called COPYING. + If not, please obtain a new copy of Spelunky from + +***********************************************************************************/ + +/* +This event should be placed in the draw event of the platform character. +*/ +//draws the sprite +draw = true; +if (facing == RIGHT) image_xscale = -1; +else image_xscale = 1; + +if (blinkToggle != 1) +{ + if ((state == CLIMBING or (sprite_index == sPExit or sprite_index == sDamselExit or sprite_index == sTunnelExit)) and global.hasJetpack and not whipping) + { + draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha); + //draw_sprite(sprite_index,-1,x,y); + draw_sprite(sJetpackBack,-1,x,y); + draw = false; + } + else if (global.hasJetpack and facing == RIGHT) draw_sprite(sJetpackRight,-1,x-4,y-1); + else if (global.hasJetpack) draw_sprite(sJetpackLeft,-1,x+4,y-1); + if (draw) + { + if (redColor > 0) draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, make_color_rgb(200 + redColor,0,0), image_alpha); + else draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha); + } + if (facing == RIGHT) + { + if (holdArrow == ARROW_NORM) + { + draw_sprite(sArrowRight, -1, x+4, y+1); + } + else if (holdArrow == ARROW_BOMB) + { + if (holdArrowToggle) draw_sprite(sBombArrowRight, 0, x+4, y+2); + else draw_sprite(sBombArrowRight, 1, x+4, y+2); + } + } + else if (facing == LEFT) + { + if (holdArrow == ARROW_NORM) + { + draw_sprite(sArrowLeft, -1, x-4, y+1); + } + else if (holdArrow == ARROW_BOMB) + { + if (holdArrowToggle) draw_sprite(sBombArrowLeft, 0, x-4, y+2); + else draw_sprite(sBombArrowLeft, 1, x-4, y+2); + } + } +} +/* +if canRun +{ + xOffset=80 + if player=1 + yOffset=120 + else + yOffset=143 + //draw the "flySpeed" bar, which shows how much speed the character has acquired while holding the "run" button + //draw_healthbar(view_xview[0]+224+xOffset,view_yview[0]+432+yOffset,view_xview[0]+400+xOffset,view_yview[0]+450+yOffset,flySpeed,make_color_rgb(0,64,128),c_blue,c_aqua,0,1,1) +} +*/ diff --git a/samples/Game Maker Language/characterStepEvent.gml b/samples/Game Maker Language/characterStepEvent.gml new file mode 100644 index 00000000..7416df80 --- /dev/null +++ b/samples/Game Maker Language/characterStepEvent.gml @@ -0,0 +1,1050 @@ +// Originally from /spelunky/Scripts/Platform Engine/characterStepEvent.gml in the Spelunky Community Update Project + +/********************************************************************************** + Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC + + This file is part of Spelunky. + + You can redistribute and/or modify Spelunky, including its source code, under + the terms of the Spelunky User License. + + Spelunky is distributed in the hope that it will be entertaining and useful, + but WITHOUT WARRANTY. Please see the Spelunky User License for more details. + + The Spelunky User License should be available in "Game Information", which + can be found in the Resource Explorer, or as an external file called COPYING. + If not, please obtain a new copy of Spelunky from + +***********************************************************************************/ + +/* +This script should be placed in the step event for the platform character. +It updates the keys used by the character, moves all of the solids, moves the +character, sets the sprite index, and sets the animation speed for the sprite. +*/ +hangCountMax = 3; + +////////////////////////////////////// +// KEYS +////////////////////////////////////// + +kLeft = checkLeft(); + +if (kLeft) kLeftPushedSteps += 1; +else kLeftPushedSteps = 0; + +kLeftPressed = checkLeftPressed(); +kLeftReleased = checkLeftReleased(); + +kRight = checkRight(); + +if (kRight) kRightPushedSteps += 1; +else kRightPushedSteps = 0; + +kRightPressed = checkRightPressed(); +kRightReleased = checkRightReleased(); + +kUp = checkUp(); +kDown = checkDown(); + +//key "run" +if canRun + kRun = 0; +// kRun=runKey +else + kRun=0 + +kJump = checkJump(); +kJumpPressed = checkJumpPressed(); +kJumpReleased = checkJumpReleased(); + +if (cantJump > 0) +{ + kJump = 0; + kJumpPressed = 0; + kJumpReleased = 0; + cantJump -= 1; +} +else +{ + if (global.isTunnelMan and + sprite_index == sTunnelAttackL and + !holdItem) + { + kJump = 0; + kJumpPressed = 0; + kJumpReleased = 0; + cantJump -= 1; + } +} + +kAttack = checkAttack(); +kAttackPressed = checkAttackPressed(); +kAttackReleased = checkAttackReleased(); + +kItemPressed = checkItemPressed(); + +xPrev = x; +yPrev = y; + +if (stunned or dead) +{ + kLeft = false; + kLeftPressed = false; + kLeftReleased = false; + kRight = false; + kRightPressed = false; + kRightReleased = false; + kUp = false; + kDown = false; + kJump = false; + kJumpPressed = false; + kJumpReleased = false; + kAttack = false; + kAttackPressed = false; + kAttackReleased = false; + kItemPressed = false; +} + +////////////////////////////////////////// +// Collisions +////////////////////////////////////////// + +colSolidLeft = false; +colSolidRight = false; +colLeft = false; +colRight = false; +colTop = false; +colBot = false; +colLadder = false; +colPlatBot = false; +colPlat = false; +colWaterTop = false; +colIceBot = false; +runKey = false; +if (isCollisionMoveableSolidLeft(1)) colSolidLeft = true; +if (isCollisionMoveableSolidRight(1)) colSolidRight = true; +if (isCollisionLeft(1)) colLeft = true; +if (isCollisionRight(1)) colRight = true; +if (isCollisionTop(1)) colTop = true; +if (isCollisionBottom(1)) colBot = true; +if (isCollisionLadder()) colLadder = true; +if (isCollisionPlatformBottom(1)) colPlatBot = true; +if (isCollisionPlatform()) colPlat = true; +if (isCollisionWaterTop(1)) colWaterTop = true; +if (collision_point(x, y+8, oIce, 0, 0)) colIceBot = true; +if (checkRun()) +{ + runHeld = 100; + runKey = true; +} + +if (checkAttack() and not whipping) +{ + runHeld += 1; + runKey = true; +} + +if (not runKey or (not kLeft and not kRight)) runHeld = 0; + +// allows the character to run left and right +// if state!=DUCKING and state!=LOOKING_UP and state!=CLIMBING +if (state != CLIMBING and state != HANGING) +{ + if (kLeftReleased and approximatelyZero(xVel)) xAcc -= 0.5 + if (kRightReleased and approximatelyZero(xVel)) xAcc += 0.5 + + if (kLeft and not kRight) + { + if (colSolidLeft) + { + // xVel = 3; + if (platformCharacterIs(ON_GROUND) and state != DUCKING) + { + xAcc -= 1; + pushTimer += 10; + //if (not SS_IsSoundPlaying(global.sndPush)) playSound(global.sndPush); + } + } + else if (kLeftPushedSteps > 2) and (facing=LEFT or approximatelyZero(xVel)) + { + xAcc -= runAcc; + } + facing = LEFT; + //if (platformCharacterIs(ON_GROUND) and abs(xVel) > 0 and alarm[3] < 1) alarm[3] = floor(16/-xVel); + } + + if (kRight and not kLeft) + { + if (colSolidRight) + { + // xVel = 3; + if (platformCharacterIs(ON_GROUND) and state != DUCKING) + { + xAcc += 1; + pushTimer += 10; + //if (not SS_IsSoundPlaying(global.sndPush)) playSound(global.sndPush); + } + } + else if (kRightPushedSteps > 2 or colSolidLeft) and (facing=RIGHT or approximatelyZero(xVel)) + { + xAcc += runAcc; + } + facing = RIGHT; + //if (platformCharacterIs(ON_GROUND) and abs(xVel) > 0 and alarm[3] < 1) alarm[3] = floor(16/xVel); + } +} + +/****************************************** + + LADDERS + +*******************************************/ + +if (state == CLIMBING) +{ + if (instance_exists(oCape)) + { + oCape.open = false; + } + kJumped = false; + ladderTimer = 10; + ladder = collision_point(x, y, oLadder, 0, 0); + if (ladder) x = ladder.x + 8; + + if (kLeft) facing = LEFT; + else if (kRight) facing = RIGHT; + if (kUp) + { + if (collision_point(x, y-8, oLadder, 0, 0) or collision_point(x, y-8, oLadderTop, 0, 0)) + { + yAcc -= climbAcc; + if (alarm[2] < 1) alarm[2] = 8; + } + } + else if (kDown) + { + if (collision_point(x, y+8, oLadder, 0, 0) or collision_point(x, y+8, oLadderTop, 0, 0)) + { + yAcc += climbAcc; + if (alarm[2] < 1) alarm[2] = 8; + } + else + state = FALLING; + if (colBot) state = STANDING; + } + + if (kJumpPressed and not whipping) + { + if (kLeft) + xVel = -departLadderXVel; + else if (kRight) + xVel = departLadderXVel; + else + xVel = 0; + yAcc += departLadderYVel; + state = JUMPING; + jumpButtonReleased = 0; + jumpTime = 0; + ladderTimer = 5; + } +} +else +{ + if (ladderTimer > 0) ladderTimer -= 1; +} + +if (platformCharacterIs(IN_AIR) and state != HANGING) +{ + yAcc += gravityIntensity; +} + +// Player has landed +if ((colBot or colPlatBot) and platformCharacterIs(IN_AIR) and yVel >= 0) +{ + if (not colPlat or colBot) + { + yVel = 0; + yAcc = 0; + state = RUNNING; + jumps = 0; + } + //playSound(global.sndLand); +} +if ((colBot or colPlatBot) and not colPlat) yVel = 0; + +// Player has just walked off of the edge of a solid +if (colBot == 0 and (not colPlatBot or colPlat) and platformCharacterIs(ON_GROUND)) +{ + state = FALLING; + yAcc += grav; + kJumped = true; + if (global.hasGloves) hangCount = 5; +} + +if (colTop) +{ + if (dead or stunned) yVel = -yVel * 0.8; + else if (state == JUMPING) yVel = abs(yVel*0.3) +} + +if (colLeft and facing == LEFT) or (colRight and facing == RIGHT) +{ + if (dead or stunned) xVel = -xVel * 0.5; + else xVel = 0; +} + +/****************************************** + + JUMPING + +*******************************************/ + +if (kJumpReleased and platformCharacterIs(IN_AIR)) +{ + kJumped = true; +} +else if (platformCharacterIs(ON_GROUND)) +{ + oCape.open = false; + kJumped = false; +} + +if (kJumpPressed and collision_point(x, y, oWeb, 0, 0)) +{ + obj = instance_place(x, y, oWeb); + obj.life -= 1; + yAcc += initialJumpAcc * 2; + yVel -= 3; + xAcc += xVel/2; + + state = JUMPING; + jumpButtonReleased = 0; + jumpTime = 0; + + grav = gravNorm; +} +else if (kJumpPressed and colWaterTop) +{ + yAcc += initialJumpAcc * 2; + yVel -= 3; + xAcc += xVel/2; + + state = JUMPING; + jumpButtonReleased = 0; + jumpTime = 0; + + grav = gravNorm; +} +else if (global.hasCape and kJumpPressed and kJumped and platformCharacterIs(IN_AIR)) +{ + if (not oCape.open) oCape.open = true; + else oCape.open = false; +} +else if (global.hasJetpack and kJump and kJumped and platformCharacterIs(IN_AIR) and jetpackFuel > 0) +{ + yAcc += initialJumpAcc; + yVel = -1; + jetpackFuel -= 1; + if (alarm[10] < 1) alarm[10] = 3; + + state = JUMPING; + jumpButtonReleased = 0; + jumpTime = 0; + + grav = 0; +} +else if (platformCharacterIs(ON_GROUND) and kJumpPressed and fallTimer == 0) +{ + if (xVel > 3 or xVel < -3) + { + yAcc += initialJumpAcc * 2; + xAcc += xVel * 2; + } + else + { + yAcc += initialJumpAcc * 2; + xAcc += xVel/2; + } + + if (global.hasJordans) + { + yAcc *= 3; + yAccLimit = 12; + grav = 0.5; + } + else if (global.hasSpringShoes) yAcc *= 1.5; + else + { + yAccLimit = 6; + grav = gravNorm; + } + + playSound(global.sndJump); + + pushTimer = 0; + + // the "state" gets changed to JUMPING later on in the code + state = FALLING; + // "variable jumping" states + jumpButtonReleased = 0; + jumpTime = 0; +} + +if (jumpTime < jumpTimeTotal) jumpTime += 1; +//let the character continue to jump +if (kJump == 0) jumpButtonReleased = 1; +if (jumpButtonReleased) jumpTime = jumpTimeTotal; + +gravityIntensity = (jumpTime/jumpTimeTotal) * grav; + +if (kUp and platformCharacterIs(ON_GROUND) and not colLadder) +{ + looking = UP; + if (xVel == 0 and xAcc == 0) state = LOOKING_UP; +} +else looking = 0; + +if (not kUp and state == LOOKING_UP) +{ + state=STANDING +} + +/****************************************** + + HANGING + +*******************************************/ + +if (not colTop) +{ +if (global.hasGloves and yVel > 0) +{ + if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kRight and colRight and + (collision_point(x+9, y-5, oSolid, 0, 0) or collision_point(x+9, y-6, oSolid, 0, 0))) + { + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; + } + else if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kLeft and colLeft and + (collision_point(x-9, y-5, oSolid, 0, 0) or collision_point(x-9, y-6, oSolid, 0, 0))) + { + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; + } +} +else if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kRight and colRight and + (collision_point(x+9, y-5, oTree, 0, 0) or collision_point(x+9, y-6, oTree, 0, 0))) +{ + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; +} +else if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kLeft and colLeft and + (collision_point(x-9, y-5, oTree, 0, 0) or collision_point(x-9, y-6, oTree, 0, 0))) +{ + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; +} +else if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kRight and colRight and + (collision_point(x+9, y-5, oSolid, 0, 0) or collision_point(x+9, y-6, oSolid, 0, 0)) and + not collision_point(x+9, y-9, oSolid, 0, 0) and not collision_point(x, y+9, oSolid, 0, 0)) +{ + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; +} +else if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and kLeft and colLeft and + (collision_point(x-9, y-5, oSolid, 0, 0) or collision_point(x-9, y-6, oSolid, 0, 0)) and + not collision_point(x-9, y-9, oSolid, 0, 0) and not collision_point(x, y+9, oSolid, 0, 0)) +{ + state = HANGING; + move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; +} + +if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and state == FALLING and + (collision_point(x, y-5, oArrow, 0, 0) or collision_point(x, y-6, oArrow, 0, 0)) and + not collision_point(x, y-9, oArrow, 0, 0) and not collision_point(x, y+9, oArrow, 0, 0)) +{ + obj = instance_nearest(x, y-5, oArrow); + if (obj.stuck) + { + state = HANGING; + // move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; + } +} + +/* +if (hangCount == 0 and y > 16 and !platformCharacterIs(ON_GROUND) and state == FALLING and + (collision_point(x, y-5, oTreeBranch, 0, 0) or collision_point(x, y-6, oTreeBranch, 0, 0)) and + not collision_point(x, y-9, oTreeBranch, 0, 0) and not collision_point(x, y+9, oTreeBranch, 0, 0)) +{ + state = HANGING; + // move_snap(1, 8); + yVel = 0; + yAcc = 0; + grav = 0; +} +*/ + +} + +if (hangCount > 0) hangCount -= 1; + +if (state == HANGING) +{ + if (instance_exists(oCape)) oCape.open = false; + kJumped = false; + + if (kDown and kJumpPressed) + { + grav = gravNorm; + state = FALLING; + yAcc -= grav; + hangCount = 5; + if (global.hasGloves) hangCount = 10; + } + else if (kJumpPressed) + { + grav = gravNorm; + if ((facing == RIGHT and kLeft) or (facing == LEFT and kRight)) + { + state = FALLING; + yAcc -= grav; + } + else + { + state = JUMPING; + yAcc += initialJumpAcc * 2; + if (facing == RIGHT) x -= 2; + else x += 2; + } + hangCount = hangCountMax; + } + + if ((facing == LEFT and not isCollisionLeft(2)) or + (facing == RIGHT and not isCollisionRight(2))) + { + grav = gravNorm; + state = FALLING; + yAcc -= grav; + hangCount = 4; + } +} +else +{ + grav = gravNorm; +} + +// pressing down while standing +if (kDown and platformCharacterIs(ON_GROUND) and not whipping) +{ + if (colBot) + { + state = DUCKING; + } + else if colPlatBot + { + // climb down ladder if possible, else jump down + fallTimer = 0; + if (not colBot) + { + ladder = 0; + ladder = instance_place(x, y+16, oLadder); + if (instance_exists(ladder)) + { + if (abs(x-(ladder.x+8)) < 4) + { + x = ladder.x + 8; + + xVel = 0; + yVel = 0; + xAcc = 0; + yAcc = 0; + state = CLIMBING; + } + } + else + { + y += 1; + state = FALLING; + yAcc += grav; + } + } + else + { + //the character can't move down because there is a solid in the way + state = RUNNING; + } + } +} +if (not kDown and state == DUCKING) +{ + state = STANDING; + xVel = 0; + xAcc = 0; +} +if (xVel == 0 and xAcc == 0 and state == RUNNING) +{ + state = STANDING; +} +if (xAcc != 0 and state == STANDING) +{ + state = RUNNING; +} +if (yVel < 0 and platformCharacterIs(IN_AIR) and state != HANGING) +{ + state = JUMPING; +} +if (yVel > 0 and platformCharacterIs(IN_AIR) and state != HANGING) +{ + state = FALLING; + setCollisionBounds(-5, -6, 5, 8); +} +else setCollisionBounds(-5, -8, 5, 8); + +// CLIMB LADDER +colPointLadder = collision_point(x, y, oLadder, 0, 0) or collision_point(x, y, oLadderTop, 0, 0); + +if ((kUp and platformCharacterIs(IN_AIR) and collision_point(x, y-8, oLadder, 0, 0) and ladderTimer == 0) or + (kUp and colPointLadder and ladderTimer == 0) or + (kDown and colPointLadder and ladderTimer == 0 and platformCharacterIs(ON_GROUND) and collision_point(x, y+9, oLadderTop, 0, 0) and xVel == 0)) +{ + ladder = 0; + ladder = instance_place(x, y-8, oLadder); + if (instance_exists(ladder)) + { + if (abs(x-(ladder.x+8)) < 4) + { + x = ladder.x + 8; + if (not collision_point(x, y, oLadder, 0, 0) and + not collision_point(x, y, oLadderTop, 0, 0)) + { + y = ladder.y + 14; + } + + xVel = 0; + yVel = 0; + xAcc = 0; + yAcc = 0; + state = CLIMBING; + } + } +} + +/* +if (sprite_index == sDuckToHangL or sprite_index == sDamselDtHL) +{ + ladder = 0; + if (facing == LEFT and collision_rectangle(x-8, y, x, y+16, oLadder, 0, 0) and not collision_point(x-4, y+16, oSolid, 0, 0)) + { + ladder = instance_nearest(x-4, y+16, oLadder); + } + else if (facing == RIGHT and collision_rectangle(x, y, x+8, y+16, oLadder, 0, 0) and not collision_point(x+4, y+16, oSolid, 0, 0)) + { + ladder = instance_nearest(x+4, y+16, oLadder); + } + + if (ladder) + { + x = ladder.x + 8; + + xVel = 0; + yVel = 0; + xAcc = 0; + yAcc = 0; + state = CLIMBING; + } +} +*/ +/* +if (colLadder and state == CLIMBING and kJumpPressed and not whipping) +{ + if (kLeft) + xVel = -departLadderXVel; + else if (kRight) + xVel = departLadderXVel; + else + xVel = 0; + yAcc += departLadderYVel; + state = JUMPING; + jumpButtonReleased = 0; + jumpTime = 0; + ladderTimer = 5; +} +*/ + +// Calculate horizontal/vertical friction +if (state == CLIMBING) +{ + xFric = frictionClimbingX; + yFric = frictionClimbingY; +} +else +{ + if (runKey and platformCharacterIs(ON_GROUND) and runHeld >= 10) + { + if (kLeft) // run + { + xVel -= 0.1; + xVelLimit = 6; + xFric = frictionRunningFastX; + } + else if (kRight) + { + xVel += 0.1; + xVelLimit = 6; + xFric = frictionRunningFastX; + } + } + else if (state == DUCKING) + { + if (xVel<2 and xVel>-2) + { + xFric = 0.2 + xVelLimit = 3; + image_speed = 0.8; + } + else if (kLeft and global.downToRun) // run + { + xVel -= 0.1; + xVelLimit = 6; + xFric = frictionRunningFastX; + } + else if (kRight and global.downToRun) + { + xVel += 0.1; + xVelLimit = 6; + xFric = frictionRunningFastX; + } + else + { + xVel *= 0.8; + if (xVel < 0.5) xVel = 0; + xFric = 0.2 + xVelLimit = 3; + image_speed = 0.8; + } + } + else + { + //decrease the friction when the character is "flying" + if (platformCharacterIs(IN_AIR)) + { + if (dead or stunned) xFric = 1.0; + else xFric = 0.8; + } + else + { + xFric = frictionRunningX; + } + } + + // Stuck on web or underwater + if (collision_point(x, y, oWeb, 0, 0)) + { + xFric = 0.2; + yFric = 0.2; + fallTimer = 0; + } + else if (collision_point(x, y, oWater, -1, -1)) + { + if (instance_exists(oCape)) oCape.open = false; + + if (state == FALLING and yVel > 0) + { + yFric = 0.5; + } + else if (not collision_point(x, y-9, oWater, -1, -1)) + { + yFric = 1; + } + else + { + yFric = 0.9; + } + } + else + { + swimming = false; + yFric = 1; + } +} + +if (colIceBot and state != DUCKING and not global.hasSpikeShoes) +{ + xFric = 0.98; + yFric = 1; +} + +// RUNNING + +if (platformCharacterIs(ON_GROUND)) +{ + if (state == RUNNING and kLeft and colLeft) + { + pushTimer += 1; + } + else if (state == RUNNING and kRight and colRight) + { + pushTimer += 1; + } + else + { + pushTimer = 0; + } + + if (platformCharacterIs(ON_GROUND) and not kJump and not kDown and not runKey) + { + xVelLimit = 3; + } + + + // ledge flip + if (state == DUCKING and abs(xVel) < 3 and facing == LEFT and + collision_point(x, y+9, oSolid, 0, 0) and not collision_line(x-1, y+9, x-10, y+9, oSolid, 0, 0) and kLeft) + { + state = DUCKTOHANG; + + if (holdItem) + { + holdItem.held = false; + if (holdItem.type == "Gold Idol") holdItem.y -= 8; + scrDropItem(-1, -4); + } + + with oMonkey + { + // knock off monkeys that grabbed you + if (status == 7) + { + xVel = -1; + yVel = -4; + status = 1; + vineCounter = 20; + grabCounter = 60; + } + } + } + else if (state == DUCKING and abs(xVel) < 3 and facing == RIGHT and + collision_point(x, y+9, oSolid, 0, 0) and not collision_line(x+1, y+9, x+10, y+9, oSolid, 0, 0) and kRight) + { + state = DUCKTOHANG; + + if (holdItem) + { + // holdItem.held = false; + if (holdItem.type == "Gold Idol") holdItem.y -= 8; + scrDropItem(1, -4); + } + + with oMonkey + { + // knock off monkeys that grabbed you + if (status == 7) + { + xVel = 1; + yVel = -4; + status = 1; + vineCounter = 20; + grabCounter = 60; + } + } + } +} + +if (state == DUCKTOHANG) +{ + x = xPrev; + y = yPrev; + xVel = 0; + yVel = 0; + xAcc = 0; + yAcc = 0; + grav = 0; +} + +// PARACHUTE AND CAPE +if (instance_exists(oParachute)) +{ + yFric = 0.5; +} +if (instance_exists(oCape)) +{ + if (oCape.open) yFric = 0.5; +} + +if (pushTimer > 100) pushTimer = 100; + +// limits the acceleration if it is too extreme +if (xAcc > xAccLimit) xAcc = xAccLimit; +else if (xAcc < -xAccLimit) xAcc = -xAccLimit; +if (yAcc > yAccLimit) yAcc = yAccLimit; +else if (yAcc < -yAccLimit) yAcc = -yAccLimit; + +// applies the acceleration +xVel += xAcc; +if (dead or stunned) yVel += 0.6; +else yVel += yAcc; + +// nullifies the acceleration +xAcc = 0; +yAcc = 0; + +// applies the friction to the velocity, now that the velocity has been calculated +xVel *= xFric; +yVel *= yFric; + +// apply ball and chain +if (instance_exists(oBall)) +{ + if (distance_to_object(oBall) >= 24) + { + if (xVel > 0 and oBall.x < x and abs(oBall.x-x) > 24) xVel = 0; + if (xVel < 0 and oBall.x > x and abs(oBall.x-x) > 24) xVel = 0; + if (yVel > 0 and oBall.y < y and abs(oBall.y-y) > 24) + { + if (abs(oBall.x-x) < 1) + { + x = oBall.x; + } + else if (oBall.x < x and not kRight) + { + if (xVel > 0) xVel *= -0.25; + else if (xVel == 0) xVel -= 1; + } + else if (oBall.x > x and not kLeft) + { + if (xVel < 0) xVel *= -0.25; + else if (xVel == 0) xVel += 1; + } + yVel = 0; + fallTimer = 0; + } + if (yVel < 0 and oBall.y > y and abs(oBall.y-y) > 24) yVel = 0; + } +} + +// apply the limits since the velocity may be too extreme +if (not dead and not stunned) +{ + if (xVel > xVelLimit) xVel = xVelLimit; + else if (xVel < -xVelLimit) xVel = -xVelLimit; +} +if (yVel > yVelLimit) yVel = yVelLimit; +else if (yVel < -yVelLimit) yVel = -yVelLimit; + +// approximates the "active" variables +if approximatelyZero(xVel) xVel=0 +if approximatelyZero(yVel) yVel=0 +if approximatelyZero(xAcc) xAcc=0 +if approximatelyZero(yAcc) yAcc=0 + +// prepares the character to move up a hill +// we need to use the "slopeYPrev" variable later to know the "true" y previous value +// keep this condition the same +if maxSlope>0 and platformCharacterIs(ON_GROUND) and xVel!=0 +{ + slopeYPrev=y + for(y=y;y>=slopeYPrev-maxSlope;y-=1) + if colTop + break + slopeChangeInY=slopeYPrev-y +} +else + slopeChangeInY=0 + +// moves the character, and balances out the effects caused by other processes +// keep this condition the same +if maxSlope*abs(xVel)>0 and platformCharacterIs(ON_GROUND) +{ + // we need to check if we should dampen out the speed as the character runs on upward slopes + xPrev=x + yPrev=slopeYPrev // we don't want to use y, because y is too high + yPrevHigh=y // we'll use the higher previous variable later + moveTo(xVel,yVel+slopeChangeInY) + dist=point_distance(xPrev,yPrev,x,y)// overall distance that has been traveled + // we should have only ran at xVel + if dist>abs(xVelInteger) + { + // show_message(string(dist)+ " "+string(abs(xVelInteger))) + excess=dist-abs(xVelInteger) + if(xVelInteger<0) + excess*=-1 + // move back since the character moved too far + x=xPrev + y=yPrevHigh // we need the character to be high so the character can move down + // this time we'll move the correct distance, but we need to shorten out the xVel a little + // these lines can be changed for different types of slowing down when running up hills + ratio=abs(xVelInteger)/dist*0.9 //can be changed + moveTo( round(xVelInteger*ratio),round(yVelInteger*ratio+slopeChangeInY) ) + } +} +else +{ + // we simply move xVel and yVel while in the air or on a ladder + moveTo(xVel,yVel) +} +// move the character downhill if possible +// we need to multiply maxDownSlope by the absolute value of xVel since the character normally runs at an xVel larger than 1 +if not colBot and maxDownSlope>0 and xVelInteger!=0 and platformCharacterIs(ON_GROUND) +{ + //the character is floating just above the slope, so move the character down + upYPrev=y + for(y=y;y<=upYPrev+maxDownSlope;y+=1) + if colBot // we hit a solid below + { + upYPrev=y // I know that this doesn't seem to make sense, because of the name of the variable, but it all works out correctly after we break out of this loop + break + } + y=upYPrev +} + +//figures out what the sprite index of the character should be +characterSprite(); + +//sets the previous state and the previously previous state +statePrevPrev = statePrev; +statePrev = state; + +//calculates the image_speed based on the character's velocity +if (state == RUNNING or state == DUCKING or state == LOOKING_UP) +{ + if (state == RUNNING or state == LOOKING_UP) image_speed = abs(xVel) * runAnimSpeed + 0.1; +} + +if (state == CLIMBING) image_speed = sqrt(sqr(abs(xVel))+sqr(abs(yVel))) * climbAnimSpeed +if (xVel >= 4 or xVel <= -4) +{ + image_speed = 1; + if (platformCharacterIs(ON_GROUND)) setCollisionBounds(-8, -8, 8, 8); + else setCollisionBounds(-5, -8, 5, 8); +} +else setCollisionBounds(-5, -8, 5, 8); +if (whipping) image_speed = 1; +if (state == DUCKTOHANG) +{ + image_index = 0; + image_speed = 0.8; +} +//limit the image_speed at 1 so the animation always looks good +if (image_speed > 1) image_speed = 1; diff --git a/samples/Game Maker Language/doEventPlayerDeath.gml b/samples/Game Maker Language/doEventPlayerDeath.gml new file mode 100644 index 00000000..47ee7780 --- /dev/null +++ b/samples/Game Maker Language/doEventPlayerDeath.gml @@ -0,0 +1,251 @@ +/* + Originally from /Source/gg2/Scripts/Events/doEventPlayerDeath.gml in Gang Garrison 2 + + Copyright (C) 2008-2013 Faucet Software + http://www.ganggarrison.com + + This program is free software; + you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3 of the License, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, + see . + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +/** + * Perform the "player death" event, i.e. change the appropriate scores, + * destroy the character object to much splattering and so on. + * + * argument0: The player whose character died + * argument1: The player who inflicted the fatal damage (or noone for unknown) + * argument2: The player who assisted the kill (or noone for no assist) + * argument3: The source of the fatal damage + */ +var victim, killer, assistant, damageSource; +victim = argument0; +killer = argument1; +assistant = argument2; +damageSource = argument3; + +if(!instance_exists(killer)) + killer = noone; + +if(!instance_exists(assistant)) + assistant = noone; + +//************************************* +//* Scoring and Kill log +//************************************* + + +recordKillInLog(victim, killer, assistant, damageSource); + +victim.stats[DEATHS] += 1; +if(killer) +{ + if(damageSource == WEAPON_KNIFE || damageSource == WEAPON_BACKSTAB) + { + killer.stats[STABS] += 1; + killer.roundStats[STABS] += 1; + killer.stats[POINTS] += 1; + killer.roundStats[POINTS] +=1; + } + + if (victim.object.currentWeapon.object_index == Medigun) + { + if (victim.object.currentWeapon.uberReady) + { + killer.stats[BONUS] += 1; + killer.roundStats[BONUS] += 1; + killer.stats[POINTS] += 1; + killer.roundStats[POINTS] += 1; + } + } + + if (killer != victim) + { + killer.stats[KILLS] += 1; + killer.roundStats[KILLS] += 1; + killer.stats[POINTS] += 1; + killer.roundStats[POINTS] += 1; + if(victim.object.intel) + { + killer.stats[DEFENSES] += 1; + killer.roundStats[DEFENSES] += 1; + killer.stats[POINTS] += 1; + killer.roundStats[POINTS] += 1; + recordEventInLog(4, killer.team, killer.name, global.myself == killer); + } + } +} + +if (assistant) +{ + assistant.stats[ASSISTS] += 1; + assistant.roundStats[ASSISTS] += 1; + assistant.stats[POINTS] += .5; + assistant.roundStats[POINTS] += .5; +} + +//SPEC +if (victim == global.myself) + instance_create(victim.object.x, victim.object.y, Spectator); + +//************************************* +//* Gibbing +//************************************* +var xoffset, yoffset, xsize, ysize; + +xoffset = view_xview[0]; +yoffset = view_yview[0]; +xsize = view_wview[0]; +ysize = view_hview[0]; + +randomize(); +with(victim.object) { + if((damageSource == WEAPON_ROCKETLAUNCHER + or damageSource == WEAPON_MINEGUN or damageSource == FRAG_BOX + or damageSource == WEAPON_REFLECTED_STICKY or damageSource == WEAPON_REFLECTED_ROCKET + or damageSource == FINISHED_OFF_GIB or damageSource == GENERATOR_EXPLOSION) + and (player.class != CLASS_QUOTE) and (global.gibLevel>1) + and distance_to_point(xoffset+xsize/2,yoffset+ysize/2) < 900) { + if (hasReward(victim, 'PumpkinGibs')) + { + repeat(global.gibLevel * 2) { + createGib(x,y,PumpkinGib,hspeed,vspeed,random(145)-72, choose(0,1,1,2,2,3), false, true) + } + } + else + { + repeat(global.gibLevel) { + createGib(x,y,Gib,hspeed,vspeed,random(145)-72, 0, false) + } + switch(player.team) + { + case TEAM_BLUE : + repeat(global.gibLevel - 1) { + createGib(x,y,BlueClump,hspeed,vspeed,random(145)-72, 0, false) + } + break; + case TEAM_RED : + repeat(global.gibLevel - 1) { + createGib(x,y,RedClump,hspeed,vspeed,random(145)-72, 0, false) + } + break; + } + } + + repeat(global.gibLevel * 14) { + var blood; + blood = instance_create(x+random(23)-11,y+random(23)-11,BloodDrop); + blood.hspeed=(random(21)-10); + blood.vspeed=(random(21)-13); + if (hasReward(victim, 'PumpkinGibs')) + { + blood.sprite_index = PumpkinJuiceS; + } + } + if (!hasReward(victim, 'PumpkinGibs')) + { + //All Classes gib head, hands, and feet + if(global.gibLevel > 2 || choose(0,1) == 1) + createGib(x,y,Headgib,0,0,random(105)-52, player.class, false); + repeat(global.gibLevel -1){ + //Medic has specially colored hands + if (player.class == CLASS_MEDIC){ + if (player.team == TEAM_RED) + createGib(x,y,Hand, hspeed, vspeed, random(105)-52 , 9, false); + else + createGib(x,y,Hand, hspeed, vspeed, random(105)-52 , 10, false); + }else{ + createGib(x,y,Hand, hspeed, vspeed, random(105)-52 , player.class, false); + } + createGib(x,y,Feet,random(5)-2,random(3),random(13)-6 , player.class, true); + } + } + + //Class specific gibs + switch(player.class) { + case CLASS_PYRO : + if(global.gibLevel > 2 || choose(0,1) == 1) + createGib(x,y,Accesory,hspeed,vspeed,random(105)-52, 4, false) + break; + case CLASS_SOLDIER : + if(global.gibLevel > 2 || choose(0,1) == 1){ + switch(player.team) { + case TEAM_BLUE : + createGib(x,y,Accesory,hspeed,vspeed,random(105)-52, 2, false); + break; + case TEAM_RED : + createGib(x,y,Accesory,hspeed,vspeed,random(105)-52, 1, false); + break; + } + } + break; + case CLASS_ENGINEER : + if(global.gibLevel > 2 || choose(0,1) == 1) + createGib(x,y,Accesory,hspeed,vspeed,random(105)-52, 3, false) + break; + case CLASS_SNIPER : + if(global.gibLevel > 2 || choose(0,1) == 1) + createGib(x,y,Accesory,hspeed,vspeed,random(105)-52, 0, false) + break; + } + playsound(x,y,Gibbing); + } else { + var deadbody; + if player.class != CLASS_QUOTE playsound(x,y,choose(DeathSnd1, DeathSnd2)); + deadbody = instance_create(x,y-30,DeadGuy); + // 'GS' reward - *G*olden *S*tatue + if(hasReward(player, 'GS')) + { + deadbody.sprite_index = haxxyStatue; + deadbody.image_index = 0; + } + else + { + deadbody.sprite_index = sprite_index; + deadbody.image_index = CHARACTER_ANIMATION_DEAD; + } + deadbody.hspeed=hspeed; + deadbody.vspeed=vspeed; + if(hspeed>0) { + deadbody.image_xscale = -1; + } + } +} + +if (global.gg_birthday){ + myHat = instance_create(victim.object.x,victim.object.y,PartyHat); + myHat.image_index = victim.team; +} +if (global.xmas){ + myHat = instance_create(victim.object.x,victim.object.y,XmasHat); + myHat.image_index = victim.team; +} + + +with(victim.object) { + instance_destroy(); +} + +//************************************* +//* Deathcam +//************************************* +if( global.killCam and victim == global.myself and killer and killer != victim and !(damageSource == KILL_BOX || damageSource == FRAG_BOX || damageSource == FINISHED_OFF || damageSource == FINISHED_OFF_GIB || damageSource == GENERATOR_EXPLOSION)) { + instance_create(0,0,DeathCam); + DeathCam.killedby=killer; + DeathCam.name=killer.name; + DeathCam.oldxview=view_xview[0]; + DeathCam.oldyview=view_yview[0]; + DeathCam.lastDamageSource=damageSource; + DeathCam.team = global.myself.team; +} diff --git a/samples/Game Maker Language/faucet-http.gml b/samples/Game Maker Language/faucet-http.gml new file mode 100644 index 00000000..c9b4d0f5 --- /dev/null +++ b/samples/Game Maker Language/faucet-http.gml @@ -0,0 +1,1469 @@ +#define __http_init +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Creates global.__HttpClient +// real __http_init() + +global.__HttpClient = object_add(); +object_set_persistent(global.__HttpClient, true); + +#define __http_split +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// real __http_split(string text, delimeter delimeter, real limit) +// Splits string into items + +// text - string comma-separated values +// delimeter - delimeter to split by +// limit if non-zero, maximum times to split text +// When limited, the remaining text will be left as the last item. +// E.g. splitting "1,2,3,4,5" with delimeter "," and limit 2 yields this list: +// "1", "2", "3,4,5" + +// return value - ds_list containing strings of values + +var text, delimeter, limit; +text = argument0; +delimeter = argument1; +limit = argument2; + +var list, count; +list = ds_list_create(); +count = 0; + +while (string_pos(delimeter, text) != 0) +{ + ds_list_add(list, string_copy(text, 1, string_pos(delimeter,text) - 1)); + text = string_copy(text, string_pos(delimeter, text) + string_length(delimeter), string_length(text) - string_pos(delimeter, text)); + + count += 1; + if (limit and count == limit) + break; +} +ds_list_add(list, text); + +return list; + +#define __http_parse_url +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Parses a URL into its components +// real __http_parse_url(string url) + +// Return value is a ds_map containing keys for the different URL parts: (or -1 on failure) +// "url" - the URL which was passed in +// "scheme" - the URL scheme (e.g. "http") +// "host" - the hostname (e.g. "example.com" or "127.0.0.1") +// "port" - the port (e.g. 8000) - this is a real, unlike the others +// "abs_path" - the absolute path (e.g. "/" or "/index.html") +// "query" - the query string (e.g. "a=b&c=3") +// Parts which are not included will not be in the map +// e.g. http://example.com will not have the "port", "path" or "query" keys + +// This will *only* work properly for URLs of format: +// scheme ":" "//" host [ ":" port ] [ abs_path [ "?" query ]]" +// where [] denotes an optional component +// file: URLs will *not* work as they lack the authority (host:port) component +// It will not work correctly for IPv6 host values + +var url; +url = argument0; + +var map; +map = ds_map_create(); +ds_map_add(map, 'url', url); + +// before scheme +var colonPos; +// Find colon for end of scheme +colonPos = string_pos(':', url); +// No colon - bad URL +if (colonPos == 0) + return -1; +ds_map_add(map, 'scheme', string_copy(url, 1, colonPos - 1)); +url = string_copy(url, colonPos + 1, string_length(url) - colonPos); + +// before double slash +// remove slashes (yes this will screw up file:// but who cares) +while (string_char_at(url, 1) == '/') + url = string_copy(url, 2, string_length(url) - 1); + +// before hostname +var slashPos, colonPos; +// Find slash for beginning of path +slashPos = string_pos('/', url); +// No slash ahead - http://host format with no ending slash +if (slashPos == 0) +{ + // Find : for beginning of port + colonPos = string_pos(':', url); +} +else +{ + // Find : for beginning of port prior to / + colonPos = string_pos(':', string_copy(url, 1, slashPos - 1)); +} +// No colon - no port +if (colonPos == 0) +{ + // There was no slash + if (slashPos == 0) + { + ds_map_add(map, 'host', url); + return map; + } + // There was a slash + else + { + ds_map_add(map, 'host', string_copy(url, 1, slashPos - 1)); + url = string_copy(url, slashPos, string_length(url) - slashPos + 1); + } +} +// There's a colon - port specified +else +{ + // There was no slash + if (slashPos == 0) + { + ds_map_add(map, 'host', string_copy(url, 1, colonPos - 1)); + ds_map_add(map, 'port', real(string_copy(url, colonPos + 1, string_length(url) - colonPos))); + return map; + } + // There was a slash + else + { + ds_map_add(map, 'host', string_copy(url, 1, colonPos - 1)); + url = string_copy(url, colonPos + 1, string_length(url) - colonPos); + slashPos = string_pos('/', url); + ds_map_add(map, 'port', real(string_copy(url, 1, slashPos - 1))); + url = string_copy(url, slashPos, string_length(url) - slashPos + 1); + } +} + +// before path +var queryPos; +queryPos = string_pos('?', url); +// There's no ? - no query +if (queryPos == 0) +{ + ds_map_add(map, 'abs_path', url); + return map; +} +else +{ + ds_map_add(map, 'abs_path', string_copy(url, 1, queryPos - 1)); + ds_map_add(map, 'query', string_copy(url, queryPos + 1, string_length(url) - queryPos)); + return map; +} + +// Return -1 upon unlikely error +ds_map_destroy(map); +return -1; + +#define __http_resolve_url +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Takes a base URL and a URL reference and applies it to the base URL +// Returns resulting absolute URL +// string __http_resolve_url(string baseUrl, string refUrl) + +// Return value is a string containing the new absolute URL, or "" on failure + +// Works only for restricted URL syntax as understood by by http_resolve_url +// The sole restriction of which is that only scheme://authority/path URLs work +// This notably excludes file: URLs which lack the authority component + +// As described by RFC3986: +// URI-reference = URI / relative-ref +// relative-ref = relative-part [ "?" query ] [ "#" fragment ] +// relative-part = "//" authority path-abempty +// / path-absolute +// / path-noscheme +// / path-empty +// However http_resolve_url does *not* deal with fragments + +// Algorithm based on that of section 5.2.2 of RFC 3986 + +var baseUrl, refUrl; +baseUrl = argument0; +refUrl = argument1; + +// Parse base URL +var urlParts; +urlParts = __http_parse_url(baseUrl); +if (urlParts == -1) + return ''; + +// Try to parse reference URL +var refUrlParts, canParseRefUrl; +refUrlParts = __http_parse_url(refUrl); +canParseRefUrl = (refUrlParts != -1); +if (refUrlParts != -1) + ds_map_destroy(refUrlParts); + +var result; +result = ''; + +// Parsing of reference URL succeeded - it's absolute and we're done +if (canParseRefUrl) +{ + result = refUrl; +} +// Begins with '//' - scheme-relative URL +else if (string_copy(refUrl, 1, 2) == '//' and string_length(refUrl) > 2) +{ + result = ds_map_find_value(urlParts, 'scheme') + ':' + refUrl; +} +// Is or begins with '/' - absolute path relative URL +else if (((string_char_at(refUrl, 1) == '/' and string_length(refUrl) > 1) or refUrl == '/') +// Doesn't begin with ':' and is not blank - relative path relative URL + or (string_char_at(refUrl, 1) != ':' and string_length(refUrl) > 0)) +{ + // Find '?' for query + var queryPos; + queryPos = string_pos('?', refUrl); + // No query + if (queryPos == 0) + { + refUrl = __http_resolve_path(ds_map_find_value(urlParts, 'abs_path'), refUrl); + ds_map_replace(urlParts, 'abs_path', refUrl); + if (ds_map_exists(urlParts, 'query')) + ds_map_delete(urlParts, 'query'); + } + // Query exists, split + else + { + var path, query; + path = string_copy(refUrl, 1, queryPos - 1); + query = string_copy(refUrl, queryPos + 1, string_length(relUrl) - queryPos); + path = __http_resolve_path(ds_map_find_value(urlParts, 'abs_path'), path); + ds_map_replace(urlParts, 'abs_path', path); + if (ds_map_exists(urlParts, 'query')) + ds_map_replace(urlParts, 'query', query); + else + ds_map_add(urlParts, 'query', query); + } + result = __http_construct_url(urlParts); +} + +ds_map_destroy(urlParts); +return result; + +#define __http_resolve_path +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Takes a base path and a path reference and applies it to the base path +// Returns resulting absolute path +// string __http_resolve_path(string basePath, string refPath) + +// Return value is a string containing the new absolute path + +// Deals with UNIX-style / paths, not Windows-style \ paths +// Can be used to clean up .. and . in non-absolute paths too ('' as basePath) + +var basePath, refPath; +basePath = argument0; +refPath = argument1; + +// refPath begins with '/' (is absolute), we can ignore all of basePath +if (string_char_at(refPath, 1) == '/') +{ + basePath = refPath; + refPath = ''; +} + +var parts, refParts; +parts = __http_split(basePath, '/', 0); +refParts = __http_split(refPath, '/', 0); + +if (refPath != '') +{ + // Find last part of base path + var lastPart; + lastPart = ds_list_find_value(parts, ds_list_size(parts) - 1); + + // If it's not blank (points to a file), remove it + if (lastPart != '') + { + ds_list_delete(parts, ds_list_size(parts) - 1); + } + + // Concatenate refParts to end of parts + var i; + for (i = 0; i < ds_list_size(refParts); i += 1) + ds_list_add(parts, ds_list_find_value(refParts, i)); +} + +// We now don't need refParts any more +ds_list_destroy(refParts); + +// Deal with '..' and '.' +for (i = 0; i < ds_list_size(parts); i += 1) +{ + var part; + part = ds_list_find_value(parts, i); + + if (part == '.') + { + if (i == 1 or i == ds_list_size(parts) - 1) + ds_list_replace(parts, i, ''); + else + ds_list_delete(parts, i); + i -= 1; + continue; + } + else if (part == '..') + { + if (i > 1) + { + ds_list_delete(parts, i - 1); + ds_list_delete(part, i); + i -= 2; + } + else + { + ds_list_replace(parts, i, ''); + i -= 1; + } + continue; + } + else if (part == '' and i != 0 and i != ds_list_size(parts) - 1) + { + ds_list_delete(parts, i); + i -= 1; + continue; + } +} + +// Reconstruct path from parts +var path; +path = ''; +for (i = 0; i < ds_list_size(parts); i += 1) +{ + if (i != 0) + path += '/'; + path += ds_list_find_value(parts, i); +} + +ds_map_destroy(parts); +return path; + +#define __http_parse_hex +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Takes a lowercase hexadecimal string and returns its integer value +// real __http_parse_hex(string hexString) + +// Return value is the whole number value (or -1 if invalid) +// Only works for whole numbers (non-fractional numbers >= 0) and lowercase hex + +var hexString; +hexString = argument0; + +var result, hexValues; +result = 0; +hexValues = "0123456789abcdef"; + +var i; +for (i = 1; i <= string_length(hexString); i += 1) { + result *= 16; + var digit; + digit = string_pos(string_char_at(hexString, i), hexValues) - 1; + if (digit == -1) + return -1; + result += digit; +} + +return result; + +#define __http_construct_url +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Constructs an URL from its components (as http_parse_url would return) +// string __http_construct_url(real parts) + +// Return value is the string of the constructed URL +// Keys of parts map: +// "scheme" - the URL scheme (e.g. "http") +// "host" - the hostname (e.g. "example.com" or "127.0.0.1") +// "port" - the port (e.g. 8000) - this is a real, unlike the others +// "abs_path" - the absolute path (e.g. "/" or "/index.html") +// "query" - the query string (e.g. "a=b&c=3") +// Parts which are omitted will be omitted in the URL +// e.g. http://example.com lacks "port", "path" or "query" keys + +// This will *only* work properly for URLs of format: +// scheme ":" "//" host [ ":" port ] [ abs_path [ "?" query ]]" +// where [] denotes an optional component +// file: URLs will *not* work as they lack the authority (host:port) component +// Should work correctly for IPv6 host values, but bare in mind parse_url won't + +var parts; +parts = argument0; + +var url; +url = ''; + +url += ds_map_find_value(parts, 'scheme'); +url += '://'; +url += ds_map_find_value(parts, 'host'); +if (ds_map_exists(parts, 'port')) + url += ':' + string(ds_map_find_value(parts, 'port')); +if (ds_map_exists(parts, 'abs_path')) +{ + url += ds_map_find_value(parts, 'abs_path'); + if (ds_map_exists(parts, 'query')) + url += '?' + ds_map_find_value(parts, 'query'); +} + +return url; + +#define __http_prepare_request +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Internal function - prepares request +// void __http_prepare_request(real client, string url, real headers) + +// client - HttpClient object to prepare +// url - URL to send GET request to +// headers - ds_map of extra headers to send, -1 if none + +var client, url, headers; +client = argument0; +url = argument1; +headers = argument2; + +var parsed; +parsed = __http_parse_url(url); + +if (parsed == -1) + show_error("Error when making HTTP GET request - can't parse URL: " + url, true); + +if (!ds_map_exists(parsed, 'port')) + ds_map_add(parsed, 'port', 80); +if (!ds_map_exists(parsed, 'abs_path')) + ds_map_add(parsed, 'abs_path', '/'); + +with (client) +{ + destroyed = false; + CR = chr(13); + LF = chr(10); + CRLF = CR + LF; + socket = tcp_connect(ds_map_find_value(parsed, 'host'), ds_map_find_value(parsed, 'port')); + state = 0; + errored = false; + error = ''; + linebuf = ''; + line = 0; + statusCode = -1; + reasonPhrase = ''; + responseBody = buffer_create(); + responseBodySize = -1; + responseBodyProgress = -1; + responseHeaders = ds_map_create(); + requestUrl = url; + requestHeaders = headers; + + // Request = Request-Line ; Section 5.1 + // *(( general-header ; Section 4.5 + // | request-header ; Section 5.3 + // | entity-header ) CRLF) ; Section 7.1 + // CRLF + // [ message-body ] ; Section 4.3 + + // "The Request-Line begins with a method token, followed by the + // Request-URI and the protocol version, and ending with CRLF. The + // elements are separated by SP characters. No CR or LF is allowed + // except in the final CRLF sequence." + if (ds_map_exists(parsed, 'query')) + write_string(socket, 'GET ' + ds_map_find_value(parsed, 'abs_path') + '?' + ds_map_find_value(parsed, 'query') + ' HTTP/1.1' + CRLF); + else + write_string(socket, 'GET ' + ds_map_find_value(parsed, 'abs_path') + ' HTTP/1.1' + CRLF); + + // "A client MUST include a Host header field in all HTTP/1.1 request + // messages." + // "A "host" without any trailing port information implies the default + // port for the service requested (e.g., "80" for an HTTP URL)." + if (ds_map_find_value(parsed, 'port') == 80) + write_string(socket, 'Host: ' + ds_map_find_value(parsed, 'host') + CRLF); + else + write_string(socket, 'Host: ' + ds_map_find_value(parsed, 'host') + + ':' + string(ds_map_find_value(parsed, 'port')) + CRLF); + + // "An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to + // maintain a persistent connection unless a Connection header including + // the connection-token "close" was sent in the request." + write_string(socket, 'Connection: close' + CRLF); + + // "If no Accept-Encoding field is present in a request, the server MAY + // assume that the client will accept any content coding." + write_string(socket, 'Accept-Encoding:' + CRLF); + + // If headers specified + if (headers != -1) + { + var key; + // Iterate over headers map + for (key = ds_map_find_first(headers); is_string(key); key = ds_map_find_next(headers, key)) + { + write_string(socket, key + ': ' + ds_map_find_value(headers, key) + CRLF); + } + } + + // Send extra CRLF to terminate request + write_string(socket, CRLF); + + socket_send(socket); + + ds_map_destroy(parsed); +} + +#define __http_parse_header +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Internal function - parses header +// real __http_parse_header(string linebuf, real line) +// Returns false if it errored (caller should return and destroy) + +var linebuf, line; +linebuf = argument0; +line = argument1; + +// "HTTP/1.1 header field values can be folded onto multiple lines if the +// continuation line begins with a space or horizontal tab." +if ((string_char_at(linebuf, 1) == ' ' or ord(string_char_at(linebuf, 1)) == 9)) +{ + if (line == 1) + { + errored = true; + error = "First header line of response can't be a continuation, right?"; + return false; + } + headerValue = ds_map_find_value(responseHeaders, string_lower(headerName)) + + string_copy(linebuf, 2, string_length(linebuf) - 1); +} +// "Each header field consists +// of a name followed by a colon (":") and the field value. Field names +// are case-insensitive. The field value MAY be preceded by any amount +// of LWS, though a single SP is preferred." +else +{ + var colonPos; + colonPos = string_pos(':', linebuf); + if (colonPos == 0) + { + errored = true; + error = "No colon in a header line of response"; + return false; + } + headerName = string_copy(linebuf, 1, colonPos - 1); + headerValue = string_copy(linebuf, colonPos + 1, string_length(linebuf) - colonPos); + // "The field-content does not include any leading or trailing LWS: + // linear white space occurring before the first non-whitespace + // character of the field-value or after the last non-whitespace + // character of the field-value. Such leading or trailing LWS MAY be + // removed without changing the semantics of the field value." + while (string_char_at(headerValue, 1) == ' ' or ord(string_char_at(headerValue, 1)) == 9) + headerValue = string_copy(headerValue, 2, string_length(headerValue) - 1); +} + +ds_map_add(responseHeaders, string_lower(headerName), headerValue); + +if (string_lower(headerName) == 'content-length') +{ + responseBodySize = real(headerValue); + responseBodyProgress = 0; +} + +return true; + +#define __http_client_step +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Steps the HTTP client (needs to be called each step or so) + +var client; +client = argument0; + +with (client) +{ + if (errored) + exit; + + // Socket error + if (socket_has_error(socket)) + { + errored = true; + error = "Socket error: " + socket_error(socket); + return __http_client_destroy(); + } + + var available; + available = tcp_receive_available(socket); + + switch (state) + { + // Receiving lines + case 0: + if (!available && tcp_eof(socket)) + { + errored = true; + error = "Unexpected EOF when receiving headers/status code"; + return __http_client_destroy(); + } + + var bytesRead, c; + for (bytesRead = 1; bytesRead <= available; bytesRead += 1) + { + c = read_string(socket, 1); + // Reached end of line + // "HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all + // protocol elements except the entity-body (see appendix 19.3 for + // tolerant applications)." + if (c == LF and string_char_at(linebuf, string_length(linebuf)) == CR) + { + // Strip trailing CR + linebuf = string_copy(linebuf, 1, string_length(linebuf) - 1); + // First line - status code + if (line == 0) + { + // "The first line of a Response message is the Status-Line, consisting + // of the protocol version followed by a numeric status code and its + // associated textual phrase, with each element separated by SP + // characters. No CR or LF is allowed except in the final CRLF sequence." + var httpVer, spacePos; + spacePos = string_pos(' ', linebuf); + if (spacePos == 0) + { + errored = true; + error = "No space in first line of response"; + return __http_client_destroy(); + } + httpVer = string_copy(linebuf, 1, spacePos); + linebuf = string_copy(linebuf, spacePos + 1, string_length(linebuf) - spacePos); + + spacePos = string_pos(' ', linebuf); + if (spacePos == 0) + { + errored = true; + error = "No second space in first line of response"; + return __http_client_destroy(); + } + statusCode = real(string_copy(linebuf, 1, spacePos)); + reasonPhrase = string_copy(linebuf, spacePos + 1, string_length(linebuf) - spacePos); + } + // Other line + else + { + // Blank line, end of response headers + if (linebuf == '') + { + state = 1; + // write remainder + write_buffer_part(responseBody, socket, available - bytesRead); + responseBodyProgress = available - bytesRead; + break; + } + // Header + else + { + if (!__http_parse_header(linebuf, line)) + return __http_client_destroy(); + } + } + + linebuf = ''; + line += 1; + } + else + linebuf += c; + } + break; + // Receiving response body + case 1: + write_buffer(responseBody, socket); + responseBodyProgress += available; + if (tcp_eof(socket)) + { + if (ds_map_exists(responseHeaders, 'transfer-encoding')) + { + if (ds_map_find_value(responseHeaders, 'transfer-encoding') == 'chunked') + { + // Chunked transfer, let's decode it + var actualResponseBody, actualResponseSize; + actualResponseBody = buffer_create(); + actualResponseBodySize = 0; + + // Parse chunks + // chunk = chunk-size [ chunk-extension ] CRLF + // chunk-data CRLF + // chunk-size = 1*HEX + while (buffer_bytes_left(responseBody)) + { + var chunkSize, c; + chunkSize = ''; + + // Read chunk size byte by byte + while (buffer_bytes_left(responseBody)) + { + c = read_string(responseBody, 1); + if (c == CR or c == ';') + break; + else + chunkSize += c; + } + + // We found a semicolon - beginning of chunk-extension + if (c == ';') + { + // skip all extension stuff + while (buffer_bytes_left(responseBody) && c != CR) + { + c = read_string(responseBody, 1); + } + } + // Reached end of header + if (c == CR) + { + c += read_string(responseBody, 1); + // Doesn't end in CRLF + if (c != CRLF) + { + errored = true; + error = 'header of chunk in chunked transfer did not end in CRLF'; + buffer_destroy(actualResponseBody); + return __http_client_destroy(); + } + // chunk-size is empty - something's up! + if (chunkSize == '') + { + errored = true; + error = 'empty chunk-size in a chunked transfer'; + buffer_destroy(actualResponseBody); + return __http_client_destroy(); + } + chunkSize = __http_parse_hex(chunkSize); + // Parsing of size failed - not hex? + if (chunkSize == -1) + { + errored = true; + error = 'chunk-size was not hexadecimal in a chunked transfer'; + buffer_destroy(actualResponseBody); + return __http_client_destroy(); + } + // Is the chunk bigger than the remaining response? + if (chunkSize + 2 > buffer_bytes_left(responseBody)) + { + errored = true; + error = 'chunk-size was greater than remaining data in a chunked transfer'; + buffer_destroy(actualResponseBody); + return __http_client_destroy(); + } + // OK, everything's good, read the chunk + write_buffer_part(actualResponseBody, responseBody, chunkSize); + actualResponseBodySize += chunkSize; + // Check for CRLF + if (read_string(responseBody, 2) != CRLF) + { + errored = true; + error = 'chunk did not end in CRLF in a chunked transfer'; + return __http_client_destroy(); + } + } + else + { + errored = true; + error = 'did not find CR after reading chunk header in a chunked transfer, Faucet HTTP bug?'; + return __http_client_destroy(); + } + // if the chunk size is zero, then it was the last chunk + if (chunkSize == 0 + // trailer headers will be present + and ds_map_exists(responseHeaders, 'trailer')) + { + // Parse header lines + var line; + line = 1; + while (buffer_bytes_left(responseBody)) + { + var linebuf; + linebuf = ''; + while (buffer_bytes_left(responseBody)) + { + c = read_string(responseBody, 1); + if (c != CR) + linebuf += c; + else + break; + } + c += read_string(responseBody, 1); + if (c != CRLF) + { + errored = true; + error = 'trailer header did not end in CRLF in a chunked transfer'; + return __http_client_destroy(); + } + if (!__http_parse_header(linebuf, line)) + return __http_client_destroy(); + line += 1; + } + } + } + responseBodySize = actualResponseBodySize; + buffer_destroy(responseBody); + responseBody = actualResponseBody; + } + else + { + errored = true; + error = 'Unsupported Transfer-Encoding: "' + ds_map_find_value(responseHaders, 'transfer-encoding') + '"'; + return __http_client_destroy(); + } + } + else if (responseBodySize != -1) + { + if (responseBodyProgress < responseBodySize) + { + errored = true; + error = "Unexpected EOF, response body size is less than expected"; + return __http_client_destroy(); + } + } + // 301 Moved Permanently/302 Found/303 See Other/307 Moved Temporarily + if (statusCode == 301 or statusCode == 302 or statusCode == 303 or statusCode == 307) + { + if (ds_map_exists(responseHeaders, 'location')) + { + var location, resolved; + location = ds_map_find_value(responseHeaders, 'location'); + resolved = __http_resolve_url(requestUrl, location); + // Resolving URL didn't fail and it's http:// + if (resolved != '' and string_copy(resolved, 1, 7) == 'http://') + { + // Restart request + __http_client_destroy(); + __http_prepare_request(client, resolved, requestHeaders); + } + else + { + errored = true; + error = "301, 302, 303 or 307 response with invalid or unsupported Location URL ('" + location + "') - can't redirect"; + return __http_client_destroy(); + } + exit; + } + else + { + errored = true; + error = "301, 302, 303 or 307 response without Location header - can't redirect"; + return __http_client_destroy(); + } + } + else + state = 2; + } + break; + // Done. + case 2: + break; + } +} + +#define __http_client_destroy +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Clears up contents of an httpClient prior to destruction or after error + +if (!destroyed) { + socket_destroy(socket); + buffer_destroy(responseBody); + ds_map_destroy(responseHeaders); +} +destroyed = true; + +#define http_new_get +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Makes a GET HTTP request +// real http_new_get(string url) + +// url - URL to send GET request to + +// Return value is an HttpClient instance that can be passed to +// fct_http_request_status etc. +// (errors on failure to parse URL) + +var url, client; + +url = argument0; + +if (!variable_global_exists('__HttpClient')) + __http_init(); + +client = instance_create(0, 0, global.__HttpClient); +__http_prepare_request(client, url, -1); +return client; + +#define http_new_get_ex +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Makes a GET HTTP request with custom headers +// real http_new_get_ex(string url, real headers) + +// url - URL to send GET request to +// headers - ds_map of extra headers to send + +// Return value is an HttpClient instance that can be passed to +// fct_http_request_status etc. +// (errors on failure to parse URL) + +var url, headers, client; + +url = argument0; +headers = argument1; + +if (!variable_global_exists('__HttpClient')) + __http_init(); + +client = instance_create(0, 0, global.__HttpClient); +__http_prepare_request(client, url, headers); +return client; + +#define http_step +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Steps the HTTP client. This is what makes everything actually happen. +// Call it each step. Returns whether or not the request has finished. +// real http_step(real client) + +// client - HttpClient object + +// Return value is either: +// 0 - In progress +// 1 - Done or Errored + +// Example usage: +// req = http_new_get("http://example.com/x.txt"); +// while (http_step(req)) {} +// if (http_status_code(req) != 200) { +// // Errored! +// } else { +// // Hasn't errored, do stuff here. +// } + +var client; +client = argument0; + +__http_client_step(client); + +if (client.errored || client.state == 2) + return 1; +else + return 0; + +#define http_status_code +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the status code +// real http_status_code(real client) + +// client - HttpClient object + +// Return value is either: +// * 0, if the request has not yet finished +// * a negative value, if there was an internal Faucet HTTP error +// * a positive value, the status code of the HTTP request + +// "The Status-Code element is a 3-digit integer result code of the +// attempt to understand and satisfy the request. These codes are fully +// defined in section 10. The Reason-Phrase is intended to give a short +// textual description of the Status-Code. The Status-Code is intended +// for use by automata and the Reason-Phrase is intended for the human +// user. The client is not required to examine or display the Reason- +// Phrase." + +// See also: http_reason_phrase, gets the Reason-Phrase + +var client; +client = argument0; + +if (client.errored) + return -1; +else if (client.state == 2) + return client.statusCode; +else + return 0; + +#define http_reason_phrase +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the reason phrase +// string http_reason_phrase(real client) + +// client - HttpClient object +// Return value is either: +// * "", if the request has not yet finished +// * an internal Faucet HTTP error message, if there was one +// * the reason phrase of the HTTP request + +// "The Status-Code element is a 3-digit integer result code of the +// attempt to understand and satisfy the request. These codes are fully +// defined in section 10. The Reason-Phrase is intended to give a short +// textual description of the Status-Code. The Status-Code is intended +// for use by automata and the Reason-Phrase is intended for the human +// user. The client is not required to examine or display the Reason- +// Phrase." + +// See also: http_status_code, gets the Status-Code + +var client; +client = argument0; + +if (client.errored) + return client.error; +else if (client.state == 2) + return client.reasonPhrase; +else + return ""; + +#define http_response_body +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the response body returned by an HTTP request as a buffer +// real http_response_body(real client) + +// client - HttpClient object + +// Return value is a buffer if client hasn't errored and is finished + +var client; +client = argument0; + +return client.responseBody; + +#define http_response_body_size +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the size of response body returned by an HTTP request +// real http_response_body_size(real client) + +// client - HttpClient object + +// Return value is the size in bytes, or -1 if we don't know or don't know yet + +// Call this each time you use the size - it may have changed in the case of redirect + +var client; +client = argument0; + +return client.responseBodySize; + +#define http_response_body_progress +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the size of response body returned by an HTTP request which is so far downloaded +// real http_response_body_progress(real client) + +// client - HttpClient object + +// Return value is the size in bytes, or -1 if we haven't started yet or client has errored + +var client; +client = argument0; + +return client.responseBodyProgress; + +#define http_response_headers +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Gets the response headers returned by an HTTP request as a ds_map +// real http_response_headers(real client) + +// client - HttpClient object + +// Return value is a ds_map if client hasn't errored and is finished + +// All headers will have lowercase keys +// The ds_map is owned by the HttpClient, do not use ds_map_destroy() yourself +// Call when the request has finished - otherwise may be incomplete or missing + +var client; +client = argument0; + +return client.responseHeaders; + +#define http_destroy +// *** +// This function forms part of Faucet HTTP v1.0 +// https://github.com/TazeTSchnitzel/Faucet-HTTP-Extension +// +// Copyright (c) 2013-2014, Andrea Faulds +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// *** + +// Cleans up HttpClient +// void http_destroy(real client) + +// client - HttpClient object + +var client; +client = argument0; + +with (client) +{ + __http_client_destroy(); + instance_destroy(); +} + diff --git a/samples/Game Maker Language/game_init.gml b/samples/Game Maker Language/game_init.gml new file mode 100644 index 00000000..4f5012d2 --- /dev/null +++ b/samples/Game Maker Language/game_init.gml @@ -0,0 +1,484 @@ +/* + Originally from /Source/gg2/Scripts/game_init.gml in Gang Garrison 2 + + Copyright (C) 2008-2013 Faucet Software + http://www.ganggarrison.com + + This program is free software; + you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3 of the License, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, + see . + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +// Returns true if the game is successfully initialized, false if there was an error and we should quit. +{ + instance_create(0,0,RoomChangeObserver); + set_little_endian_global(true); + if file_exists("game_errors.log") file_delete("game_errors.log"); + if file_exists("last_plugin.log") file_delete("last_plugin.log"); + + // Delete old left-over files created by the updater + var backupFilename; + backupFilename = file_find_first("gg2-old.delete.me.*", 0); + while(backupFilename != "") + { + file_delete(backupFilename); + backupFilename = file_find_next(); + } + file_find_close(); + + var customMapRotationFile, restart; + restart = false; + + //import wav files for music + global.MenuMusic=sound_add(choose("Music/menumusic1.wav","Music/menumusic2.wav","Music/menumusic3.wav","Music/menumusic4.wav","Music/menumusic5.wav","Music/menumusic6.wav"), 1, true); + global.IngameMusic=sound_add("Music/ingamemusic.wav", 1, true); + global.FaucetMusic=sound_add("Music/faucetmusic.wav", 1, true); + if(global.MenuMusic != -1) + sound_volume(global.MenuMusic, 0.8); + if(global.IngameMusic != -1) + sound_volume(global.IngameMusic, 0.8); + if(global.FaucetMusic != -1) + sound_volume(global.FaucetMusic, 0.8); + + global.sendBuffer = buffer_create(); + global.tempBuffer = buffer_create(); + global.HudCheck = false; + global.map_rotation = ds_list_create(); + + global.CustomMapCollisionSprite = -1; + + window_set_region_scale(-1, false); + + ini_open("gg2.ini"); + global.playerName = ini_read_string("Settings", "PlayerName", "Player"); + if string_count("#",global.playerName) > 0 global.playerName = "Player"; + global.playerName = string_copy(global.playerName, 0, min(string_length(global.playerName), MAX_PLAYERNAME_LENGTH)); + global.fullscreen = ini_read_real("Settings", "Fullscreen", 0); + global.useLobbyServer = ini_read_real("Settings", "UseLobby", 1); + global.hostingPort = ini_read_real("Settings", "HostingPort", 8190); + global.music = ini_read_real("Settings", "Music", ini_read_real("Settings", "IngameMusic", MUSIC_BOTH)); + global.playerLimit = ini_read_real("Settings", "PlayerLimit", 10); + //thy playerlimit shalt not exceed 48! + if (global.playerLimit > 48) + { + if (global.dedicatedMode != 1) + show_message("Warning: Player Limit cannot exceed 48. It has been set to 48"); + global.playerLimit = 48; + ini_write_real("Settings", "PlayerLimit", 48); + } + global.multiClientLimit = ini_read_real("Settings", "MultiClientLimit", 3); + global.particles = ini_read_real("Settings", "Particles", PARTICLES_NORMAL); + global.gibLevel = ini_read_real("Settings", "Gib Level", 3); + global.killCam = ini_read_real("Settings", "Kill Cam", 1); + global.monitorSync = ini_read_real("Settings", "Monitor Sync", 0); + if global.monitorSync == 1 set_synchronization(true); + else set_synchronization(false); + global.medicRadar = ini_read_real("Settings", "Healer Radar", 1); + global.showHealer = ini_read_real("Settings", "Show Healer", 1); + global.showHealing = ini_read_real("Settings", "Show Healing", 1); + global.showHealthBar = ini_read_real("Settings", "Show Healthbar", 0); + global.showTeammateStats = ini_read_real("Settings", "Show Extra Teammate Stats", 0); + global.serverPluginsPrompt = ini_read_real("Settings", "ServerPluginsPrompt", 1); + global.restartPrompt = ini_read_real("Settings", "RestartPrompt", 1); + //user HUD settings + global.timerPos=ini_read_real("Settings","Timer Position", 0) + global.killLogPos=ini_read_real("Settings","Kill Log Position", 0) + global.kothHudPos=ini_read_real("Settings","KoTH HUD Position", 0) + global.clientPassword = ""; + // for admin menu + customMapRotationFile = ini_read_string("Server", "MapRotation", ""); + global.shuffleRotation = ini_read_real("Server", "ShuffleRotation", 1); + global.timeLimitMins = max(1, min(255, ini_read_real("Server", "Time Limit", 15))); + global.serverPassword = ini_read_string("Server", "Password", ""); + global.mapRotationFile = customMapRotationFile; + global.dedicatedMode = ini_read_real("Server", "Dedicated", 0); + global.serverName = ini_read_string("Server", "ServerName", "My Server"); + global.welcomeMessage = ini_read_string("Server", "WelcomeMessage", ""); + global.caplimit = max(1, min(255, ini_read_real("Server", "CapLimit", 5))); + global.caplimitBkup = global.caplimit; + global.autobalance = ini_read_real("Server", "AutoBalance",1); + global.Server_RespawntimeSec = ini_read_real("Server", "Respawn Time", 5); + global.rewardKey = unhex(ini_read_string("Haxxy", "RewardKey", "")); + global.rewardId = ini_read_string("Haxxy", "RewardId", ""); + global.mapdownloadLimitBps = ini_read_real("Server", "Total bandwidth limit for map downloads in bytes per second", 50000); + global.updaterBetaChannel = ini_read_real("General", "UpdaterBetaChannel", isBetaVersion()); + global.attemptPortForward = ini_read_real("Server", "Attempt UPnP Forwarding", 0); + global.serverPluginList = ini_read_string("Server", "ServerPluginList", ""); + global.serverPluginsRequired = ini_read_real("Server", "ServerPluginsRequired", 0); + if (string_length(global.serverPluginList) > 254) { + show_message("Error: Server plugin list cannot exceed 254 characters"); + return false; + } + var CrosshairFilename, CrosshairRemoveBG; + CrosshairFilename = ini_read_string("Settings", "CrosshairFilename", ""); + CrosshairRemoveBG = ini_read_real("Settings", "CrosshairRemoveBG", 1); + global.queueJumping = ini_read_real("Settings", "Queued Jumping", 0); + + global.backgroundHash = ini_read_string("Background", "BackgroundHash", "default"); + global.backgroundTitle = ini_read_string("Background", "BackgroundTitle", ""); + global.backgroundURL = ini_read_string("Background", "BackgroundURL", ""); + global.backgroundShowVersion = ini_read_real("Background", "BackgroundShowVersion", true); + + readClasslimitsFromIni(); + + global.currentMapArea=1; + global.totalMapAreas=1; + global.setupTimer=1800; + global.joinedServerName=""; + global.serverPluginsInUse=false; + // Create plugin packet maps + global.pluginPacketBuffers = ds_map_create(); + global.pluginPacketPlayers = ds_map_create(); + + ini_write_string("Settings", "PlayerName", global.playerName); + ini_write_real("Settings", "Fullscreen", global.fullscreen); + ini_write_real("Settings", "UseLobby", global.useLobbyServer); + ini_write_real("Settings", "HostingPort", global.hostingPort); + ini_key_delete("Settings", "IngameMusic"); + ini_write_real("Settings", "Music", global.music); + ini_write_real("Settings", "PlayerLimit", global.playerLimit); + ini_write_real("Settings", "MultiClientLimit", global.multiClientLimit); + ini_write_real("Settings", "Particles", global.particles); + ini_write_real("Settings", "Gib Level", global.gibLevel); + ini_write_real("Settings", "Kill Cam", global.killCam); + ini_write_real("Settings", "Monitor Sync", global.monitorSync); + ini_write_real("Settings", "Healer Radar", global.medicRadar); + ini_write_real("Settings", "Show Healer", global.showHealer); + ini_write_real("Settings", "Show Healing", global.showHealing); + ini_write_real("Settings", "Show Healthbar", global.showHealthBar); + ini_write_real("Settings", "Show Extra Teammate Stats", global.showTeammateStats); + ini_write_real("Settings", "Timer Position", global.timerPos); + ini_write_real("Settings", "Kill Log Position", global.killLogPos); + ini_write_real("Settings", "KoTH HUD Position", global.kothHudPos); + ini_write_real("Settings", "ServerPluginsPrompt", global.serverPluginsPrompt); + ini_write_real("Settings", "RestartPrompt", global.restartPrompt); + ini_write_string("Server", "MapRotation", customMapRotationFile); + ini_write_real("Server", "ShuffleRotation", global.shuffleRotation); + ini_write_real("Server", "Dedicated", global.dedicatedMode); + ini_write_string("Server", "ServerName", global.serverName); + ini_write_string("Server", "WelcomeMessage", global.welcomeMessage); + ini_write_real("Server", "CapLimit", global.caplimit); + ini_write_real("Server", "AutoBalance", global.autobalance); + ini_write_real("Server", "Respawn Time", global.Server_RespawntimeSec); + ini_write_real("Server", "Total bandwidth limit for map downloads in bytes per second", global.mapdownloadLimitBps); + ini_write_real("Server", "Time Limit", global.timeLimitMins); + ini_write_string("Server", "Password", global.serverPassword); + ini_write_real("General", "UpdaterBetaChannel", global.updaterBetaChannel); + ini_write_real("Server", "Attempt UPnP Forwarding", global.attemptPortForward); + ini_write_string("Server", "ServerPluginList", global.serverPluginList); + ini_write_real("Server", "ServerPluginsRequired", global.serverPluginsRequired); + ini_write_string("Settings", "CrosshairFilename", CrosshairFilename); + ini_write_real("Settings", "CrosshairRemoveBG", CrosshairRemoveBG); + ini_write_real("Settings", "Queued Jumping", global.queueJumping); + + ini_write_string("Background", "BackgroundHash", global.backgroundHash); + ini_write_string("Background", "BackgroundTitle", global.backgroundTitle); + ini_write_string("Background", "BackgroundURL", global.backgroundURL); + ini_write_real("Background", "BackgroundShowVersion", global.backgroundShowVersion); + + ini_write_real("Classlimits", "Scout", global.classlimits[CLASS_SCOUT]) + ini_write_real("Classlimits", "Pyro", global.classlimits[CLASS_PYRO]) + ini_write_real("Classlimits", "Soldier", global.classlimits[CLASS_SOLDIER]) + ini_write_real("Classlimits", "Heavy", global.classlimits[CLASS_HEAVY]) + ini_write_real("Classlimits", "Demoman", global.classlimits[CLASS_DEMOMAN]) + ini_write_real("Classlimits", "Medic", global.classlimits[CLASS_MEDIC]) + ini_write_real("Classlimits", "Engineer", global.classlimits[CLASS_ENGINEER]) + ini_write_real("Classlimits", "Spy", global.classlimits[CLASS_SPY]) + ini_write_real("Classlimits", "Sniper", global.classlimits[CLASS_SNIPER]) + ini_write_real("Classlimits", "Quote", global.classlimits[CLASS_QUOTE]) + + //screw the 0 index we will start with 1 + //map_truefort + maps[1] = ini_read_real("Maps", "ctf_truefort", 1); + //map_2dfort + maps[2] = ini_read_real("Maps", "ctf_2dfort", 2); + //map_conflict + maps[3] = ini_read_real("Maps", "ctf_conflict", 3); + //map_classicwell + maps[4] = ini_read_real("Maps", "ctf_classicwell", 4); + //map_waterway + maps[5] = ini_read_real("Maps", "ctf_waterway", 5); + //map_orange + maps[6] = ini_read_real("Maps", "ctf_orange", 6); + //map_dirtbowl + maps[7] = ini_read_real("Maps", "cp_dirtbowl", 7); + //map_egypt + maps[8] = ini_read_real("Maps", "cp_egypt", 8); + //arena_montane + maps[9] = ini_read_real("Maps", "arena_montane", 9); + //arena_lumberyard + maps[10] = ini_read_real("Maps", "arena_lumberyard", 10); + //gen_destroy + maps[11] = ini_read_real("Maps", "gen_destroy", 11); + //koth_valley + maps[12] = ini_read_real("Maps", "koth_valley", 12); + //koth_corinth + maps[13] = ini_read_real("Maps", "koth_corinth", 13); + //koth_harvest + maps[14] = ini_read_real("Maps", "koth_harvest", 14); + //dkoth_atalia + maps[15] = ini_read_real("Maps", "dkoth_atalia", 15); + //dkoth_sixties + maps[16] = ini_read_real("Maps", "dkoth_sixties", 16); + + //Server respawn time calculator. Converts each second to a frame. (read: multiply by 30 :hehe:) + if (global.Server_RespawntimeSec == 0) + { + global.Server_Respawntime = 1; + } + else + { + global.Server_Respawntime = global.Server_RespawntimeSec * 30; + } + + // I have to include this, or the client'll complain about an unknown variable. + global.mapchanging = false; + + ini_write_real("Maps", "ctf_truefort", maps[1]); + ini_write_real("Maps", "ctf_2dfort", maps[2]); + ini_write_real("Maps", "ctf_conflict", maps[3]); + ini_write_real("Maps", "ctf_classicwell", maps[4]); + ini_write_real("Maps", "ctf_waterway", maps[5]); + ini_write_real("Maps", "ctf_orange", maps[6]); + ini_write_real("Maps", "cp_dirtbowl", maps[7]); + ini_write_real("Maps", "cp_egypt", maps[8]); + ini_write_real("Maps", "arena_montane", maps[9]); + ini_write_real("Maps", "arena_lumberyard", maps[10]); + ini_write_real("Maps", "gen_destroy", maps[11]); + ini_write_real("Maps", "koth_valley", maps[12]); + ini_write_real("Maps", "koth_corinth", maps[13]); + ini_write_real("Maps", "koth_harvest", maps[14]); + ini_write_real("Maps", "dkoth_atalia", maps[15]); + ini_write_real("Maps", "dkoth_sixties", maps[16]); + + ini_close(); + + // parse the protocol version UUID for later use + global.protocolUuid = buffer_create(); + parseUuid(PROTOCOL_UUID, global.protocolUuid); + + global.gg2lobbyId = buffer_create(); + parseUuid(GG2_LOBBY_UUID, global.gg2lobbyId); + + // Create abbreviations array for rewards use + initRewards() + +var a, IPRaw, portRaw; +doubleCheck=0; +global.launchMap = ""; + + for(a = 1; a <= parameter_count(); a += 1) + { + if (parameter_string(a) == "-dedicated") + { + global.dedicatedMode = 1; + } + else if (parameter_string(a) == "-restart") + { + restart = true; + } + else if (parameter_string(a) == "-server") + { + IPRaw = parameter_string(a+1); + if (doubleCheck == 1) + { + doubleCheck = 2; + } + else + { + doubleCheck = 1; + } + } + else if (parameter_string(a) == "-port") + { + portRaw = parameter_string(a+1); + if (doubleCheck == 1) + { + doubleCheck = 2; + } + else + { + doubleCheck = 1; + } + } + else if (parameter_string(a) == "-map") + { + global.launchMap = parameter_string(a+1); + global.dedicatedMode = 1; + } + } + + if (doubleCheck == 2) + { + global.serverPort = real(portRaw); + global.serverIP = IPRaw; + global.isHost = false; + instance_create(0,0,Client); + } + + global.customMapdesginated = 0; + + // if the user defined a valid map rotation file, then load from there + + if(customMapRotationFile != "" && file_exists(customMapRotationFile) && global.launchMap == "") { + global.customMapdesginated = 1; + var fileHandle, i, mapname; + fileHandle = file_text_open_read(customMapRotationFile); + for(i = 1; !file_text_eof(fileHandle); i += 1) { + mapname = file_text_read_string(fileHandle); + // remove leading whitespace from the string + while(string_char_at(mapname, 0) == " " || string_char_at(mapname, 0) == chr(9)) { // while it starts with a space or tab + mapname = string_delete(mapname, 0, 1); // delete that space or tab + } + if(mapname != "" && string_char_at(mapname, 0) != "#") { // if it's not blank and it's not a comment (starting with #) + ds_list_add(global.map_rotation, mapname); + } + file_text_readln(fileHandle); + } + file_text_close(fileHandle); + } + + else if (global.launchMap != "") && (global.dedicatedMode == 1) + { + ds_list_add(global.map_rotation, global.launchMap); + } + + else { // else load from the ini file Maps section + //Set up the map rotation stuff + var i, sort_list; + sort_list = ds_list_create(); + for(i=1; i <= 16; i += 1) { + if(maps[i] != 0) ds_list_add(sort_list, ((100*maps[i])+i)); + } + ds_list_sort(sort_list, 1); + + // translate the numbers back into the names they represent + for(i=0; i < ds_list_size(sort_list); i += 1) { + switch(ds_list_find_value(sort_list, i) mod 100) { + case 1: + ds_list_add(global.map_rotation, "ctf_truefort"); + break; + case 2: + ds_list_add(global.map_rotation, "ctf_2dfort"); + break; + case 3: + ds_list_add(global.map_rotation, "ctf_conflict"); + break; + case 4: + ds_list_add(global.map_rotation, "ctf_classicwell"); + break; + case 5: + ds_list_add(global.map_rotation, "ctf_waterway"); + break; + case 6: + ds_list_add(global.map_rotation, "ctf_orange"); + break; + case 7: + ds_list_add(global.map_rotation, "cp_dirtbowl"); + break; + case 8: + ds_list_add(global.map_rotation, "cp_egypt"); + break; + case 9: + ds_list_add(global.map_rotation, "arena_montane"); + break; + case 10: + ds_list_add(global.map_rotation, "arena_lumberyard"); + break; + case 11: + ds_list_add(global.map_rotation, "gen_destroy"); + break; + case 12: + ds_list_add(global.map_rotation, "koth_valley"); + break; + case 13: + ds_list_add(global.map_rotation, "koth_corinth"); + break; + case 14: + ds_list_add(global.map_rotation, "koth_harvest"); + break; + case 15: + ds_list_add(global.map_rotation, "dkoth_atalia"); + break; + case 16: + ds_list_add(global.map_rotation, "dkoth_sixties"); + break; + + } + } + ds_list_destroy(sort_list); + } + + window_set_fullscreen(global.fullscreen); + + global.gg2Font = font_add_sprite(gg2FontS,ord("!"),false,0); + global.countFont = font_add_sprite(countFontS, ord("0"),false,2); + draw_set_font(global.gg2Font); + cursor_sprite = CrosshairS; + + if(!directory_exists(working_directory + "\Maps")) directory_create(working_directory + "\Maps"); + + instance_create(0, 0, AudioControl); + instance_create(0, 0, SSControl); + + // custom dialog box graphics + message_background(popupBackgroundB); + message_button(popupButtonS); + message_text_font("Century",9,c_white,1); + message_button_font("Century",9,c_white,1); + message_input_font("Century",9,c_white,0); + + //Key Mapping + ini_open("controls.gg2"); + global.jump = ini_read_real("Controls", "jump", ord("W")); + global.down = ini_read_real("Controls", "down", ord("S")); + global.left = ini_read_real("Controls", "left", ord("A")); + global.right = ini_read_real("Controls", "right", ord("D")); + global.attack = ini_read_real("Controls", "attack", MOUSE_LEFT); + global.special = ini_read_real("Controls", "special", MOUSE_RIGHT); + global.taunt = ini_read_real("Controls", "taunt", ord("F")); + global.chat1 = ini_read_real("Controls", "chat1", ord("Z")); + global.chat2 = ini_read_real("Controls", "chat2", ord("X")); + global.chat3 = ini_read_real("Controls", "chat3", ord("C")); + global.medic = ini_read_real("Controls", "medic", ord("E")); + global.drop = ini_read_real("Controls", "drop", ord("B")); + global.changeTeam = ini_read_real("Controls", "changeTeam", ord("N")); + global.changeClass = ini_read_real("Controls", "changeClass", ord("M")); + global.showScores = ini_read_real("Controls", "showScores", vk_shift); + ini_close(); + + calculateMonthAndDay(); + + if(!directory_exists(working_directory + "\Plugins")) directory_create(working_directory + "\Plugins"); + loadplugins(); + + /* Windows 8 is known to crash GM when more than three (?) sounds play at once + * We'll store the kernel version (Win8 is 6.2, Win7 is 6.1) and check it there. + ***/ + registry_set_root(1); // HKLM + global.NTKernelVersion = real(registry_read_string_ext("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\", "CurrentVersion")); // SIC + + if (file_exists(CrosshairFilename)) + { + sprite_replace(CrosshairS,CrosshairFilename,1,CrosshairRemoveBG,false,0,0); + sprite_set_offset(CrosshairS,sprite_get_width(CrosshairS)/2,sprite_get_height(CrosshairS)/2); + } + if(global.dedicatedMode == 1) { + AudioControlToggleMute(); + room_goto_fix(Menu); + } else if(restart) { + room_goto_fix(Menu); + } + return true; +} diff --git a/samples/Game Maker Language/jsonion.gml b/samples/Game Maker Language/jsonion.gml new file mode 100644 index 00000000..e4d2a6cb --- /dev/null +++ b/samples/Game Maker Language/jsonion.gml @@ -0,0 +1,1861 @@ +// Originally from /jsonion.gml in JSOnion +// JSOnion v1.0.0d is licensed under the MIT licence. You may freely adapt and use this library in commercial and non-commercial projects. + +#define __jso_gmt_tuple +{ + + /** + tuple(>element_0<, >element_1<, ..., >element_n<): Return an n-tuple + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + //Position, address table and data + var pos, addr_table, data; + pos = 6*argument_count+4; + addr_table = ""; + data = ""; + + //Build the tuple element-by-element + var i, ca, isstr, datastr; + for (i=0; ith element of + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + //Capture arguments + var t, n, size; + t = argument0; + n = argument1; + size = __jso_gmt_size(t); + + //Search for the bounding positions for the th element in the address table + var start, afterend, isstr; + isstr = ord(string_char_at(t, 4+6*n))-$30; + start = real(string_copy(t, 5+6*n, 5)); + if (n < size-1) { + afterend = real(string_copy(t, 11+6*n, 5)); + } else { + afterend = string_length(t)+1; + } + + //Return the th element with the correct type + if (isstr) { + return string_copy(t, start, afterend-start); + } + else { + return real(string_copy(t, start, afterend-start)); + } + +} + +#define __jso_gmt_size +{ + + /** + size(tuple_source): Return the size of + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + return real(string_copy(argument0, 1, 3)); + +} + +#define __jso_gmt_numtostr +{ + + /** + __gmt_numtostr(num): Return string representation of . Decimal numbers expressed as scientific notation + with double precision (i.e. 15 digits) + @author: GameGeisha + @version: 1.2 (edited) + */ + if (frac(argument0) == 0) { + return string(argument0); + } + + var mantissa, exponent; + exponent = floor(log10(abs(argument0))); + mantissa = string_format(argument0/power(10,exponent), 15, 14); + var i, ca; + i = string_length(mantissa); + do { + ca = string_char_at(mantissa, i); + i -= 1; + } until (ca != "0") + if (ca != ".") { + mantissa = string_copy(mantissa, 1, i+1); + } + else { + mantissa = string_copy(mantissa, 1, i); + } + if (exponent != 0) { + return mantissa + "e" + string(exponent); + } + else { + return mantissa; + } + +} + +#define __jso_gmt_test_all +{ + + /** + test_all(): Runs all test suites + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + //Automated testing sequence + __jso_gmt_test_elem(); + __jso_gmt_test_size(); + __jso_gmt_test_numtostr(); + +} + +#define __jso_gmt_test_numtostr +{ + + /** + _test_numtostr(): Runs number-to-string tests + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + var tolerance; + tolerance = 1/10000000000; + + if (real(__jso_gmt_numtostr(9)) != 9) { + show_message("Scientific notation conversion failed for 1-digit integer! Result: " + __jso_gmt_numtostr(9)); + } + if (real(__jso_gmt_numtostr(500)) != 500) { + show_message("Scientific notation conversion failed for 3-digit integer! Result: " + __jso_gmt_numtostr(500)); + } + if (abs(real(__jso_gmt_numtostr(pi))-pi) > tolerance) { + show_message("Scientific notation conversion failed for pi! Result: " + __jso_gmt_numtostr(pi)); + } + if (abs(real(__jso_gmt_numtostr(104729.903455))-104729.903455) > tolerance) { + show_message("Scientific notation conversion failed for large decimal number! Result: " + __jso_gmt_numtostr(104729.903455)); + } + if (abs(real(__jso_gmt_numtostr(-pi))+pi) > tolerance) { + show_message("Scientific notation conversion failed for -pi! Result: " + __jso_gmt_numtostr(-pi)); + } + if (abs(real(__jso_gmt_numtostr(1/pi))-1/pi) > tolerance) { + show_message("Scientific notation conversion failed for 1/pi! Result: " + __jso_gmt_numtostr(1/pi)); + } + +} + +#define __jso_gmt_test_elem +{ + + /** + _test_elem(): Runs tuple element retrieval tests + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + if (__jso_gmt_elem(__jso_gmt_tuple("Qblock", "kll"), 0) != "Qblock") { + show_message("Element retrieval failed for simple string. #Should be:Qblock#Actual:" + __jso_gmt_elem(__jso_gmt_tuple("Qblock"), 0)); + } + if (__jso_gmt_elem(__jso_gmt_tuple(9, "Q", -7), 0) != 9) { + show_message("Element retrieval failed for simple number. #Should be 9#Actual:" + string(__jso_gmt_elem(__jso_gmt_tuple(9, "Q", 7), 0))); + } + if (__jso_gmt_elem(__jso_gmt_tuple("Qblock", "", "Negg"), 1) != "") { + show_message("Element retrieval failed for empty string#Should be empty string#Actual:"+string(__jso_gmt_elem(__jso_gmt_tuple("Qblock", "", "Negg"), 0))); + } + + if (__jso_gmt_elem(__jso_gmt_elem(__jso_gmt_tuple("Not this", __jso_gmt_tuple(0, 1, 2, 3), "Waahoo"), 1), 3) != 3) { + show_message("Element retrieval failed in nested tuple. #Should be 3#Actual:" + string(__jso_gmt_elem(__jso_gmt_elem(__jso_gmt_tuple("Not this", __jso_gmt_tuple(0, 1, 2, 3), "Waahoo"), 1), 3))); + } + +} + +#define __jso_gmt_test_size +{ + + /** + _test_size(): Runs tuple size tests + @author: GameGeisha + @version: 1.2 (GMTuple) + */ + + if (__jso_gmt_size(__jso_gmt_tuple("Waahoo", "Negg", 0)) != 3) { + show_message("Bad size for 3-tuple"); + } + if (__jso_gmt_size(__jso_gmt_tuple()) != 0) { + show_message("Bad size for null tuple"); + } + if (__jso_gmt_size(__jso_gmt_tuple(7)) != 1) { + show_message("Bad size for 1-tuple"); + } + if (__jso_gmt_size(__jso_gmt_tuple(1,2,3,4,5,6,7,8,9,10)) != 10) { + show_message("Bad size for 10-tuple"); + } + +} + +#define jso_new_map +{ + /** + jso_new_map(): Create a new map. + JSOnion version: 1.0.0d + */ + return ds_map_create(); +} + +#define jso_new_list +{ + /** + jso_new_list(): Create a new list. + JSOnion version: 1.0.0d + */ + return ds_list_create(); +} + +#define jso_map_add_real +{ + /** + jso_map_add_real(map, key, val): Add the key-value pair : to , where is a real value. + JSOnion version: 1.0.0d + */ + ds_map_add(argument0, argument1, argument2); +} + +#define jso_map_add_string +{ + /** + jso_map_add_string(map, key, str): Add the key-value pair : to , where is a string value. + JSOnion version: 1.0.0d + */ + ds_map_add(argument0, argument1, "s" + argument2); +} + +#define jso_map_add_sublist +{ + /** + jso_map_add_sublist(map, key, sublist): Add the key-value pair : to , where is a list. + JSOnion version: 1.0.0d + */ + ds_map_add(argument0, argument1, "l" + string(argument2)); +} + +#define jso_map_add_submap +{ + /** + jso_map_add_submap(map, key, submap): Add the key-value pair : to , where is a map. + JSOnion version: 1.0.0d + */ + ds_map_add(argument0, argument1, "m" + string(argument2)); +} + +#define jso_map_add_integer +{ + /** + jso_map_add_integer(map, key, int): Add the key-value pair : to , where is a integer value. + JSOnion version: 1.0.0d + */ + ds_map_add(argument0, argument1, floor(argument2)); +} + +#define jso_map_add_boolean +{ + /** + jso_map_add_boolean(map, key, bool): Add the key-value pair : to , where is a boolean value. + JSOnion version: 1.0.0d + */ + if (argument2) { + ds_map_add(argument0, argument1, "btrue"); + } else { + ds_map_add(argument0, argument1, "bfalse"); + } +} + +#define jso_list_add_real +{ + /** + jso_list_add_real(list, val): Append the real value to . + JSOnion version: 1.0.0d + */ + ds_list_add(argument0, argument1); +} + +#define jso_list_add_string +{ + /** + jso_list_add_string(list, str): Append the string value to . + JSOnion version: 1.0.0d + */ + ds_list_add(argument0, "s" + argument1); +} + +#define jso_list_add_sublist +{ + /** + jso_list_add_sublist(list, sublist): Append the list to . + JSOnion version: 1.0.0d + */ + ds_list_add(argument0, "l" + string(argument1)); +} + +#define jso_list_add_submap +{ + /** + jso_list_add_submap(list, submap): Append the map to . + JSOnion version: 1.0.0d + */ + ds_list_add(argument0, "m" + string(argument1)); +} + +#define jso_list_add_integer +{ + /** + jso_list_add_integer(list, int): Append the integer to . + JSOnion version: 1.0.0d + */ + ds_list_add(argument0, floor(argument1)); +} + +#define jso_list_add_boolean +{ + /** + jso_list_add_boolean(list, bool): Append the boolean value to . + JSOnion version: 1.0.0d + */ + if (argument1) { + ds_list_add(argument0, "btrue"); + } else { + ds_list_add(argument0, "bfalse"); + } +} + +#define jso_map_get +{ + /** + jso_map_get(map, key): Retrieve the value stored in with the key value , with the correct type. + JSOnion version: 1.0.0d + */ + + //Grab the value + var v; + v = ds_map_find_value(argument0, argument1); + + //String; could be string, map or list + if (is_string(v)) { + switch (string_char_at(v, 1)) { + case "s": + return string_delete(v, 1, 1); + break; + case "l": case "m": + return real(string_delete(v, 1, 1)); + break; + case "b": + if (v == "btrue") { + return true; + } + else if (v == "bfalse") { + return false; + } + else { + show_error("Invalid boolean value.", true); + } + break; + default: show_error("Invalid map contents.", true); break; + } + } + + //Real; return real value as-is + else { + return v; + } +} + +#define jso_map_get_type +{ + /** + jso_map_get_type(map, key): Return the type of value to which the key value is mapped to in . + JSOnion version: 1.0.0d + */ + + //Grab the value + var v; + v = ds_map_find_value(argument0, argument1); + + //String; could be string, map or list + if (is_string(v)) { + switch (string_char_at(v, 1)) { + case "s": + return jso_type_string; + break; + case "l": + return jso_type_list; + break; + case "m": + return jso_type_map; + break; + case "b": + return jso_type_boolean; + break; + default: show_error("Invalid map content type.", true); break; + } + } + + //Real + else { + return jso_type_real; + } +} + +#define jso_list_get +{ + /** + jso_list_get(list, index): Retrieve the value stored in at position , with the correct type. + JSOnion version: 1.0.0d + */ + + //Grab the value + var v; + v = ds_list_find_value(argument0, argument1); + + //String; could be string, map or list + if (is_string(v)) { + switch (string_char_at(v, 1)) { + case "s": + return string_delete(v, 1, 1); + break; + case "l": case "m": + return real(string_delete(v, 1, 1)); + break; + case "b": + if (v == "btrue") { + return true; + } + else if (v == "bfalse") { + return false; + } + else { + show_error("Invalid boolean value.", true); + } + break; + default: show_error("Invalid list contents.", true); break; + } + } + + //Real; return real value as-is + else { + return v; + } +} + +#define jso_list_get_type +{ + /** + jso_list_get_type(list, index): Retrieve the type of value found at position of . + JSOnion version: 1.0.0d + */ + + //Grab the value + var v; + v = ds_list_find_value(argument0, argument1); + + //String; could be string, map or list + if (is_string(v)) { + switch (string_char_at(v, 1)) { + case "s": + return jso_type_string; + break; + case "l": + return jso_type_list; + break; + case "m": + return jso_type_map; + break; + case "b": + return jso_type_boolean; + break; + default: show_error("Invalid list content type.", true); break; + } + } + + //Real + else { + return jso_type_real; + } +} + +#define jso_cleanup_map +{ + /** + jso_cleanup_map(map): Recursively free up . + JSOnion version: 1.0.0d + */ + + //Loop through all keys + var i, l, k; + l = ds_map_size(argument0); + k = ds_map_find_first(argument0); + for (i=0; i. + JSOnion version: 1.0.0d + */ + + //Loop through all elements + var i, l, v; + l = ds_list_size(argument0); + for (i=0; i): Return a JSON-encoded version of real value . + This uses scientific notation with up to 15 significant digits for decimal values. + For integers, it just uses string(). + This is adapted from the same algorithm used in GMTuple. + JSOnion version: 1.0.0d + */ + + return __jso_gmt_numtostr(argument0); +} + +#define jso_encode_string +{ + /** + jso_encode_string(str): Return a JSON-encoded version of string . + JSOnion version: 1.0.0d + */ + + //Iteratively reconstruct the string + var i, l, s, c; + s = ""; + l = string_length(argument0); + for (i=1; i<=l; i+=1) { + //Replace escape characters + c = string_char_at(argument0, i); + switch (ord(c)) { + case 34: case 92: case 47: //Double quotes, backslashes and slashes + s += "\" + c; + break; + case 8: //Backspace + s += "\b"; + break; + case 12: //Form feed + s += "\f"; + break; + case 10: //New line + s += "\n"; + break; + case 13: //Carriage return + s += "\r"; + break; + case 9: //Horizontal tab + s += "\t"; + break; + default: //Not an escape character + s += c; + break; + } + } + + //Add quotes + return '"' + s + '"'; +} + +#define jso_encode_list +{ + /** + jso_encode_list(list): Return a JSON-encoded version of list . + JSOnion version: 1.0.0d + */ + + //Iteratively encode each element + var i, l, s; + s = ""; + l = ds_list_size(argument0); + for (i=0; i 0) { + s += ","; + } + //Select correct encoding for each element, then recursively encode each + switch (jso_list_get_type(argument0, i)) { + case jso_type_real: + s += jso_encode_real(jso_list_get(argument0, i)); + break; + case jso_type_string: + s += jso_encode_string(jso_list_get(argument0, i)); + break; + case jso_type_map: + s += jso_encode_map(jso_list_get(argument0, i)); + break; + case jso_type_list: + s += jso_encode_list(jso_list_get(argument0, i)); + break; + case jso_type_boolean: + s += jso_encode_boolean(jso_list_get(argument0, i)); + break; + } + } + + //Done, add square brackets + return "[" + s + "]"; +} + +#define jso_encode_map +{ + /** + jso_encode_map(map): Return a JSON-encoded version of map . + JSOnion version: 1.0.0d + */ + + //Go through every key-value pair + var i, l, k, s; + s = ""; + l = ds_map_size(argument0); + k = ds_map_find_first(argument0); + for (i=0; i 0) { + s += ","; + } + //Find the key and encode it + if (is_real(k)) { + s += jso_encode_real(k); + } else { + s += jso_encode_string(k); + } + //Add the : separator + s += ":"; + //Select correct encoding for each value, then recursively encode each + switch (jso_map_get_type(argument0, k)) { + case jso_type_real: + s += jso_encode_real(jso_map_get(argument0, k)); + break; + case jso_type_string: + s += jso_encode_string(jso_map_get(argument0, k)); + break; + case jso_type_map: + s += jso_encode_map(jso_map_get(argument0, k)); + break; + case jso_type_list: + s += jso_encode_list(jso_map_get(argument0, k)); + break; + case jso_type_boolean: + s += jso_encode_boolean(jso_map_get(argument0, k)); + break; + } + //Get next key + k = ds_map_find_next(argument0, k); + } + + //Done, add braces + return "{" + s + "}"; +} + +#define jso_encode_integer +{ + /** + jso_encode_integer(int): Return a JSON-encoded version of the integer value . + JSOnion version: 1.0.0d + */ + return string(floor(argument0)); +} + +#define jso_encode_boolean +{ + /** + jso_encode_boolean(bool): Return a JSON-encoded version of the boolean value . + JSOnion version: 1.0.0d + */ + if (argument0) { + return "true"; + } else { + return "false"; + } +} + +#define jso_decode_map +{ + /** + jso_decode_map(json): Return a JSOnion-compatible map representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_map(argument0, 1), 0); +} + +#define jso_decode_list +{ + /** + jso_decode_list(json): Return a JSOnion-compatible list representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_list(argument0, 1), 0); +} + +#define jso_decode_string +{ + /** + jso_decode_string(json): Return a string representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_string(argument0, 1), 0); +} + +#define jso_decode_boolean +{ + /** + jso_decode_boolean(json): Return a boolean value representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_boolean(argument0, 1), 0); +} + +#define jso_decode_real +{ + /** + jso_decode_real(json): Return a real value representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_real(argument0, 1), 0); +} + +#define jso_decode_integer +{ + /** + jso_decode_integer(json): Return an integer value representing the JSON string . + JSOnion version: 1.0.0d + */ + return __jso_gmt_elem(_jso_decode_integer(argument0, 1), 0); +} + +#define _jso_decode_map +{ + /** + _jso_decode_map(json, startindex): Extract a map from JSON string starting at position . + Return a 2-tuple of the extracted map handle and the position after the ending }. + JSOnion version: 1.0.0d + */ + var i, len, map; + i = argument1; + len = string_length(argument0); + map = jso_new_map(); + + //Seek to first { + var c; + c = string_char_at(argument0, i); + if (c != "{") { + do { + i += 1; + c = string_char_at(argument0, i); + if (!_jso_is_whitespace_char(c)) && (c != "{") { + show_error("Cannot parse map at position " + string(i), true); + } + } until (c == "{") + } + i += 1; + + //Read until end of JSON or ending } + var found_end, state, found, current_key; + found_end = false; + state = 0; + for (i=i; i<=len && !found_end; i+=1) { + c = string_char_at(argument0, i); + switch (state) { + //0: Looking for a key or closing } + case 0: + switch (c) { + case "}": + found_end = true; + break; + case '"': + found = _jso_decode_string(argument0, i); + current_key = __jso_gmt_elem(found, 0); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "+": case "-": + found = _jso_decode_real(argument0, i); + current_key = __jso_gmt_elem(found, 0); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + //1: Looking for the : separator + case 1: + switch (c) { + case ":": + state = 2; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + //2: Looking for a value + case 2: + switch (c) { + case "[": + found = _jso_decode_list(argument0, i); + jso_map_add_sublist(map, current_key, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 3; + break; + case "{": + found = _jso_decode_map(argument0, i); + jso_map_add_submap(map, current_key, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 3; + break; + case '"': + found = _jso_decode_string(argument0, i); + jso_map_add_string(map, current_key, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 3; + break; + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "+": case "-": + found = _jso_decode_real(argument0, i); + jso_map_add_real(map, current_key, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 3; + break; + case "t": case "f": + found = _jso_decode_boolean(argument0, i); + jso_map_add_boolean(map, current_key, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 3; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + //3: Done looking for an entry, want comma or } + case 3: + switch (c) { + case "}": + found_end = true; + break; + case ",": + state = 0; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + } + } + + //Return extracted map with ending position if the ending } is found + if (found_end) { + return __jso_gmt_tuple(map, i); + } + //Ended too early, throw error + else { + show_error("Unexpected end of map in JSON string.", true); + } +} + +#define _jso_decode_list +{ + /** + _jso_decode_list(json, startindex): Extract a list from JSON string starting at position . + Return a 2-tuple of the extracted list handle and the position after the ending ]. + JSOnion version: 1.0.0d + */ + var i, len, list; + i = argument1; + len = string_length(argument0); + list = jso_new_list(); + + //Seek to first [ + var c; + c = string_char_at(argument0, i); + if (c != "[") { + do { + i += 1; + c = string_char_at(argument0, i); + if (!_jso_is_whitespace_char(c)) && (c != "[") { + show_error("Cannot parse list at position " + string(i), true); + } + } until (c == "[") + } + i += 1; + + //Read until end of JSON or ending ] + var found_end, state, found; + found_end = false; + state = 0; + for (i=i; i<=len && !found_end; i+=1) { + c = string_char_at(argument0, i); + switch (state) { + //0: Looking for an item + case 0: + switch (c) { + case "]": + found_end = true; + break; + case "[": + found = _jso_decode_list(argument0, i); + jso_list_add_sublist(list, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + case "{": + found = _jso_decode_map(argument0, i); + jso_list_add_submap(list, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + case '"': + found = _jso_decode_string(argument0, i); + jso_list_add_string(list, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "+": case "-": + found = _jso_decode_real(argument0, i); + jso_list_add_real(list, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + case "t": case "f": + found = _jso_decode_boolean(argument0, i); + jso_list_add_boolean(list, __jso_gmt_elem(found, 0)); + i = __jso_gmt_elem(found, 1)-1; + state = 1; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + //1: Done looking for an item, want comma or ] + case 1: + switch (c) { + case "]": + found_end = true; + break; + case ",": + state = 0; + break; + default: + if (!_jso_is_whitespace_char(c)) { + show_error("Unexpected character at position " + string(i) + ".", true); + } + break; + } + break; + } + } + + //Return extracted list with ending position if the ending ] is found + if (found_end) { + return __jso_gmt_tuple(list, i); + } + //Ended too early, throw error + else { + show_error("Unexpected end of list in JSON string.", true); + } +} + +#define _jso_decode_string +{ + /** + _jso_decode_string(json, startindex): Extract a string from JSON string starting at position . + Return a 2-tuple of the extracted string and the position after the ending double quote. + JSOnion version: 1.0.0d + */ + var i, len, str; + i = argument1; + len = string_length(argument0); + str = ""; + + //Seek to first double quote + var c; + c = string_char_at(argument0, i); + if (c != '"') { + do { + i += 1; + c = string_char_at(argument0, i); + } until (c == '"') + } + i += 1; + + //Read until end of JSON or ending double quote + var found_end, escape_mode; + found_end = false; + escape_mode = false; + for (i=i; i<=len && !found_end; i+=1) { + c = string_char_at(argument0, i); + //Escape mode + if (escape_mode) { + switch (c) { + case '"': case "\": case "/": + str += c; + escape_mode = false; + break; + case "b": + str += chr(8); + escape_mode = false; + break; + case "f": + str += chr(12); + escape_mode = false; + break; + case "n": + str += chr(10); + escape_mode = false; + break; + case "r": + str += chr(13); + escape_mode = false; + break; + case "t": + str += chr(9); + escape_mode = false; + break; + case "u": + var u; + if (len-i < 5) { + show_error("Invalid escape character at position " + string(i) + ".", true); + } else { + str += chr(_jso_hex_to_decimal(string_copy(argument0, i+1, 4))); + escape_mode = false; + i += 4; + } + break; + default: + show_error("Invalid escape character at position " + string(i) + ".", true); + break; + } + } + //Regular mode + else { + switch (c) { + case '"': found_end = true; break; + case "\": escape_mode = true; break; + default: str += c; break; + } + } + } + + //Return extracted string with ending position if the ending double quote is found + if (found_end) { + return __jso_gmt_tuple(str, i); + } + //Ended too early, throw error + else { + show_error("Unexpected end of string in JSON string.", true); + } +} + +#define _jso_decode_boolean +{ + /** + _jso_decode_boolean(json, startindex): Extract a boolean from JSON string starting at position . + Return a 2-tuple of the extracted boolean and the position after the last e. + JSOnion version: 1.0.0d + */ + var i, len, str; + i = argument1; + len = string_length(argument0); + + //Seek to first t or f that can be found + var c; + c = string_char_at(argument0, i); + if (c != "t") && (c != "f") { + do { + i += 1; + c = string_char_at(argument0, i); + if (!_jso_is_whitespace_char(c)) && (c != "t") && (c != "f") { + show_error("Cannot parse boolean value at position " + string(i), true); + } + } until (c == "t") || (c == "f") + } + + //Look for true if t is found + if (c == "t") && (string_copy(argument0, i, 4) == "true") { + return __jso_gmt_tuple(true, i+4); + } + //Look for false if f is found + else if (c == "f") && (string_copy(argument0, i, 5) == "false") { + return __jso_gmt_tuple(false, i+5); + } + //Error: unexpected ending + else { + show_error("Unexpected end of boolean in JSON string.", true); + } +} + +#define _jso_decode_real +{ + /** + _jso_decode_real(json, startindex): Extract a real value from JSON string starting at position . + Return a 2-tuple of the extracted real value and the position after the real value. + JSOnion version: 1.0.0d + */ + var i, len, str; + i = argument1; + len = string_length(argument0); + str = ""; + + //Seek to first character: +, -, or 0-9 + var c; + c = string_char_at(argument0, i); + if (string_pos(c, "0123456789+-") == 0) { + do { + i += 1; + c = string_char_at(argument0, i); + if (!_jso_is_whitespace_char(c)) && (string_pos(c, "0123456789+-") == 0) { + show_error("Cannot parse real value at position " + string(i), true); + } + } until (string_pos(c, "0123456789+-") > 0) + } + + //Determine starting state + var state; + switch (c) { + case "+": case "-": + state = 0; + break; + default: + state = 1; + break; + } + str += c; + i += 1; + + //Loop until no more digits found + var done; + done = false; + for (i=i; i<=len && !done; i+=1) { + c = string_char_at(argument0, i); + switch (state) { + //0: Found a sign, looking for a starting number + case 0: + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = 1; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + break; + //1: Found a starting digit, looking for decimal dot, e, E, or more digits + case 1: + if (_jso_is_whitespace_char(c)) || (string_pos(c, ":,]}") > 0) { + done = true; + i -= 1; + } else { + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + break; + case ".": + str += c; + state = 2; + break; + case "e": case "E": + str += c; + state = 3; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a dot, e, E or a digit.", true); + break; + } + } + break; + //2: Found a decimal dot, looking for more digits + case 2: + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = -2; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + break; + //-2: Found a decimal dot and a digit after it, looking for more digits, e, or E + case -2: + if (_jso_is_whitespace_char(c)) || (string_pos(c, ":,]}") > 0) { + done = true; + i -= 1; + } else { + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + break; + case "e": case "E": + str += c; + state = 3; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting an e, E or a digit.", true); + break; + } + } + break; + //3: Found an e/E, looking for +, - or more digits + case 3: + switch (c) { + case "+": case "-": + str += c; + state = 4; + break; + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = 5; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a +, - or a digit.", true); + break; + } + break; + //4: Found an e/E exponent sign, looking for more digits + case 4: + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = 5; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + break; + //5: Looking for final digits of the exponent + case 5: + if (_jso_is_whitespace_char(c)) || (string_pos(c, ":,]}") > 0) { + done = true; + i -= 1; + } else { + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = 5; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + } + break; + } + } + + //Am I still expecting more characters? + if (done) || (state == 1) || (state == -2) || (state == 5) { + return __jso_gmt_tuple(real(str), i); + } + //Error: unexpected ending + else { + show_error("Unexpected end of real in JSON string.", true); + } +} + +#define _jso_decode_integer +{ + /** + _jso_decode_real(json, startindex): Extract a real value from JSON string starting at position . + Return a 2-tuple of the extracted integer value (with leading i) and the position after the real value. + JSOnion version: 1.0.0d + */ + var i, len, str; + i = argument1; + len = string_length(argument0); + str = ""; + + //Seek to first character: +, -, or 0-9 + var c; + c = string_char_at(argument0, i); + if (string_pos(c, "0123456789+-") == 0) { + do { + i += 1; + c = string_char_at(argument0, i); + if (!_jso_is_whitespace_char(c)) && (string_pos(c, "0123456789+-") == 0) { + show_error("Cannot parse integer value at position " + string(i), true); + } + } until (string_pos(c, "0123456789+-") > 0) + } + + //Determine starting state + var state; + switch (c) { + case "+": case "-": + state = 0; + break; + default: + state = 1; + break; + } + str += c; + i += 1; + + //Loop until no more digits found + var done; + done = false; + for (i=i; i<=len && !done; i+=1) { + c = string_char_at(argument0, i); + switch (state) { + //0: Found a sign, looking for a starting number + case 0: + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + state = 1; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + break; + //1: Found a starting digit, looking for decimal dot, e, E, or more digits + case 1: + if (_jso_is_whitespace_char(c)) || (string_pos(c, ":,]}") > 0) { + done = true; + i -= 1; + } else { + switch (c) { + case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": + str += c; + break; + default: + show_error("Unexpected character at position " + string(i) + ", expecting a digit.", true); + break; + } + } + break; + } + } + + //Am I still expecting more characters? + if (done) || (state == 1) { + return __jso_gmt_tuple(floor(real(str)), i); + } + //Error: unexpected ending + else { + show_error("Unexpected end of integer in JSON string.", true); + } +} + +#define jso_compare_maps +{ + /** + jso_compare_maps(map1, map2): Return whether the contents of JSOnion-compatible maps and are the same. + JSOnion version: 1.0.0d + */ + + //If they aren't the same size, they can't be the same + var size; + size = ds_map_size(argument0); + if (size != ds_map_size(argument1)) { + return false; + } + + //Compare contents pairwise + var i, k, type, a, b; + k = ds_map_find_first(argument0); + for (i=0; i and are the same. + JSOnion version: 1.0.0d + */ + + //If they aren't the same size, they can't be the same + var size; + size = ds_list_size(argument0); + if (size != ds_list_size(argument1)) { + return false; + } + + //Compare contents pairwise + var i, type, a, b; + for (i=0; i, return whether a value exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i, return whether a value exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i, return the value that exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i, return the type of value that exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i, return the value that exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i, return the type of value that exists there. + JSOnion version: 1.0.0d + */ + + //Catch empty calls + if (argument_count < 2) { + show_error("Expected at least 2 arguments, got " + string(argument_count) + ".", true); + } + + //Build list of keys/indices + var i, key_list; + key_list = ds_list_create(); + for (i=1; i= ds_list_size(data)) { + switch (task_type) { + case 0: + return false; + break; + default: + show_error("Index overflow for nested lists in " + type_string + " lookup.", true); + break; + } + } + type = jso_list_get_type(data, k); + data = jso_list_get(data, k); + break; + //Trying to go through a leaf; don't attempt to look further + default: + switch (task_type) { + case 0: + return false; + break; + default: + show_error("Recursive overflow in " + type_string + " lookup.", true); + break; + } + break; + } + } + + //Can find something, return the value requested by the task + switch (task_type) { + case 0: + return true; + break; + case 1: + return data; + break; + case 2: + return type; + break; + } +} + +#define _jso_is_whitespace_char +{ + /** + _jso_is_whitespace_char(char): Return whether is a whitespace character. + Definition of whitespace is given by Unicode 6.0, Chapter 4.6. + JSOnion version: 1.0.0d + */ + switch (ord(argument0)) { + case $0009: + case $000A: + case $000B: + case $000C: + case $000D: + case $0020: + case $0085: + case $00A0: + case $1680: + case $180E: + case $2000: + case $2001: + case $2002: + case $2003: + case $2004: + case $2005: + case $2006: + case $2007: + case $2008: + case $2009: + case $200A: + case $2028: + case $2029: + case $202F: + case $205F: + case $3000: + return true; + } + return false; +} + +#define _jso_hex_to_decimal +{ + /** + _jso_hex_to_decimal(hex_string): Return the decimal value of the hex number represented by + JSOnion version: 1.0.0d + */ + var hex_string, hex_digits; + hex_string = string_lower(argument0); + hex_digits = "0123456789abcdef"; + + //Convert digit-by-digit + var i, len, digit_value, num; + len = string_length(hex_string); + num = 0; + for (i=1; i<=len; i+=1) { + digit_value = string_pos(string_char_at(hex_string, i), hex_digits)-1; + if (digit_value >= 0) { + num *= 16; + num += digit_value; + } + //Unknown character + else { + show_error("Invalid hex number: " + argument0, true); + } + } + return num; +} + diff --git a/samples/Game Maker Language/jsonion_test.gml b/samples/Game Maker Language/jsonion_test.gml new file mode 100644 index 00000000..3cf0d423 --- /dev/null +++ b/samples/Game Maker Language/jsonion_test.gml @@ -0,0 +1,1169 @@ +// Originally from /jsonion_test.gml in JSOnion +// JSOnion v1.0.0d is licensed under the MIT licence. You may freely adapt and use this library in commercial and non-commercial projects. + +#define assert_true +{ + /** + assert_true(result, errormsg): Display error unless is true. + */ + + if (!argument0) { + _assert_error_popup(argument1 + string_repeat(_assert_newline(), 2) + "Expected true, got false."); + } +} + +#define assert_false +{ + /** + assert_false(result, errormsg): Display error unless is false. + */ + + if (argument0) { + _assert_error_popup(argument1 + string_repeat(_assert_newline(), 2) + "Expected false, got true."); + } +} + +#define assert_equal +{ + /** + assert_equal(expected, result, errormsg): Display error unless and are equal. + */ + + //Safe equality check; won't crash even if the two are different types + var match; + match = is_string(argument0) == is_string(argument1); + if (match) { + match = argument0 == argument1; + } + + //No match? + if (!match) { + //Data types + var type; + type[0] = "(Real)"; + type[1] = "(String)"; + + //Construct message + var msg; + msg = argument2; + //Add expected value + msg += string_repeat(_assert_newline(), 2); + msg += "Expected " + type[is_string(argument0)] + ":" + _assert_newline(); + msg += _assert_debug_value(argument0); + //Add actual value + msg += string_repeat(_assert_newline(), 2); + msg += "Actual " + type[is_string(argument1)] + ":" + _assert_newline(); + msg += _assert_debug_value(argument1); + + //Display message + _assert_error_popup(msg); + } +} + +#define _assert_error_popup +{ + /** + _assert_error_popup(msg): Display an assertion error. + */ + + //Display message + if (os_browser == browser_not_a_browser) { + show_error(argument0, false); //Full-fledged error message for non-browser environments + } else { + show_message(argument0); //Browsers don't support show_error(), use show_message() instead + } +} + +#define _assert_debug_value +{ + /** + _assert_debug_value(val): Returns a low-level debug value for the value . + can be a string or a real value. + */ + + //String + if (is_string(argument0)) { + if (os_browser == browser_not_a_browser) { + return argument0; + } else { + return string_replace_all(argument0, "#", "\#"); + } + } + + //Numeric --- use GMTuple's algorithm + else { + + //Integers + if (frac(argument0) == 0) { + return string(argument0); + } + + //Decimal numbers; get exponent and mantissa + var mantissa, exponent; + exponent = floor(log10(abs(argument0))); + mantissa = string_format(argument0/power(10,exponent), 15, 14); + //Look for trailing zeros in the mantissa + var i, ca; + i = string_length(mantissa); + do { + ca = string_char_at(mantissa, i); + i -= 1; + } until (ca != "0") + //Remove the dot if only the first digit of the normalized mantissa is nonzero + if (ca != ".") { + mantissa = string_copy(mantissa, 1, i+1); + } + else { + mantissa = string_copy(mantissa, 1, i); + } + //Remove the exponent if it is 0 + if (exponent != 0) { + return mantissa + "e" + string(exponent); + } else { + return mantissa; + } + + //GMTuple algorithm done + } +} + +#define _assert_newline +{ + /** + _assert_newline(): Returns a system-appropriate newline character sequence. + */ + + if (os_browser == browser_not_a_browser) { + return chr(13) + chr(10); + } else { + return "#"; + } +} + +#define jso_test_all +{ + /** + jso_test_all(): Run the test suite for the JSOnion library. + JSOnion version: 1.0.0d + */ + var a, b; + a = current_time; + _test_jso_new(); + _test_jso_map_add(); + _test_jso_list_add(); + _test_jso_encode(); + _test_jso_compare(); + _test_jso_decode(); + _test_jso_lookup(); + _test_jso_bugs(); + __jso_gmt_test_all(); + b = current_time; + show_debug_message("JSOnion: Tests completed in " + string(b-a) + "ms."); +} + +#define _test_jso_new +{ + /** + _test_jso_new(): Test jso_new_*() functions. + JSOnion version: 1.0.0d + */ + + var expected, actual; + + //jso_new_map() + actual = jso_new_map(); + assert_true(actual >= 0, "jso_new_map() failed to create a new map."); + ds_map_destroy(actual); + + //jso_new_list() + actual = jso_new_list(); + assert_true(actual >= 0, "jso_new_list() failed to create a new list."); + ds_list_destroy(actual); +} + +#define _test_jso_map_add +{ + /** + _test_jso_map_add(): Test jso_map_add_*() functions. + JSOnion version: 1.0.0d + */ + + var expected, actual, key, map; + map = jso_new_map(); + + //jso_map_add_real() + expected = pi; + key = "pi"; + jso_map_add_real(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_real() failed to add the number."); + assert_equal(expected, actual, "jso_map_add_real() added the wrong number."); + ds_map_delete(map, key); + + //jso_map_add_string() + expected = "waahoo"; + key = "str"; + jso_map_add_string(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_string() failed to add the string."); + assert_equal(expected, actual, "jso_map_add_string() added the wrong string."); + ds_map_delete(map, key); + + //jso_map_add_sublist() + expected = jso_new_list(); + key = "sublist"; + jso_map_add_sublist(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_sublist() failed to add the new sublist."); + assert_equal(expected, actual, "jso_map_add_sublist() added the wrong sublist."); + ds_map_delete(map, key); + ds_list_destroy(expected); + + //jso_map_add_submap() + expected = jso_new_map(); + key = "sublist"; + jso_map_add_sublist(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_submap() failed to add the new submap."); + assert_equal(expected, actual, "jso_map_add_submap() added the wrong submap."); + ds_map_delete(map, key); + ds_map_destroy(expected); + + //jso_map_add_integer() + expected = 2345; + key = "integer"; + jso_map_add_integer(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_integer() failed to add the new integer."); + assert_equal(expected, actual, "jso_map_add_integer() added the wrong integer."); + ds_map_delete(map, key); + + //jso_map_add_boolean() --- true + expected = true; + key = "booleantrue"; + jso_map_add_boolean(map, key, expected); + actual = jso_map_get(map, key); + assert_true(ds_map_exists(map, key), "jso_map_add_boolean() failed to add true."); + assert_true(actual, "jso_map_add_boolean() added the wrong true."); + ds_map_delete(map, key); + + //jso_map_add_boolean() --- false + expected = false; + key = "booleanfalse"; + jso_map_add_boolean(map, key, expected); + actual = jso_map_get(map, key) + assert_true(ds_map_exists(map, key), "jso_map_add_boolean() failed to add false."); + assert_false(actual, "jso_map_add_boolean() added the wrong false."); + ds_map_delete(map, key); + + //Cleanup + ds_map_destroy(map); +} + +#define _test_jso_list_add +{ + /** + _test_jso_list_add(): Test jso_list_add_*() functions. + JSOnion version: 1.0.0d + */ + + var expected, actual, list; + list = jso_new_list(); + + //jso_list_add_real() + expected = pi; + jso_list_add_real(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_real() failed to add the number."); + assert_equal(expected, actual, "jso_list_add_real() added the wrong number."); + ds_list_clear(list); + + //jso_list_add_string() + expected = "waahoo"; + jso_list_add_string(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_string() failed to add the string."); + assert_equal(expected, actual, "jso_list_add_string() added the wrong string."); + ds_list_clear(list); + + //jso_list_add_sublist() + expected = jso_new_list(); + jso_list_add_sublist(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_sublist() failed to add the sublist."); + assert_equal(expected, actual, "jso_list_add_sublist() added the wrong sublist."); + ds_list_clear(list); + ds_list_destroy(expected); + + //jso_list_add_submap() + expected = jso_new_map(); + jso_list_add_submap(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_submap() failed to add the submap."); + assert_equal(expected, actual, "jso_list_add_submap() added the wrong submap."); + ds_list_clear(list); + ds_map_destroy(expected); + + //jso_list_add_integer() + expected = 2345; + jso_list_add_integer(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_integer() failed to add integer."); + assert_equal(expected, actual, "jso_list_add_integer() added the wrong integer."); + ds_list_clear(list); + + //jso_list_add_boolean() --- true + expected = true; + jso_list_add_boolean(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_boolean() failed to add boolean true."); + assert_true(actual, "jso_list_add_boolean() added the wrong boolean true."); + ds_list_clear(list); + + //jso_list_add_boolean() --- false + expected = false; + jso_list_add_boolean(list, expected); + actual = jso_list_get(list, 0); + assert_false(ds_list_empty(list), "jso_list_add_boolean() failed to add boolean false."); + assert_false(actual, "jso_list_add_boolean() added the wrong boolean false."); + ds_list_clear(list); + + //Cleanup + ds_list_destroy(list); +} + +#define _test_jso_encode +{ + /** + _test_jso_encode(): Tests jso_encode_*() functions. + JSOnion version: 1.0.0d + */ + + var original, expected, actual; + + //jso_encode_real() --- Positive + expected = 3.1415; + actual = jso_encode_real(3.1415); + assert_equal(expected, real(actual), "jso_encode_real() failed to encode positive real!"); + + //jso_encode_real() --- Negative + expected = -2.71828; + actual = jso_encode_real(-2.71828); + assert_equal(expected, real(actual), "jso_encode_real() failed to encode negative real!"); + + //jso_encode_real() --- Zero + expected = 0; + actual = jso_encode_integer(0); + assert_equal(expected, real(actual), "jso_encode_real() failed to encode zero!"); + + //jso_encode_integer() --- Positive + expected = "2345"; + actual = jso_encode_integer(2345); + assert_equal(expected, actual, "jso_encode_integer() failed to encode positive integer!"); + + //jso_encode_integer() --- Negative + expected = "-45"; + actual = jso_encode_integer(-45); + assert_equal(expected, actual, "jso_encode_integer() failed to encode negative integer!"); + + //jso_encode_integer() --- Zero + expected = "0"; + actual = jso_encode_integer(0); + assert_equal(expected, actual, "jso_encode_integer() failed to encode zero!"); + + //jso_encode_boolean() --- true + expected = "true"; + actual = jso_encode_boolean(true); + assert_equal(expected, actual, "jso_encode_boolean() failed to encode true!"); + + //jso_encode_boolean() --- false + expected = "false"; + actual = jso_encode_boolean(false); + assert_equal(expected, actual, "jso_encode_boolean() failed to encode false!"); + + //jso_encode_string() --- Simple string + expected = '"waahoo"'; + actual = jso_encode_string("waahoo"); + assert_equal(expected, actual, "jso_encode_string() failed to encode simple string!"); + + //jso_encode_string() --- Empty string + expected = '""'; + actual = jso_encode_string(""); + assert_equal(expected, actual, "jso_encode_string() failed to encode empty string!"); + + //jso_encode_string() --- Basic escape characters + expected = '"\\\"\b\f\n\r\t"'; + actual = jso_encode_string('\"' + chr(8) + chr(12) + chr(10) + chr(13) + chr(9)); + assert_equal(expected, actual, "jso_encode_string() failed to encode escape character string!"); + + //jso_encode_map() --- Empty map + var empty_map; + empty_map = jso_new_map(); + expected = "{}"; + actual = jso_encode_map(empty_map); + assert_equal(expected, actual, "jso_encode_map() failed to encode empty map!"); + jso_cleanup_map(empty_map); + + //jso_encode_map() --- One-element map + var one_map; + one_map = jso_new_map(); + jso_map_add_string(one_map, "key", "value"); + expected = '{"key":"value"}'; + actual = jso_encode_map(one_map); + assert_equal(expected, actual, "jso_encode_map() failed to encode one-element map!"); + jso_cleanup_map(one_map); + + //jso_encode_map() --- Multi-element map + var multi_map, ok1, ok2; + multi_map = jso_new_map(); + jso_map_add_string(multi_map, "key1", "value\1"); + jso_map_add_integer(multi_map, "key2", 2); + ok1 = '{"key1":"value\\1","key2":2}'; + ok2 = '{"key2":2,"key1":"value\\1"}'; + actual = jso_encode_map(multi_map); + assert_true((actual == ok1) || (actual == ok2), "jso_encode_map() failed to encode multi-element map!"); + jso_cleanup_map(multi_map); + + //jso_encode_list() --- Empty list + var empty_list; + empty_list = jso_new_list(); + expected = "[]"; + actual = jso_encode_list(empty_list); + assert_equal(expected, actual, "jso_encode_list() failed to encode empty list!"); + jso_cleanup_list(empty_list); + + //jso_encode_list() --- One-element nested list + var one_list; + one_list = jso_new_list(); + jso_list_add_submap(one_list, jso_new_map()); + expected = "[{}]"; + actual = jso_encode_list(one_list); + assert_equal(expected, actual, "jso_encode_list() failed to encode one-element nested list!"); + jso_cleanup_list(one_list); + + //jso_encode_list() --- Multi-element nested list + var multi_list, submap, sublist; + multi_list = jso_new_list(); + submap = jso_new_map(); + jso_map_add_string(submap, "1", "one"); + jso_list_add_submap(multi_list, submap); + jso_list_add_integer(multi_list, 2); + sublist = jso_new_list(); + jso_list_add_string(sublist, "three"); + jso_list_add_boolean(sublist, true); + jso_list_add_sublist(multi_list, sublist); + expected = '[{"1":"one"},2,["three",true]]'; + actual = jso_encode_list(multi_list); + assert_equal(expected, actual, "jso_encode_list() failed to encode one-element nested list!"); + jso_cleanup_list(multi_list); +} + +#define _test_jso_decode +{ + /** + _test_jso_decode(): Test core _jso_decode_*() functions. + The formatting is intentionally erratic here to simulate actual formatting deviations. + JSOnion version: 1.0.0d + */ + var json, expected, actual, expected_structure, actual_structure; + + ////Primitives + + //_jso_decode_string(): Empty string + json = '""'; + expected = __jso_gmt_tuple("", 3); + actual = _jso_decode_string(json, 1); + assert_equal(expected, actual, "_jso_decode_string() failed to decode an empty string!"); + + //_jso_decode_string(): Small string + json = '"key" '; + expected = __jso_gmt_tuple("key", 6); + actual = _jso_decode_string(json, 1); + assert_equal(expected, actual, "_jso_decode_string() failed to decode a small string!"); + + //_jso_decode_string(): Simple string + json = ' "The quick brown fox jumps over the lazy dog." '; + expected = __jso_gmt_tuple("The quick brown fox jumps over the lazy dog.", 49); + actual = _jso_decode_string(json, 1); + assert_equal(expected, actual, "_jso_decode_string() failed to decode a simple string!"); + + //_jso_decode_string(): Escape characters + json = ' "\"\\\b\f\n\r\t\u003A"'; + expected = __jso_gmt_tuple('"\' + chr(8) + chr(12) + chr(10) + chr(13) + chr(9) + chr($003a), 24); + actual = _jso_decode_string(json, 1); + assert_equal(expected, actual, "_jso_decode_string() failed to decode a string with escape characters!"); + + //_jso_decode_string(): Mixed characters + json = ' "\"\\\bWaahoo\f\n\r\tnegg\u003a"'; + expected = __jso_gmt_tuple('"\' + chr(8) + "Waahoo" + chr(12) + chr(10) + chr(13) + chr(9) + "negg" + chr($003a), 34); + actual = _jso_decode_string(json, 1); + assert_equal(expected, actual, "_jso_decode_string() failed to decode a string with mixed characters!"); + + //_jso_decode_boolean(): True + json = 'true'; + expected = __jso_gmt_tuple(true, 5); + actual = _jso_decode_boolean(json, 1); + assert_equal(expected, actual, "_jso_decode_boolean() failed to decode true!"); + + //_jso_decode_boolean(): False + json = ' false '; + expected = __jso_gmt_tuple(false, 8); + actual = _jso_decode_boolean(json, 1); + assert_equal(expected, actual, "_jso_decode_boolean() failed to decode false!"); + + //_jso_decode_real(): Zero + json = '0'; + expected = __jso_gmt_tuple(0, 2); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode standard zero!"); + + //_jso_decode_real(): Signed zero + json = ' +0 '; + expected = __jso_gmt_tuple(0, 5); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode signed zero!"); + + //_jso_decode_real(): Signed zero with decimal digits + json = ' -0.000'; + expected = __jso_gmt_tuple(0, 8); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode signed zero with decimal digits!"); + + //_jso_decode_real(): Positive real + json = '3.14159'; + expected = __jso_gmt_tuple(3.14159, 8); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode positive real number!"); + + //_jso_decode_real(): Negative real + json = ' -2.71828'; + expected = __jso_gmt_tuple(-2.71828, 10); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode negative real number!"); + + //_jso_decode_real(): Positive real with positive exponent + json = ' 3.14159e2'; + expected = __jso_gmt_tuple(3.14159*100, 11); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode positive real number with positive exponent!"); + + //_jso_decode_real(): Negative real with positive exponent + json = ' -2.71828E2'; + expected = __jso_gmt_tuple(-2.71828*100, 12); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode negative real number with positive exponent!"); + + //_jso_decode_real(): Positive real with negative exponent + json = ' 314.159e-2'; + expected = __jso_gmt_tuple(3.14159, 12); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode positive real number with negative exponent!"); + + //_jso_decode_real(): Negative real with negative exponent + json = ' -271.828E-2'; + expected = __jso_gmt_tuple(-2.71828, 13); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode negative real number with negative exponent!"); + + //_jso_decode_real(): Positive integer + json = ' +1729'; + expected = __jso_gmt_tuple(1729, 7); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode positive integer!"); + + //_jso_decode_real(): Negative integer + json = '-583'; + expected = __jso_gmt_tuple(-583, 5); + actual = _jso_decode_real(json, 1); + assert_equal(expected, actual, "_jso_decode_real() failed to decode negative integer!"); + + //_jso_decode_integer(): Zero + json = ' 0 '; + expected = __jso_gmt_tuple(0, 3); + actual = _jso_decode_integer(json, 1); + assert_equal(expected, actual, "_jso_decode_integer() failed to decode zero!"); + + //_jso_decode_integer(): Positive integer + json = ' 1729 '; + expected = __jso_gmt_tuple(1729, 6); + actual = _jso_decode_integer(json, 1); + assert_equal(expected, actual, "_jso_decode_integer() failed to decode positive integer!"); + + //_jso_decode_integer(): Negative integer + json = ' -583'; + expected = __jso_gmt_tuple(-583, 8); + actual = _jso_decode_integer(json, 1); + assert_equal(expected, actual, "_jso_decode_integer() failed to decode negative integer!"); + + + ////Data structures + + //_jso_decode_map(): Empty map #1 + json = '{}'; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 3); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (#1)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (#1)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode an empty map! (#1)"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): Empty map #2 + json = ' { } '; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 7); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (#2)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (#2)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode an empty map! (#2)"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): One-entry map + json = ' {"key": "value"} '; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 18); + jso_map_add_string(expected_structure, "key", "value"); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (one-entry map)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (one-entry map)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode a one-entry map!"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): Multi-entry map + json = ' {"key" : "value", "pi":3.14, "bool" : true} '; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 48); + jso_map_add_string(expected_structure, "key", "value"); + jso_map_add_real(expected_structure, "pi", 3.14); + jso_map_add_boolean(expected_structure, "bool", true); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (multi-entry map)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (multi-entry map)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode a multi-entry map!"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): Nested maps + var submap; + json = '{ "waahoo" : { "woohah" : 3 } , "woohah" : 4 }'; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 47); + jso_map_add_integer(expected_structure, "woohah", 4); + submap = jso_new_map(); + jso_map_add_integer(submap, "woohah", 3); + jso_map_add_submap(expected_structure, "waahoo", submap); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (nested map)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (nested map)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode a nested map!"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): Map with nested lists + var sublist, subsublist; + json = '{ "waahoo" : [ "woohah", [true] ] , "woohah" : 4 }'; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 51); + jso_map_add_real(expected_structure, "woohah", 4); + sublist = jso_new_list(); + jso_list_add_string(sublist, "woohah"); + subsublist = jso_new_list(); + jso_list_add_boolean(subsublist, true); + jso_list_add_sublist(sublist, subsublist); + jso_map_add_sublist(expected_structure, "waahoo", sublist); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (map with nested lists)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (map with nested lists)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode a map with nested lists!"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_map(): Mix-up nested map + var sublist; + json = ' { "waahoo" : [{}, "a", 1] }'; + expected_structure = jso_new_map(); + expected = __jso_gmt_tuple(expected_structure, 30); + sublist = jso_new_list(); + jso_list_add_submap(sublist, jso_new_map()); + jso_list_add_string(sublist, "a"); + jso_list_add_real(sublist, 1); + jso_map_add_sublist(expected_structure, "waahoo", sublist); + actual = _jso_decode_map(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_map() didn't stop at the right place! (mix-up nested map)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_map() didn't include the right prefix! (mix-up nested map)"); + assert_true(jso_compare_maps(expected_structure, actual_structure), "_jso_decode_map() failed to decode a mix-up nested map!"); + jso_cleanup_map(expected_structure); + jso_cleanup_map(actual_structure); + + //_jso_decode_list(): Empty list #1 + json = '[]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 3); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (#1)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (#1)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode an empty list! (#1)"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure) + + //_jso_decode_list(): Empty list #2 + json = ' [ ] '; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 6); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (#2)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (#2)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode an empty list! (#2)"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); + + //_jso_decode_list(): One-entry list + json = '[3]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 4); + jso_list_add_integer(expected_structure, 3); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (one-entry list)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (one-entry list)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode a one-entry list!"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); + + //_jso_decode_list(): Multi-entry list + json = ' [4,"multi-entry",true]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 24); + jso_list_add_real(expected_structure, 4); + jso_list_add_string(expected_structure, "multi-entry"); + jso_list_add_boolean(expected_structure, true); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (multi-entry list)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (multi-entry list)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode a multi-entry list!"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); + + //_jso_decode_list(): Nested list + var sublist; + json = ' [ [], 3, false, ["waahoo"]]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 29); + jso_list_add_sublist(expected_structure, jso_new_list()); + jso_list_add_integer(expected_structure, 3); + jso_list_add_boolean(expected_structure, false); + sublist = jso_new_list(); + jso_list_add_string(sublist, "waahoo"); + jso_list_add_sublist(expected_structure, sublist); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (nested list)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (nested list)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode a nested list!"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); + + //_jso_decode_list(): List with nested maps + var submap; + json = ' [3, false, { "waahoo":"woo"}]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 31); + jso_list_add_integer(expected_structure, 3); + jso_list_add_boolean(expected_structure, false); + submap = jso_new_map(); + jso_map_add_string(submap, "waahoo", "woo"); + jso_list_add_submap(expected_structure, submap); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (list with nested maps)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (list with nested maps)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode a list with nested maps!"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); + + //_jso_decode_list(): Mix-up nested list + var submap; + json = '[{}, {"a":[]}]'; + expected_structure = jso_new_list(); + expected = __jso_gmt_tuple(expected_structure, 15); + jso_list_add_submap(expected_structure, jso_new_map()); + submap = jso_new_map(); + jso_map_add_sublist(submap, "a", jso_new_list()); + jso_list_add_submap(expected_structure, submap); + actual = _jso_decode_list(json, 1); + actual_structure = __jso_gmt_elem(actual, 0); + assert_equal(__jso_gmt_elem(expected, 1), __jso_gmt_elem(actual, 1), "_jso_decode_list() didn't stop at the right place! (mix-up nested list)"); + assert_equal(actual_structure, __jso_gmt_elem(actual, 0), "_jso_decode_list() didn't include the right prefix! (mix-up nested list)"); + assert_true(jso_compare_lists(expected_structure, actual_structure), "_jso_decode_list() failed to decode a mix-up nested list!"); + jso_cleanup_list(expected_structure); + jso_cleanup_list(actual_structure); +} + +#define _test_jso_compare +{ + /** + _test_jso_compare(): Test basic jso_compare_*() functions. + JSOnion version: 1.0.0d + */ + var a, b; + + //jso_compare_maps(): Empty maps should equal each other + a = jso_new_map(); + b = jso_new_map(); + assert_true(jso_compare_maps(a, b), "Empty maps should equal each other. (#1)"); + assert_true(jso_compare_maps(b, a), "Empty maps should equal each other. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_maps(): An empty map should not equal a filled map + a = jso_new_map(); + b = jso_new_map(); + jso_map_add_string(b, "junk", "info"); + jso_map_add_integer(b, "taxi", 1729); + assert_false(jso_compare_maps(a, b), "An empty map should not equal a filled map. (#1)"); + assert_false(jso_compare_maps(b, a), "An empty map should not equal a filled map. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_maps(): Maps with same content entered in different orders should equal each other + a = jso_new_map(); + b = jso_new_map(); + jso_map_add_real(a, "A", 1); + jso_map_add_real(a, "B", 2); + jso_map_add_real(a, "C", 3); + jso_map_add_real(b, "C", 3); + jso_map_add_real(b, "A", 1); + jso_map_add_real(b, "B", 2); + assert_true(jso_compare_maps(a, b), "Maps with same content entered in different orders should equal each other. (#1)"); + assert_true(jso_compare_maps(b, a), "Maps with same content entered in different orders should equal each other. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_maps(): Maps with different keys should not equal each other + a = jso_new_map(); + b = jso_new_map(); + jso_map_add_real(a, "A", 1); + jso_map_add_real(a, "B", 2); + jso_map_add_real(a, "C", 3); + jso_map_add_real(b, "D", 3); + jso_map_add_real(b, "A", 1); + jso_map_add_real(b, "B", 2); + assert_false(jso_compare_maps(a, b), "Maps with different keys should not equal each other. (#1)"); + assert_false(jso_compare_maps(b, a), "Maps with different keys should not equal each other. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_maps(): Maps with different values should not equal each other + a = jso_new_map(); + b = jso_new_map(); + jso_map_add_real(a, "A", 5); + jso_map_add_real(a, "B", 6); + jso_map_add_real(a, "C", 9); + jso_map_add_real(b, "A", 5); + jso_map_add_real(b, "B", 6); + jso_map_add_real(b, "C", 8); + assert_false(jso_compare_maps(a, b), "Maps with different values should not equal each other. (#1)"); + assert_false(jso_compare_maps(b, a), "Maps with different values should not equal each other. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_maps(): Maps with corresponding values of different types should not equal each other, and should not crash. + a = jso_new_map(); + b = jso_new_map(); + jso_map_add_real(a, "A", 5); + jso_map_add_real(a, "B", 6); + jso_map_add_real(a, "C", 8); + jso_map_add_real(b, "A", 5); + jso_map_add_string(b, "B", "six"); + jso_map_add_real(b, "C", 8); + assert_false(jso_compare_maps(a, b), "Maps with corresponding values of different types should not equal each other, and should not crash. (#1)"); + assert_false(jso_compare_maps(b, a), "Maps with corresponding values of different types should not equal each other, and should not crash. (#2)"); + jso_cleanup_map(a); + jso_cleanup_map(b); + + //jso_compare_lists(): Empty lists should equal each other + a = jso_new_list(); + b = jso_new_list(); + assert_true(jso_compare_lists(a, b), "Empty lists should equal each other. (#1)"); + assert_true(jso_compare_lists(b, a), "Empty lists should equal each other. (#2)"); + jso_cleanup_list(a); + jso_cleanup_list(b); + + //jso_compare_lists(): An empty list should not equal a filled list + a = jso_new_list(); + b = jso_new_list(); + jso_list_add_string(b, "junk"); + jso_list_add_integer(b, 1729); + assert_false(jso_compare_lists(a, b), "An empty list should not equal a filled list. (#1)"); + assert_false(jso_compare_lists(b, a), "An empty list should not equal a filled list. (#2)"); + jso_cleanup_list(a); + jso_cleanup_list(b); + + //jso_compare_lists(): Lists with same content entered in different orders should not equal each other + a = jso_new_list(); + b = jso_new_list(); + jso_list_add_real(a, 1); + jso_list_add_real(a, 2); + jso_list_add_real(a, 3); + jso_list_add_real(b, 3); + jso_list_add_real(b, 1); + jso_list_add_real(b, 2); + assert_false(jso_compare_lists(a, b), "Lists with same content entered in different orders should not equal each other. (#1)"); + assert_false(jso_compare_lists(b, a), "Lists with same content entered in different orders should not equal each other. (#2)"); + jso_cleanup_list(a); + jso_cleanup_list(b); + + //jso_compare_lists(): Lists with corresponding entries of different types should not equal each other, should also not crash. + a = jso_new_list(); + b = jso_new_list(); + jso_list_add_real(a, 1); + jso_list_add_real(a, 2); + jso_list_add_real(a, 3); + jso_list_add_real(b, 1); + jso_list_add_string(b, "two"); + jso_list_add_real(b, 3); + assert_false(jso_compare_lists(a, b), "Lists with corresponding entries of different types should not equal each other, should also not crash. (#1)"); + assert_false(jso_compare_lists(b, a), "Lists with corresponding entries of different types should not equal each other, should also not crash. (#2)"); + jso_cleanup_list(a); + jso_cleanup_list(b); +} + +#define _test_jso_lookup +{ + /** + _test_jso_lookup(): Test core jso_*_lookup() and jso_*_check() functions for nested structures. + JSOnion version: 1.0.0d + */ + var json, structure, expected, actual; + + //jso_map_check(): Single argument --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3 }'; + structure = jso_decode_map(json); + assert_true(jso_map_check(structure, "one"), "jso_map_check() failed to find existing entry! (single argument)"); + jso_cleanup_map(structure); + + //jso_map_lookup(): Single argument --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3 }'; + structure = jso_decode_map(json); + expected = 1; + actual = jso_map_lookup(structure, "one") + assert_equal(expected, actual, "jso_map_lookup() found the wrong entry! (single argument)"); + jso_cleanup_map(structure); + + //jso_map_lookup_type(): Single argument --- exists + json = '{ "one" : -1, "two" : true, "three" : "trap" }'; + structure = jso_decode_map(json); + expected = jso_type_real; + actual = jso_map_lookup_type(structure, "one") + assert_equal(expected, actual, "jso_map_lookup_type() found the wrong type! (single argument)"); + jso_cleanup_map(structure); + + //jso_map_check(): Single argument --- doesn't exist + json = '{ "one" : 1, "two" : 2, "three" : 3 }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "four"), "jso_map_check() found an inexistent entry! (single argument)"); + jso_cleanup_map(structure); + + //jso_map_check(): Single argument --- doesn't exist + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":false } }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "A"), "jso_map_check() found an inexistent entry! (single argument, nested)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments (recurse) --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":false } }'; + structure = jso_decode_map(json); + assert_true(jso_map_check(structure, "four", "A"), "jso_map_check() failed to find existing entry! (multiple arguments)"); + jso_cleanup_map(structure); + + //jso_map_lookup(): Multiple arguments (recurse) --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":false } }'; + structure = jso_decode_map(json); + expected = true; + actual = jso_map_lookup(structure, "four", "A"); + assert_equal(expected, actual, "jso_map_lookup() found the wrong entry! (multiple arguments)"); + jso_cleanup_map(structure); + + //jso_map_lookup_type(): Multiple arguments (recurse) --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":"trap" } }'; + structure = jso_decode_map(json); + expected = jso_type_boolean; + actual = jso_map_lookup_type(structure, "four", "A"); + assert_equal(expected, actual, "jso_map_lookup_type() found the wrong type! (multiple arguments)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments (recurse) --- doesn't exist + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":false } }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "four", "C"), "jso_map_check() found an inexistent entry! (multiple arguments, 1)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments (recurse) --- doesn't exist + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : { "A":true, "B":false } }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "three", ""), "jso_map_check() found an inexistent entry! (multiple arguments, 2)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments with nested list --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : [ "A", true, ["B", false] ] }'; + structure = jso_decode_map(json); + assert_true(jso_map_check(structure, "four", 2, 1), "jso_map_check() failed to find an existing entry! (multiple arguments, nested)"); + jso_cleanup_map(structure); + + //jso_map_lookup(): Multiple arguments with nested list --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : [ "A", true, ["B", false] ] }'; + structure = jso_decode_map(json); + expected = false; + actual = jso_map_lookup(structure, "four", 2, 1); + assert_equal(expected, actual, "jso_map_lookup() failed to find an existing entry! (multiple arguments, nested)"); + jso_cleanup_map(structure); + + //jso_map_lookup_type(): Multiple arguments with nested list --- exists + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : [ "A", true, [false, "false"] ] }'; + structure = jso_decode_map(json); + expected = jso_type_string; + actual = jso_map_lookup_type(structure, "four", 2, 1); + assert_equal(expected, actual, "jso_map_lookup_type() found the wrong type! (multiple arguments, nested)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments with nested list --- wrong type + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : [ "A", true, ["B", false] ] }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "four", "A", 1), "jso_map_check() found an inexistent entry! (multiple arguments, nested, wrong type)"); + jso_cleanup_map(structure); + + //jso_map_check(): Multiple arguments with nested list --- index overflow + json = '{ "one" : 1, "two" : 2, "three" : 3, "four" : [ "A", true, ["B", false] ] }'; + structure = jso_decode_map(json); + assert_false(jso_map_check(structure, "four", 2, 3), "jso_map_check() found an inexistent entry! (multiple arguments, nested, index overflow)"); + jso_cleanup_map(structure); + + //jso_list_check(): Single argument --- exists + json = '["one", 2, "three", true, 5]'; + structure = jso_decode_list(json); + assert_true(jso_list_check(structure, 2), "jso_list_check() failed to find an existing index! (single argument)"); + jso_cleanup_list(structure); + + //jso_list_lookup(): Single argument --- exists + json = '["one", 2, "three", true, 5]'; + structure = jso_decode_list(json); + expected = "three"; + actual = jso_list_lookup(structure, 2); + assert_equal(expected, actual, "jso_list_lookup() found the wrong index! (single argument)"); + jso_cleanup_list(structure); + + //jso_list_lookup_type(): Single argument --- exists + json = '["one", 2, "three", true, 5]'; + structure = jso_decode_list(json); + expected = jso_type_string; + actual = jso_list_lookup_type(structure, 2); + assert_equal(expected, actual, "jso_list_lookup_type() found the wrong type! (single argument)"); + jso_cleanup_list(structure); + + //jso_list_check(): Single argument --- doesn't exist + json = '["one", 2, "three", true, 5]'; + structure = jso_decode_list(json); + assert_false(jso_list_check(structure, 5), "jso_list_check() found an inexistent index! (single argument)"); + jso_cleanup_list(structure); + + //jso_list_check(): Multiple arguments (recurse) --- exists + json = '["one", 2, ["three", 3], true, 5]'; + structure = jso_decode_list(json); + assert_true(jso_list_check(structure, 2, 1), "jso_list_check() failed to find an existing index! (multiple arguments)"); + jso_cleanup_list(structure); + + //jso_list_lookup(): Multiple arguments (recurse) --- exists + json = '["one", 2, ["three", 3], true, 5]'; + structure = jso_decode_list(json); + expected = 3; + actual = jso_list_lookup(structure, 2, 1); + assert_equal(expected, actual, "jso_list_lookup() failed to find an existing index! (multiple arguments)"); + jso_cleanup_list(structure); + + //jso_list_lookup_type(): Multiple arguments (recurse) --- exists + json = '["one", 2, ["three", 3], true, 5]'; + structure = jso_decode_list(json); + expected = jso_type_real; + actual = jso_list_lookup_type(structure, 2, 1); + assert_equal(expected, actual, "jso_list_lookup_type() found the wrong type! (multiple arguments)"); + jso_cleanup_list(structure); + + //jso_list_check(): Multiple arguments (recurse) --- doesn't exist, inner index overflow + json = '["one", 2, ["three", 3], true, 5]'; + structure = jso_decode_list(json); + assert_false(jso_list_check(structure, 2, 2), "jso_list_check() found an inexistent index! (multiple arguments, inner index overflow)"); + jso_cleanup_list(structure); + + //jso_list_check(): Multiple arguments (recurse) --- doesn't exist, trying to index single entry + json = '["one", 2, ["three", 3], true, 5]'; + structure = jso_decode_list(json); + assert_false(jso_list_check(structure, 1, 0), "jso_list_check() found an inexistent index! (multiple arguments, indexing single entry)"); + jso_cleanup_list(structure); + + //jso_list_check(): Multiple arguments with nested map --- exists + json = '["one", 2, {"three":3}, true, 5]'; + structure = jso_decode_list(json); + assert_true(jso_list_check(structure, 2, "three"), "jso_list_check() failed to find an existing entry! (multiple arguments, nested map)"); + jso_cleanup_list(structure); + + //jso_list_lookup(): Multiple arguments with nested map --- exists + json = '["one", 2, {"three":3}, true, 5]'; + structure = jso_decode_list(json); + expected = 3; + actual = jso_list_lookup(structure, 2, "three"); + assert_equal(expected, actual, "jso_list_lookup() failed to find an existing entry! (multiple arguments, nested map)"); + jso_cleanup_list(structure); + + //jso_list_lookup_type(): Multiple arguments with nested map --- exists + json = '["one", 2, {"three":false}, true, 5]'; + structure = jso_decode_list(json); + expected = jso_type_boolean; + actual = jso_list_lookup_type(structure, 2, "three"); + assert_equal(expected, actual, "jso_list_lookup_type() found the wrong type! (multiple arguments, nested map)"); + jso_cleanup_list(structure); + + //jso_list_exists(): Multiple arguments with nested map --- doesn't exist, key on single entry + json = '["one", 2, {"three":3}, true, 5]'; + structure = jso_decode_list(json); + assert_false(jso_list_check(structure, 1, ""), "jso_list_check() found an inexistent entry! (multiple arguments, nested map, key on single entry)"); + jso_cleanup_list(structure); + + //jso_list_exists(): Multiple arguments with nested map --- doesn't exist, bad key + json = '["one", 2, {"three":3}, true, 5]'; + structure = jso_decode_list(json); + assert_false(jso_list_check(structure, 2, ""), "jso_list_check() found an inexistent entry! (multiple arguments, nested map, bad key)"); + jso_cleanup_list(structure); +} + +#define _test_jso_bugs +{ + /** + _test_jso_bugs(): Test reported bugs. + JSOnion version: 1.0.0d + */ + var expected, actual; + + //jso_encode_map() --- One-element map + //Bug 1: Crash when encoding boolean-valued entries in maps, unknown variable jso_type_integer + var one_map; + one_map = jso_new_map(); + jso_map_add_boolean(one_map, "true", true); + expected = '{"true":true}'; + actual = jso_encode_map(one_map); + assert_equal(expected, actual, "jso_encode_map() failed to encode one-element map with boolean entry!"); + jso_cleanup_map(one_map); +} + diff --git a/samples/Game Maker Language/loadserverplugins.gml b/samples/Game Maker Language/loadserverplugins.gml new file mode 100644 index 00000000..26a26758 --- /dev/null +++ b/samples/Game Maker Language/loadserverplugins.gml @@ -0,0 +1,252 @@ +/* + Originally from /Source/gg2/Scripts/Plugins/loadserverplugins.gml in Gang Garrison 2 + + Copyright (C) 2008-2013 Faucet Software + http://www.ganggarrison.com + + This program is free software; + you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3 of the License, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, + see . + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +// loads plugins from ganggarrison.com asked for by server +// argument0 - comma separated plugin list (pluginname@md5hash) +// returns true on success, false on failure +var list, hashList, text, i, pluginname, pluginhash, realhash, url, handle, filesize, progress, tempfile, tempdir, failed, lastContact, isCached; + +failed = false; +list = ds_list_create(); +lastContact = 0; +isCached = false; +isDebug = false; +hashList = ds_list_create(); + +// split plugin list string +list = split(argument0, ','); + +// Split hashes from plugin names +for (i = 0; i < ds_list_size(list); i += 1) +{ + text = ds_list_find_value(list, i); + pluginname = string_copy(text, 0, string_pos("@", text) - 1); + pluginhash = string_copy(text, string_pos("@", text) + 1, string_length(text) - string_pos("@", text)); + ds_list_replace(list, i, pluginname); + ds_list_add(hashList, pluginhash); +} + +// Check plugin names and check for duplicates +for (i = 0; i < ds_list_size(list); i += 1) +{ + pluginname = ds_list_find_value(list, i); + + // invalid plugin name + if (!checkpluginname(pluginname)) + { + show_message('Error loading server-sent plugins - invalid plugin name:#"' + pluginname + '"'); + return false; + } + // is duplicate + else if (ds_list_find_index(list, pluginname) != i) + { + show_message('Error loading server-sent plugins - duplicate plugin:#"' + pluginname + '"'); + return false; + } +} + +// Download plugins +for (i = 0; i < ds_list_size(list); i += 1) +{ + pluginname = ds_list_find_value(list, i); + pluginhash = ds_list_find_value(hashList, i); + isDebug = file_exists(working_directory + "\ServerPluginsDebug\" + pluginname + ".zip"); + isCached = file_exists(working_directory + "\ServerPluginsCache\" + pluginname + "@" + pluginhash); + tempfile = temp_directory + "\" + pluginname + ".zip.tmp"; + tempdir = temp_directory + "\" + pluginname + ".tmp"; + + // check to see if we have a local copy for debugging + if (isDebug) + { + file_copy(working_directory + "\ServerPluginsDebug\" + pluginname + ".zip", tempfile); + // show warning + if (global.isHost) + { + show_message( + "Warning: server-sent plugin '" + + pluginname + + "' is being loaded from ServerPluginsDebug. Make sure clients have the same version, else they may be unable to connect." + ); + } + else + { + show_message( + "Warning: server-sent plugin '" + + pluginname + + "' is being loaded from ServerPluginsDebug. Make sure the server has the same version, else you may be unable to connect." + ); + } + } + // otherwise, check if we have it cached + else if (isCached) + { + file_copy(working_directory + "\ServerPluginsCache\" + pluginname + "@" + pluginhash, tempfile); + } + // otherwise, download as usual + else + { + // construct the URL + // http://www.ganggarrison.com/plugins/$PLUGINNAME$@$PLUGINHASH$.zip) + url = PLUGIN_SOURCE + pluginname + "@" + pluginhash + ".zip"; + + // let's make the download handle + handle = httpGet(url, -1); + + // download it + while (!httpRequestStatus(handle)) { + // prevent game locking up + io_handle(); + + httpRequestStep(handle); + + if (!global.isHost) { + // send ping if we haven't contacted server in 20 seconds + // we need to do this to keep the connection open + if (current_time-lastContact > 20000) { + write_byte(global.serverSocket, PING); + socket_send(global.serverSocket); + lastContact = current_time; + } + } + + // draw progress bar since they may be waiting a while + filesize = httpRequestResponseBodySize(handle); + progress = httpRequestResponseBodyProgress(handle); + draw_background_ext(background_index[0], 0, 0, background_xscale[0], background_yscale[0], 0, c_white, 1); + draw_set_color(c_white); + draw_set_alpha(1); + draw_set_halign(fa_left); + draw_rectangle(50, 550, 300, 560, 2); + draw_text(50, 530, "Downloading server-sent plugin " + string(i + 1) + "/" + string(ds_list_size(list)) + ' - "' + pluginname + '"'); + if (filesize != -1) + draw_rectangle(50, 550, 50 + progress / filesize * 250, 560, 0); + screen_refresh(); + } + + // errored + if (httpRequestStatus(handle) == 2) + { + show_message('Error loading server-sent plugins - download failed for "' + pluginname + '":#' + httpRequestError(handle)); + failed = true; + break; + } + + // request failed + if (httpRequestStatusCode(handle) != 200) + { + show_message('Error loading server-sent plugins - download failed for "' + pluginname + '":#' + string(httpRequestStatusCode(handle)) + ' ' + httpRequestReasonPhrase(handle)); + failed = true; + break; + } + else + { + write_buffer_to_file(httpRequestResponseBody(handle), tempfile); + if (!file_exists(tempfile)) + { + show_message('Error loading server-sent plugins - download failed for "' + pluginname + '":# No such file?'); + failed = true; + break; + } + } + + httpRequestDestroy(handle); + } + + // check file integrity + realhash = GG2DLL_compute_MD5(tempfile); + if (realhash != pluginhash) + { + show_message('Error loading server-sent plugins - integrity check failed (MD5 hash mismatch) for:#"' + pluginname + '"'); + failed = true; + break; + } + + // don't try to cache debug plugins + if (!isDebug) + { + // add to cache if we don't already have it + if (!file_exists(working_directory + "\ServerPluginsCache\" + pluginname + "@" + pluginhash)) + { + // make sure directory exists + if (!directory_exists(working_directory + "\ServerPluginsCache")) + { + directory_create(working_directory + "\ServerPluginsCache"); + } + // store in cache + file_copy(tempfile, working_directory + "\ServerPluginsCache\" + pluginname + "@" + pluginhash); + } + } + + // let's get 7-zip to extract the files + extractzip(tempfile, tempdir); + + // if the directory doesn't exist, extracting presumably failed + if (!directory_exists(tempdir)) + { + show_message('Error loading server-sent plugins - extracting zip failed for:#"' + pluginname + '"'); + failed = true; + break; + } +} + +if (!failed) +{ + // Execute plugins + for (i = 0; i < ds_list_size(list); i += 1) + { + pluginname = ds_list_find_value(list, i); + tempdir = temp_directory + "\" + pluginname + ".tmp"; + + // Debugging facility, so we know *which* plugin caused compile/execute error + fp = file_text_open_write(working_directory + "\last_plugin.log"); + file_text_write_string(fp, pluginname); + file_text_close(fp); + + // packetID is (i), so make queues for it + ds_map_add(global.pluginPacketBuffers, i, ds_queue_create()); + ds_map_add(global.pluginPacketPlayers, i, ds_queue_create()); + + // Execute plugin + execute_file( + // the plugin's main gml file must be in the root of the zip + // it is called plugin.gml + tempdir + "\plugin.gml", + // the plugin needs to know where it is + // so the temporary directory is passed as first argument + tempdir, + // the plugin needs to know its packetID + // so it is passed as the second argument + i + ); + } +} + +// Delete last plugin log +file_delete(working_directory + "\last_plugin.log"); + +// Get rid of plugin list +ds_list_destroy(list); + +// Get rid of plugin hash list +ds_list_destroy(hashList); + +return !failed; diff --git a/samples/Game Maker Language/processClientCommands.gml b/samples/Game Maker Language/processClientCommands.gml new file mode 100644 index 00000000..6c241d4b --- /dev/null +++ b/samples/Game Maker Language/processClientCommands.gml @@ -0,0 +1,384 @@ +/* + Originally from /Source/gg2/Scripts/GameServer/processClientCommands.gml in Gang Garrison 2 + + Copyright (C) 2008-2013 Faucet Software + http://www.ganggarrison.com + + This program is free software; + you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3 of the License, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, + see . + + Additional permission under GNU GPL version 3 section 7 + If you modify this Program, or any covered work, by linking or combining it with the Game Maker runtime library, + the 39dll library/extension, Hobbel's Download Manager DLL, or modified versions of these libraries, + the licensors of this Program grant you additional permission to convey the resulting work. +*/ + +var player, playerId, commandLimitRemaining; + +player = argument0; +playerId = argument1; + +// To prevent players from flooding the server, limit the number of commands to process per step and player. +commandLimitRemaining = 10; + +with(player) { + if(!variable_local_exists("commandReceiveState")) { + // 0: waiting for command byte. + // 1: waiting for command data length (1 byte) + // 2: waiting for command data. + commandReceiveState = 0; + commandReceiveExpectedBytes = 1; + commandReceiveCommand = 0; + } +} + +while(commandLimitRemaining > 0) { + var socket; + socket = player.socket; + if(!tcp_receive(socket, player.commandReceiveExpectedBytes)) { + return 0; + } + + switch(player.commandReceiveState) + { + case 0: + player.commandReceiveCommand = read_ubyte(socket); + switch(commandBytes[player.commandReceiveCommand]) { + case commandBytesInvalidCommand: + // Invalid byte received. Wait for another command byte. + break; + + case commandBytesPrefixLength1: + player.commandReceiveState = 1; + player.commandReceiveExpectedBytes = 1; + break; + + case commandBytesPrefixLength2: + player.commandReceiveState = 3; + player.commandReceiveExpectedBytes = 2; + break; + + default: + player.commandReceiveState = 2; + player.commandReceiveExpectedBytes = commandBytes[player.commandReceiveCommand]; + break; + } + break; + + case 1: + player.commandReceiveState = 2; + player.commandReceiveExpectedBytes = read_ubyte(socket); + break; + + case 3: + player.commandReceiveState = 2; + player.commandReceiveExpectedBytes = read_ushort(socket); + break; + + case 2: + player.commandReceiveState = 0; + player.commandReceiveExpectedBytes = 1; + commandLimitRemaining -= 1; + + switch(player.commandReceiveCommand) + { + case PLAYER_LEAVE: + socket_destroy(player.socket); + player.socket = -1; + break; + + case PLAYER_CHANGECLASS: + var class; + class = read_ubyte(socket); + if(getCharacterObject(player.team, class) != -1) + { + if(player.object != -1) + { + with(player.object) + { + if (collision_point(x,y,SpawnRoom,0,0) < 0) + { + if (!instance_exists(lastDamageDealer) || lastDamageDealer == player) + { + sendEventPlayerDeath(player, player, noone, BID_FAREWELL); + doEventPlayerDeath(player, player, noone, BID_FAREWELL); + } + else + { + var assistant; + assistant = secondToLastDamageDealer; + if (lastDamageDealer.object) + if (lastDamageDealer.object.healer) + assistant = lastDamageDealer.object.healer; + sendEventPlayerDeath(player, lastDamageDealer, assistant, FINISHED_OFF); + doEventPlayerDeath(player, lastDamageDealer, assistant, FINISHED_OFF); + } + } + else + instance_destroy(); + + } + } + else if(player.alarm[5]<=0) + player.alarm[5] = 1; + class = checkClasslimits(player, player.team, class); + player.class = class; + ServerPlayerChangeclass(playerId, player.class, global.sendBuffer); + } + break; + + case PLAYER_CHANGETEAM: + var newTeam, balance, redSuperiority; + newTeam = read_ubyte(socket); + + redSuperiority = 0 //calculate which team is bigger + with(Player) + { + if(team == TEAM_RED) + redSuperiority += 1; + else if(team == TEAM_BLUE) + redSuperiority -= 1; + } + if(redSuperiority > 0) + balance = TEAM_RED; + else if(redSuperiority < 0) + balance = TEAM_BLUE; + else + balance = -1; + + if(balance != newTeam) + { + if(getCharacterObject(newTeam, player.class) != -1 or newTeam==TEAM_SPECTATOR) + { + if(player.object != -1) + { + with(player.object) + { + if (!instance_exists(lastDamageDealer) || lastDamageDealer == player) + { + sendEventPlayerDeath(player, player, noone, BID_FAREWELL); + doEventPlayerDeath(player, player, noone, BID_FAREWELL); + } + else + { + var assistant; + assistant = secondToLastDamageDealer; + if (lastDamageDealer.object) + if (lastDamageDealer.object.healer) + assistant = lastDamageDealer.object.healer; + sendEventPlayerDeath(player, lastDamageDealer, assistant, FINISHED_OFF); + doEventPlayerDeath(player, lastDamageDealer, assistant, FINISHED_OFF); + } + } + player.alarm[5] = global.Server_Respawntime; + } + else if(player.alarm[5]<=0) + player.alarm[5] = 1; + var newClass; + newClass = checkClasslimits(player, newTeam, player.class); + if newClass != player.class + { + player.class = newClass; + ServerPlayerChangeclass(playerId, player.class, global.sendBuffer); + } + player.team = newTeam; + ServerPlayerChangeteam(playerId, player.team, global.sendBuffer); + ServerBalanceTeams(); + } + } + break; + + case CHAT_BUBBLE: + var bubbleImage; + bubbleImage = read_ubyte(socket); + if(global.aFirst) { + bubbleImage = 0; + } + write_ubyte(global.sendBuffer, CHAT_BUBBLE); + write_ubyte(global.sendBuffer, playerId); + write_ubyte(global.sendBuffer, bubbleImage); + + setChatBubble(player, bubbleImage); + break; + + case BUILD_SENTRY: + if(player.object != -1) + { + if(player.class == CLASS_ENGINEER + and collision_circle(player.object.x, player.object.y, 50, Sentry, false, true) < 0 + and player.object.nutsNBolts == 100 + and (collision_point(player.object.x,player.object.y,SpawnRoom,0,0) < 0) + and !player.sentry + and !player.object.onCabinet) + { + write_ubyte(global.sendBuffer, BUILD_SENTRY); + write_ubyte(global.sendBuffer, playerId); + write_ushort(global.serializeBuffer, round(player.object.x*5)); + write_ushort(global.serializeBuffer, round(player.object.y*5)); + write_byte(global.serializeBuffer, player.object.image_xscale); + buildSentry(player, player.object.x, player.object.y, player.object.image_xscale); + } + } + break; + + case DESTROY_SENTRY: + with(player.sentry) + instance_destroy(); + break; + + case DROP_INTEL: + if (player.object != -1) + { + if (player.object.intel) + { + sendEventDropIntel(player); + doEventDropIntel(player); + } + } + break; + + case OMNOMNOMNOM: + if(player.object != -1) { + if(!player.humiliated + and !player.object.taunting + and !player.object.omnomnomnom + and player.object.canEat + and player.class==CLASS_HEAVY) + { + write_ubyte(global.sendBuffer, OMNOMNOMNOM); + write_ubyte(global.sendBuffer, playerId); + with(player.object) + { + omnomnomnom = true; + if player.team == TEAM_RED { + omnomnomnomindex=0; + omnomnomnomend=31; + } else if player.team==TEAM_BLUE { + omnomnomnomindex=32; + omnomnomnomend=63; + } + xscale=image_xscale; + } + } + } + break; + + case TOGGLE_ZOOM: + if player.object != -1 { + if player.class == CLASS_SNIPER { + write_ubyte(global.sendBuffer, TOGGLE_ZOOM); + write_ubyte(global.sendBuffer, playerId); + toggleZoom(player.object); + } + } + break; + + case PLAYER_CHANGENAME: + var nameLength; + nameLength = socket_receivebuffer_size(socket); + if(nameLength > MAX_PLAYERNAME_LENGTH) + { + write_ubyte(player.socket, KICK); + write_ubyte(player.socket, KICK_NAME); + socket_destroy(player.socket); + player.socket = -1; + } + else + { + with(player) + { + if(variable_local_exists("lastNamechange")) + if(current_time - lastNamechange < 1000) + break; + lastNamechange = current_time; + name = read_string(socket, nameLength); + if(string_count("#",name) > 0) + { + name = "I <3 Bacon"; + } + write_ubyte(global.sendBuffer, PLAYER_CHANGENAME); + write_ubyte(global.sendBuffer, playerId); + write_ubyte(global.sendBuffer, string_length(name)); + write_string(global.sendBuffer, name); + } + } + break; + + case INPUTSTATE: + if(player.object != -1) + { + with(player.object) + { + keyState = read_ubyte(socket); + netAimDirection = read_ushort(socket); + aimDirection = netAimDirection*360/65536; + event_user(1); + } + } + break; + + case REWARD_REQUEST: + player.rewardId = read_string(socket, socket_receivebuffer_size(socket)); + player.challenge = rewardCreateChallenge(); + + write_ubyte(socket, REWARD_CHALLENGE_CODE); + write_binstring(socket, player.challenge); + break; + + case REWARD_CHALLENGE_RESPONSE: + var answer, i, authbuffer; + answer = read_binstring(socket, 16); + + with(player) + if(variable_local_exists("challenge") and variable_local_exists("rewardId")) + rewardAuthStart(player, answer, challenge, true, rewardId); + + break; + + case PLUGIN_PACKET: + var packetID, buf, success; + + packetID = read_ubyte(socket); + + // get packet data + buf = buffer_create(); + write_buffer_part(buf, socket, socket_receivebuffer_size(socket)); + + // try to enqueue + success = _PluginPacketPush(packetID, buf, player); + + // if it returned false, packetID was invalid + if (!success) + { + // clear up buffer + buffer_destroy(buf); + + // kick player + write_ubyte(player.socket, KICK); + write_ubyte(player.socket, KICK_BAD_PLUGIN_PACKET); + socket_destroy(player.socket); + player.socket = -1; + } + break; + + case CLIENT_SETTINGS: + var mirror; + mirror = read_ubyte(player.socket); + player.queueJump = mirror; + + write_ubyte(global.sendBuffer, CLIENT_SETTINGS); + write_ubyte(global.sendBuffer, playerId); + write_ubyte(global.sendBuffer, mirror); + break; + + } + break; + } +} diff --git a/samples/Game Maker Language/scrInitLevel.gml b/samples/Game Maker Language/scrInitLevel.gml new file mode 100644 index 00000000..af0cf274 --- /dev/null +++ b/samples/Game Maker Language/scrInitLevel.gml @@ -0,0 +1,298 @@ +// Originally from /spelunky/Scripts/Level Generation/scrInitLevel.gml in the Spelunky Community Update Project + +// +// scrInitLevel() +// +// Calls scrLevelGen(), scrRoomGen*(), and scrEntityGen() to build level. +// + +/********************************************************************************** + Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC + + This file is part of Spelunky. + + You can redistribute and/or modify Spelunky, including its source code, under + the terms of the Spelunky User License. + + Spelunky is distributed in the hope that it will be entertaining and useful, + but WITHOUT WARRANTY. Please see the Spelunky User License for more details. + + The Spelunky User License should be available in "Game Information", which + can be found in the Resource Explorer, or as an external file called COPYING. + If not, please obtain a new copy of Spelunky from + +***********************************************************************************/ + +global.levelType = 0; +//global.currLevel = 16; +if (global.currLevel > 4 and global.currLevel < 9) global.levelType = 1; +if (global.currLevel > 8 and global.currLevel < 13) global.levelType = 2; +if (global.currLevel > 12 and global.currLevel < 16) global.levelType = 3; +if (global.currLevel == 16) global.levelType = 4; + +if (global.currLevel <= 1 or + global.currLevel == 5 or + global.currLevel == 9 or + global.currLevel == 13) +{ + global.hadDarkLevel = false; +} + +// global.levelType = 3; // debug + +// DEBUG MODE // +/* +if (global.currLevel == 2) global.levelType = 4; +if (global.currLevel == 3) global.levelType = 2; +if (global.currLevel == 4) global.levelType = 3; +if (global.currLevel == 5) global.levelType = 4; +*/ + +// global.levelType = 0; + +global.startRoomX = 0; +global.startRoomY = 0; +global.endRoomX = 0; +global.endRoomY = 0; +oGame.levelGen = false; + +// this is used to determine the path to the exit (generally no bombs required) +for (i = 0; i < 4; i += 1) +{ + for (j = 0; j < 4; j += 1) + { + global.roomPath[i,j] = 0; + } +} + +// side walls +if (global.levelType == 4) + k = 54; +else if (global.levelType == 2) + k = 38; +else if (global.lake) + k = 41; +else + k = 33; +for (i = 0; i <= 42; i += 1) +{ + for (j = 0; j <= k; j += 1) + { + if (not isLevel()) + { + i = 999; + j = 999; + } + else if (global.levelType == 2) + { + if (i*16 == 0 or + i*16 == 656 or + j*16 == 0) + { + obj = instance_create(i*16, j*16, oDark); + obj.invincible = true; + obj.sprite_index = sDark; + } + } + else if (global.levelType == 4) + { + if (i*16 == 0 or + i*16 == 656 or + j*16 == 0) + { + obj = instance_create(i*16, j*16, oTemple); + obj.invincible = true; + if (not global.cityOfGold) obj.sprite_index = sTemple; + } + } + else if (global.lake) + { + if (i*16 == 0 or + i*16 == 656 or + j*16 == 0 or + j*16 >= 656) + { + obj = instance_create(i*16, j*16, oLush); obj.sprite_index = sLush; + obj.invincible = true; + } + } + else if (i*16 == 0 or + i*16 == 656 or + j*16 == 0 or + j*16 >= 528) + { + if (global.levelType == 0) { obj = instance_create(i*16, j*16, oBrick); obj.sprite_index = sBrick; } + else if (global.levelType == 1) { obj = instance_create(i*16, j*16, oLush); obj.sprite_index = sLush; } + else { obj = instance_create(i*16, j*16, oTemple); if (not global.cityOfGold) obj.sprite_index = sTemple; } + obj.invincible = true; + } + } +} + +if (global.levelType == 2) +{ + for (i = 0; i <= 42; i += 1) + { + instance_create(i*16, 40*16, oDark); + //instance_create(i*16, 35*16, oSpikes); + } +} + +if (global.levelType == 3) +{ + background_index = bgTemple; +} + +global.temp1 = global.gameStart; +scrLevelGen(); + +global.cemetary = false; +if (global.levelType == 1 and rand(1,global.probCemetary) == 1) global.cemetary = true; + +with oRoom +{ + if (global.levelType == 0) scrRoomGen(); + else if (global.levelType == 1) + { + if (global.blackMarket) scrRoomGenMarket(); + else scrRoomGen2(); + } + else if (global.levelType == 2) + { + if (global.yetiLair) scrRoomGenYeti(); + else scrRoomGen3(); + } + else if (global.levelType == 3) scrRoomGen4(); + else scrRoomGen5(); +} + +global.darkLevel = false; +//if (not global.hadDarkLevel and global.currLevel != 0 and global.levelType != 2 and global.currLevel != 16 and rand(1,1) == 1) +if (not global.hadDarkLevel and not global.noDarkLevel and global.currLevel != 0 and global.currLevel != 1 and global.levelType != 2 and global.currLevel != 16 and rand(1,global.probDarkLevel) == 1) +{ + global.darkLevel = true; + global.hadDarkLevel = true; + //instance_create(oPlayer1.x, oPlayer1.y, oFlare); +} + +if (global.blackMarket) global.darkLevel = false; + +global.genUdjatEye = false; +if (not global.madeUdjatEye) +{ + if (global.currLevel == 2 and rand(1,3) == 1) global.genUdjatEye = true; + else if (global.currLevel == 3 and rand(1,2) == 1) global.genUdjatEye = true; + else if (global.currLevel == 4) global.genUdjatEye = true; +} + +global.genMarketEntrance = false; +if (not global.madeMarketEntrance) +{ + if (global.currLevel == 5 and rand(1,3) == 1) global.genMarketEntrance = true; + else if (global.currLevel == 6 and rand(1,2) == 1) global.genMarketEntrance = true; + else if (global.currLevel == 7) global.genMarketEntrance = true; +} + +//////////////////////////// +// ENTITY / TREASURES +//////////////////////////// +global.temp2 = global.gameStart; +if (not isRoom("rTutorial") and not isRoom("rLoadLevel")) scrEntityGen(); + +if (instance_exists(oEntrance) and not global.customLevel) +{ + oPlayer1.x = oEntrance.x+8; + oPlayer1.y = oEntrance.y+8; +} + +if (global.darkLevel or + global.blackMarket or + global.snakePit or + global.cemetary or + global.lake or + global.yetiLair or + global.alienCraft or + global.sacrificePit or + global.cityOfGold) +{ + if (not isRoom("rLoadLevel")) + { + with oPlayer1 { alarm[0] = 10; } + } +} + +if (global.levelType == 4) scrSetupWalls(864); +else if (global.lake) scrSetupWalls(656); +else scrSetupWalls(528); + +// add background details +if (global.graphicsHigh) +{ + repeat(20) + { + // bg = instance_create(16*rand(1,42), 16*rand(1,33), oCaveBG); + if (global.levelType == 1 and rand(1,3) < 3) + tile_add(bgExtrasLush, 32*rand(0,1), 0, 32, 32, 16*rand(1,42), 16*rand(1,33), 10002); + else if (global.levelType == 2 and rand(1,3) < 3) + tile_add(bgExtrasIce, 32*rand(0,1), 0, 32, 32, 16*rand(1,42), 16*rand(1,33), 10002); + else if (global.levelType == 3 and rand(1,3) < 3) + tile_add(bgExtrasTemple, 32*rand(0,1), 0, 32, 32, 16*rand(1,42), 16*rand(1,33), 10002); + else + tile_add(bgExtras, 32*rand(0,1), 0, 32, 32, 16*rand(1,42), 16*rand(1,33), 10002); + } +} + +oGame.levelGen = true; + +// generate angry shopkeeper at exit if murderer or thief +if ((global.murderer or global.thiefLevel > 0) and isRealLevel()) +{ + with oExit + { + if (type == "Exit") + { + obj = instance_create(x, y, oShopkeeper); + obj.status = 4; + } + } + // global.thiefLevel -= 1; +} + +with oTreasure +{ + if (collision_point(x, y, oSolid, 0, 0)) + { + obj = instance_place(x, y, oSolid); + if (obj.invincible) instance_destroy(); + } +} + +with oWater +{ + if (sprite_index == sWaterTop or sprite_index == sLavaTop) + { + scrCheckWaterTop(); + } + /* + obj = instance_place(x-16, y, oWater); + if (instance_exists(obj)) + { + if (obj.sprite_index == sWaterTop or obj.sprite_index == sLavaTop) + { + if (type == "Lava") sprite_index = sLavaTop; + else sprite_index = sWaterTop; + } + } + obj = instance_place(x+16, y, oWater); + if (instance_exists(obj)) + { + if (obj.sprite_index == sWaterTop or obj.sprite_index == sLavaTop) + { + if (type == "Lava") sprite_index = sLavaTop; + else sprite_index = sWaterTop; + } + } + */ +} + +global.temp3 = global.gameStart; diff --git a/samples/Gnuplot/dashcolor.1.gnu b/samples/Gnuplot/dashcolor.1.gnu new file mode 100644 index 00000000..291747bd --- /dev/null +++ b/samples/Gnuplot/dashcolor.1.gnu @@ -0,0 +1,22 @@ +# set terminal pngcairo background "#ffffff" fontscale 1.0 dashed size 640, 480 +# set output 'dashcolor.1.png' +set label 1 "set style line 1 lt 2 lc rgb \"red\" lw 3" at -0.4, -0.25, 0 left norotate back textcolor rgb "red" nopoint offset character 0, 0, 0 +set label 2 "set style line 2 lt 2 lc rgb \"orange\" lw 2" at -0.4, -0.35, 0 left norotate back textcolor rgb "orange" nopoint offset character 0, 0, 0 +set label 3 "set style line 3 lt 2 lc rgb \"yellow\" lw 3" at -0.4, -0.45, 0 left norotate back textcolor rgb "yellow" nopoint offset character 0, 0, 0 +set label 4 "set style line 4 lt 2 lc rgb \"green\" lw 2" at -0.4, -0.55, 0 left norotate back textcolor rgb "green" nopoint offset character 0, 0, 0 +set label 5 "plot ... lt 1 lc 3 " at -0.4, -0.65, 0 left norotate back textcolor lt 3 nopoint offset character 0, 0, 0 +set label 6 "plot ... lt 3 lc 3 " at -0.4, -0.75, 0 left norotate back textcolor lt 3 nopoint offset character 0, 0, 0 +set label 7 "plot ... lt 5 lc 3 " at -0.4, -0.85, 0 left norotate back textcolor lt 3 nopoint offset character 0, 0, 0 +set style line 1 linetype 2 linecolor rgb "red" linewidth 3.000 pointtype 2 pointsize default pointinterval 0 +set style line 2 linetype 2 linecolor rgb "orange" linewidth 2.000 pointtype 2 pointsize default pointinterval 0 +set style line 3 linetype 2 linecolor rgb "yellow" linewidth 3.000 pointtype 2 pointsize default pointinterval 0 +set style line 4 linetype 2 linecolor rgb "green" linewidth 2.000 pointtype 2 pointsize default pointinterval 0 +set noxtics +set noytics +set title "Independent colors and dot/dash styles" +set xlabel "You will only see dashed lines if your current terminal setting permits it" +set xrange [ -0.500000 : 3.50000 ] noreverse nowriteback +set yrange [ -1.00000 : 1.40000 ] noreverse nowriteback +set bmargin 7 +unset colorbox +plot cos(x) ls 1 title 'ls 1', cos(x-.2) ls 2 title 'ls 2', cos(x-.4) ls 3 title 'ls 3', cos(x-.6) ls 4 title 'ls 4', cos(x-.8) lt 1 lc 3 title 'lt 1 lc 3', cos(x-1.) lt 3 lc 3 title 'lt 3 lc 3', cos(x-1.2) lt 5 lc 3 title 'lt 5 lc 3' diff --git a/samples/Gnuplot/histograms.2.gnu b/samples/Gnuplot/histograms.2.gnu new file mode 100644 index 00000000..e268ce01 --- /dev/null +++ b/samples/Gnuplot/histograms.2.gnu @@ -0,0 +1,15 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350 +# set output 'histograms.2.png' +set boxwidth 0.9 absolute +set style fill solid 1.00 border lt -1 +set key inside right top vertical Right noreverse noenhanced autotitles nobox +set style histogram clustered gap 1 title offset character 0, 0, 0 +set datafile missing '-' +set style data histograms +set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify +set xtics norangelimit font ",8" +set xtics () +set title "US immigration from Northern Europe\nPlot selected data columns as histogram of clustered boxes" +set yrange [ 0.00000 : 300000. ] noreverse nowriteback +i = 22 +plot 'immigration.dat' using 6:xtic(1) ti col, '' u 12 ti col, '' u 13 ti col, '' u 14 ti col diff --git a/samples/Gnuplot/rates.gp b/samples/Gnuplot/rates.gp new file mode 100644 index 00000000..aad2a52e --- /dev/null +++ b/samples/Gnuplot/rates.gp @@ -0,0 +1,14 @@ +#!/usr/bin/env gnuplot + +reset + +set terminal png +set output 'rates100.png' + +set xlabel "A2A price" +set ylabel "Response Rate" + +#set xr [0:5] +#set yr [0:6] + +plot 'rates100.dat' pt 7 notitle diff --git a/samples/Gnuplot/surface1.16.gnu b/samples/Gnuplot/surface1.16.gnu new file mode 100644 index 00000000..dd1ffefa --- /dev/null +++ b/samples/Gnuplot/surface1.16.gnu @@ -0,0 +1,40 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350 +# set output 'surface1.16.png' +set dummy u,v +set label 1 "increasing v" at 6, 0, -1 left norotate back nopoint offset character 0, 0, 0 +set label 2 "u=0" at 5, 6.5, -1 left norotate back nopoint offset character 0, 0, 0 +set label 3 "u=1" at 5, 6.5, 0.100248 left norotate back nopoint offset character 0, 0, 0 +set arrow 1 from 5, -5, -1.2 to 5, 5, -1.2 head back nofilled linetype -1 linewidth 1.000 +set arrow 2 from 5, 6, -1 to 5, 5, -1 head back nofilled linetype -1 linewidth 1.000 +set arrow 3 from 5, 6, 0.100248 to 5, 5, 0.100248 head back nofilled linetype -1 linewidth 1.000 +set parametric +set view 70, 20, 1, 1 +set samples 51, 51 +set isosamples 2, 33 +set hidden3d back offset 1 trianglepattern 3 undefined 1 altdiagonal bentover +set ztics -1.00000,0.25,1.00000 norangelimit +set title "\"fence plot\" using separate parametric surfaces" +set xlabel "X axis" +set xlabel offset character -3, -2, 0 font "" textcolor lt -1 norotate +set xrange [ -5.00000 : 5.00000 ] noreverse nowriteback +set ylabel "Y axis" +set ylabel offset character 3, -2, 0 font "" textcolor lt -1 rotate by -270 +set yrange [ -5.00000 : 5.00000 ] noreverse nowriteback +set zlabel "Z axis" +set zlabel offset character -5, 0, 0 font "" textcolor lt -1 norotate +set zrange [ -1.00000 : 1.00000 ] noreverse nowriteback +sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2) +GPFUN_sinc = "sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2)" +xx = 6.08888888888889 +dx = 1.10888888888889 +x0 = -5 +x1 = -3.89111111111111 +x2 = -2.78222222222222 +x3 = -1.67333333333333 +x4 = -0.564444444444444 +x5 = 0.544444444444445 +x6 = 1.65333333333333 +x7 = 2.76222222222222 +x8 = 3.87111111111111 +x9 = 4.98 +splot [u=0:1][v=-4.99:4.99] x0, v, (u<0.5) ? -1 : sinc(x0,v) notitle, x1, v, (u<0.5) ? -1 : sinc(x1,v) notitle, x2, v, (u<0.5) ? -1 : sinc(x2,v) notitle, x3, v, (u<0.5) ? -1 : sinc(x3,v) notitle, x4, v, (u<0.5) ? -1 : sinc(x4,v) notitle, x5, v, (u<0.5) ? -1 : sinc(x5,v) notitle, x6, v, (u<0.5) ? -1 : sinc(x6,v) notitle, x7, v, (u<0.5) ? -1 : sinc(x7,v) notitle, x8, v, (u<0.5) ? -1 : sinc(x8,v) notitle, x9, v, (u<0.5) ? -1 : sinc(x9,v) notitle diff --git a/samples/Gnuplot/surface1.17.gnu b/samples/Gnuplot/surface1.17.gnu new file mode 100644 index 00000000..3d272bc7 --- /dev/null +++ b/samples/Gnuplot/surface1.17.gnu @@ -0,0 +1,46 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350 +# set output 'surface1.17.png' +set dummy u,v +set label 1 "increasing v" at 6, 0, -1 left norotate back nopoint offset character 0, 0, 0 +set label 2 "increasing u" at 0, -5, -1.5 left norotate back nopoint offset character 0, 0, 0 +set label 3 "floor(u)%3=0" at 5, 6.5, -1 left norotate back nopoint offset character 0, 0, 0 +set label 4 "floor(u)%3=1" at 5, 6.5, 0.100248 left norotate back nopoint offset character 0, 0, 0 +set arrow 1 from 5, -5, -1.2 to 5, 5, -1.2 head back nofilled linetype -1 linewidth 1.000 +set arrow 2 from -5, -5, -1.2 to 5, -5, -1.2 head back nofilled linetype -1 linewidth 1.000 +set arrow 3 from 5, 6, -1 to 5, 5, -1 head back nofilled linetype -1 linewidth 1.000 +set arrow 4 from 5, 6, 0.100248 to 5, 5, 0.100248 head back nofilled linetype -1 linewidth 1.000 +set parametric +set view 70, 20, 1, 1 +set samples 51, 51 +set isosamples 30, 33 +set hidden3d back offset 1 trianglepattern 3 undefined 1 altdiagonal bentover +set ztics -1.00000,0.25,1.00000 norangelimit +set title "\"fence plot\" using single parametric surface with undefined points" +set xlabel "X axis" +set xlabel offset character -3, -2, 0 font "" textcolor lt -1 norotate +set xrange [ -5.00000 : 5.00000 ] noreverse nowriteback +set ylabel "Y axis" +set ylabel offset character 3, -2, 0 font "" textcolor lt -1 rotate by -270 +set yrange [ -5.00000 : 5.00000 ] noreverse nowriteback +set zlabel "Z axis" +set zlabel offset character -5, 0, 0 font "" textcolor lt -1 norotate +set zrange [ -1.00000 : 1.00000 ] noreverse nowriteback +sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2) +GPFUN_sinc = "sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2)" +xx = 6.08888888888889 +dx = 1.11 +x0 = -5 +x1 = -3.89111111111111 +x2 = -2.78222222222222 +x3 = -1.67333333333333 +x4 = -0.564444444444444 +x5 = 0.544444444444445 +x6 = 1.65333333333333 +x7 = 2.76222222222222 +x8 = 3.87111111111111 +x9 = 4.98 +xmin = -4.99 +xmax = 5 +n = 10 +zbase = -1 +splot [u=.5:3*n-.5][v=-4.99:4.99] xmin+floor(u/3)*dx, v, ((floor(u)%3)==0) ? zbase : (((floor(u)%3)==1) ? sinc(xmin+u/3.*dx,v) : 1/0) notitle diff --git a/samples/Gnuplot/world2.1.gnu b/samples/Gnuplot/world2.1.gnu new file mode 100644 index 00000000..53dc22b6 --- /dev/null +++ b/samples/Gnuplot/world2.1.gnu @@ -0,0 +1,21 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350 +# set output 'world2.1.png' +unset border +set dummy u,v +set angles degrees +set parametric +set view 60, 136, 1.22, 1.26 +set samples 64, 64 +set isosamples 13, 13 +set mapping spherical +set noxtics +set noytics +set noztics +set title "Labels colored by GeV plotted in spherical coordinate system" +set urange [ -90.0000 : 90.0000 ] noreverse nowriteback +set vrange [ 0.00000 : 360.000 ] noreverse nowriteback +set cblabel "GeV" +set cbrange [ 0.00000 : 8.00000 ] noreverse nowriteback +set colorbox user +set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.02, 0.75, 0 front bdefault +splot cos(u)*cos(v),cos(u)*sin(v),sin(u) notitle with lines lt 5, 'world.dat' notitle with lines lt 2, 'srl.dat' using 3:2:(1):1:4 with labels notitle point pt 6 lw .1 left offset 1,0 font "Helvetica,7" tc pal diff --git a/samples/Grammatical Framework/Foods.gf b/samples/Grammatical Framework/Foods.gf new file mode 100644 index 00000000..8ea02f39 --- /dev/null +++ b/samples/Grammatical Framework/Foods.gf @@ -0,0 +1,15 @@ +-- (c) 2009 Aarne Ranta under LGPL + +abstract Foods = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That, These, Those : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Wine, Cheese, Fish, Pizza : Kind ; + Very : Quality -> Quality ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/samples/Grammatical Framework/FoodsAfr.gf b/samples/Grammatical Framework/FoodsAfr.gf new file mode 100644 index 00000000..d0226710 --- /dev/null +++ b/samples/Grammatical Framework/FoodsAfr.gf @@ -0,0 +1,79 @@ +-- (c) 2009 Laurette Pretorius Sr & Jr and Ansu Berg under LGPL + +concrete FoodsAfr of Foods = open Prelude, Predef in{ + + flags coding=utf8; + + lincat + Comment = {s: Str} ; + Kind = {s: Number => Str} ; + Item = {s: Str ; n: Number} ; + Quality = {s: AdjAP => Str} ; + + lin + Pred item quality = {s = item.s ++ "is" ++ (quality.s ! Predic)}; + This kind = {s = "hierdie" ++ (kind.s ! Sg); n = Sg}; + That kind = {s = "daardie" ++ (kind.s ! Sg); n = Sg}; + These kind = {s = "hierdie" ++ (kind.s ! Pl); n = Pl}; + Those kind = {s = "daardie" ++ (kind.s ! Pl); n = Pl}; + Mod quality kind = {s = table{n => (quality.s ! Attr) ++ (kind.s!n)}}; + + Wine = declNoun_e "wyn"; + Cheese = declNoun_aa "kaas"; + Fish = declNoun_ss "vis"; + Pizza = declNoun_s "pizza"; + + Very quality = veryAdj quality; + + Fresh = regAdj "vars"; + Warm = regAdj "warm"; + Italian = smartAdj_e "Italiaans"; + Expensive = regAdj "duur"; + Delicious = smartAdj_e "heerlik"; + Boring = smartAdj_e "vervelig"; + + param + AdjAP = Attr | Predic ; + Number = Sg | Pl ; + + oper + --Noun operations (wyn, kaas, vis, pizza) + + declNoun_aa: Str -> {s: Number => Str} = \x -> + let v = tk 2 x + in + {s = table{Sg => x ; Pl => v + (last x) +"e"}}; + + declNoun_e: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + "e"}} ; + declNoun_s: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + "s"}} ; + + declNoun_ss: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + (last x) + "e"}} ; + + + --Adjective operations + + mkAdj : Str -> Str -> {s: AdjAP => Str} = \x,y -> {s = table{Attr => x; Predic => y}}; + + declAdj_e : Str -> {s : AdjAP=> Str} = \x -> mkAdj (x + "e") x; + declAdj_g : Str -> {s : AdjAP=> Str} = \w -> + let v = init w + in mkAdj (v + "ë") w ; + + declAdj_oog : Str -> {s : AdjAP=> Str} = \w -> + let v = init w + in + let i = init v + in mkAdj (i + "ë") w ; + + regAdj : Str -> {s : AdjAP=> Str} = \x -> mkAdj x x; + + veryAdj : {s: AdjAP => Str} -> {s : AdjAP=> Str} = \x -> {s = table{a => "baie" ++ (x.s!a)}}; + + + smartAdj_e : Str -> {s : AdjAP=> Str} = \a -> case a of + { + _ + "oog" => declAdj_oog a ; + _ + ("e" | "ie" | "o" | "oe") + "g" => declAdj_g a ; + _ => declAdj_e a + }; +} diff --git a/samples/Grammatical Framework/FoodsAmh.gf b/samples/Grammatical Framework/FoodsAmh.gf new file mode 100644 index 00000000..e8915d86 --- /dev/null +++ b/samples/Grammatical Framework/FoodsAmh.gf @@ -0,0 +1,21 @@ +concrete FoodsAmh of Foods ={ + flags coding = utf8; + lincat + Comment,Item,Kind,Quality = Str; + lin + Pred item quality = item ++ quality++ "ነው::" ; + This kind = "ይህ" ++ kind; + That kind = "ያ" ++ kind; + Mod quality kind = quality ++ kind; + Wine = "ወይን"; + Cheese = "አይብ"; + Fish = "ዓሳ"; + Very quality = "በጣም" ++ quality; + Fresh = "አዲስ"; + Warm = "ትኩስ"; + Italian = "የጥልያን"; + Expensive = "ውድ"; + Delicious = "ጣፋጭ"; + Boring = "አስቀያሚ"; + +} \ No newline at end of file diff --git a/samples/Grammatical Framework/FoodsBul.gf b/samples/Grammatical Framework/FoodsBul.gf new file mode 100644 index 00000000..ac912766 --- /dev/null +++ b/samples/Grammatical Framework/FoodsBul.gf @@ -0,0 +1,43 @@ +-- (c) 2009 Krasimir Angelov under LGPL + +concrete FoodsBul of Foods = { + + flags + coding = utf8; + + param + Gender = Masc | Fem | Neutr; + Number = Sg | Pl; + Agr = ASg Gender | APl ; + + lincat + Comment = Str ; + Quality = {s : Agr => Str} ; + Item = {s : Str; a : Agr} ; + Kind = {s : Number => Str; g : Gender} ; + + lin + Pred item qual = item.s ++ case item.a of {ASg _ => "е"; APl => "са"} ++ qual.s ! item.a ; + + This kind = {s=case kind.g of {Masc=>"този"; Fem=>"тази"; Neutr=>"това" } ++ kind.s ! Sg; a=ASg kind.g} ; + That kind = {s=case kind.g of {Masc=>"онзи"; Fem=>"онази"; Neutr=>"онова"} ++ kind.s ! Sg; a=ASg kind.g} ; + These kind = {s="тези" ++ kind.s ! Pl; a=APl} ; + Those kind = {s="онези" ++ kind.s ! Pl; a=APl} ; + + Mod qual kind = {s=\\n => qual.s ! (case n of {Sg => ASg kind.g; Pl => APl}) ++ kind.s ! n; g=kind.g} ; + + Wine = {s = table {Sg => "вино"; Pl => "вина"}; g = Neutr}; + Cheese = {s = table {Sg => "сирене"; Pl => "сирена"}; g = Neutr}; + Fish = {s = table {Sg => "риба"; Pl => "риби"}; g = Fem}; + Pizza = {s = table {Sg => "пица"; Pl => "пици"}; g = Fem}; + + Very qual = {s = \\g => "много" ++ qual.s ! g}; + + Fresh = {s = table {ASg Masc => "свеж"; ASg Fem => "свежа"; ASg Neutr => "свежо"; APl => "свежи"}}; + Warm = {s = table {ASg Masc => "горещ"; ASg Fem => "гореща"; ASg Neutr => "горещо"; APl => "горещи"}}; + Italian = {s = table {ASg Masc => "италиански"; ASg Fem => "италианска"; ASg Neutr => "италианско"; APl => "италиански"}}; + Expensive = {s = table {ASg Masc => "скъп"; ASg Fem => "скъпа"; ASg Neutr => "скъпо"; APl => "скъпи"}}; + Delicious = {s = table {ASg Masc => "превъзходен"; ASg Fem => "превъзходна"; ASg Neutr => "превъзходно"; APl => "превъзходни"}}; + Boring = {s = table {ASg Masc => "еднообразен"; ASg Fem => "еднообразна"; ASg Neutr => "еднообразно"; APl => "еднообразни"}}; + +} diff --git a/samples/Grammatical Framework/FoodsCat.gf b/samples/Grammatical Framework/FoodsCat.gf new file mode 100644 index 00000000..5ad38d0d --- /dev/null +++ b/samples/Grammatical Framework/FoodsCat.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Jordi Saludes under LGPL + +concrete FoodsCat of Foods = FoodsI with + (Syntax = SyntaxCat), + (LexFoods = LexFoodsCat) ; diff --git a/samples/Grammatical Framework/FoodsChi.gf b/samples/Grammatical Framework/FoodsChi.gf new file mode 100644 index 00000000..163aa0eb --- /dev/null +++ b/samples/Grammatical Framework/FoodsChi.gf @@ -0,0 +1,35 @@ +concrete FoodsChi of Foods = { +flags coding = utf8 ; +lincat + Comment, Item = Str ; + Kind = {s,c : Str} ; + Quality = {s,p : Str} ; +lin + Pred item quality = item ++ "是" ++ quality.s ++ quality.p ; + This kind = "这" ++ kind.c ++ kind.s ; + That kind = "那" ++ kind.c ++ kind.s ; + These kind = "这" ++ "些" ++ kind.s ; + Those kind = "那" ++ "些" ++ kind.s ; + Mod quality kind = { + s = quality.s ++ quality.p ++ kind.s ; + c = kind.c + } ; + Wine = geKind "酒" ; + Pizza = geKind "比 萨 饼" ; + Cheese = geKind "奶 酪" ; + Fish = geKind "鱼" ; + Very quality = longQuality ("非 常" ++ quality.s) ; + Fresh = longQuality "新 鲜" ; + Warm = longQuality "温 热" ; + Italian = longQuality "意 大 利 式" ; + Expensive = longQuality "昂 贵" ; + Delicious = longQuality "美 味" ; + Boring = longQuality "难 吃" ; +oper + mkKind : Str -> Str -> {s,c : Str} = \s,c -> + {s = s ; c = c} ; + geKind : Str -> {s,c : Str} = \s -> + mkKind s "个" ; + longQuality : Str -> {s,p : Str} = \s -> + {s = s ; p = "的"} ; +} diff --git a/samples/Grammatical Framework/FoodsCze.gf b/samples/Grammatical Framework/FoodsCze.gf new file mode 100644 index 00000000..3fec6814 --- /dev/null +++ b/samples/Grammatical Framework/FoodsCze.gf @@ -0,0 +1,35 @@ +-- (c) 2011 Katerina Bohmova under LGPL + +concrete FoodsCze of Foods = open ResCze in { + flags + coding = utf8 ; + lincat + Comment = {s : Str} ; + Quality = Adjective ; + Kind = Noun ; + Item = NounPhrase ; + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ + quality.s ! item.g ! item.n} ; + This = det Sg "tento" "tato" "toto" ; + That = det Sg "tamten" "tamta" "tamto" ; + These = det Pl "tyto" "tyto" "tato" ; + Those = det Pl "tamty" "tamty" "tamta" ; + Mod quality kind = { + s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ; + g = kind.g + } ; + Wine = noun "víno" "vína" Neutr ; + Cheese = noun "sýr" "sýry" Masc ; + Fish = noun "ryba" "ryby" Fem ; + Pizza = noun "pizza" "pizzy" Fem ; + Very qual = {s = \\g,n => "velmi" ++ qual.s ! g ! n} ; + Fresh = regAdj "čerstv" ; + Warm = regAdj "tepl" ; + Italian = regAdj "italsk" ; + Expensive = regAdj "drah" ; + Delicious = regnfAdj "vynikající" ; + Boring = regAdj "nudn" ; +} + diff --git a/samples/Grammatical Framework/FoodsDut.gf b/samples/Grammatical Framework/FoodsDut.gf new file mode 100644 index 00000000..d4855e5c --- /dev/null +++ b/samples/Grammatical Framework/FoodsDut.gf @@ -0,0 +1,58 @@ +-- (c) 2009 Femke Johansson under LGPL + +concrete FoodsDut of Foods = { + + lincat + Comment = {s : Str}; + Quality = {s : AForm => Str}; + Kind = { s : Number => Str}; + Item = {s : Str ; n : Number}; + + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ quality.s ! APred}; + This = det Sg "deze"; + These = det Pl "deze"; + That = det Sg "die"; + Those = det Pl "die"; + + Mod quality kind = + {s = \\n => quality.s ! AAttr ++ kind.s ! n}; + Wine = regNoun "wijn"; + Cheese = noun "kaas" "kazen"; + Fish = noun "vis" "vissen"; + Pizza = noun "pizza" "pizza's"; + + Very a = {s = \\f => "erg" ++ a.s ! f}; + + Fresh = regadj "vers"; + Warm = regadj "warm"; + Italian = regadj "Italiaans"; + Expensive = adj "duur" "dure"; + Delicious = regadj "lekker"; + Boring = regadj "saai"; + + param + Number = Sg | Pl; + AForm = APred | AAttr; + + oper + det : Number -> Str -> + {s : Number => Str} -> {s : Str ; n: Number} = + \n,det,noun -> {s = det ++ noun.s ! n ; n=n}; + + noun : Str -> Str -> {s : Number => Str} = + \man,men -> {s = table {Sg => man; Pl => men}}; + + regNoun : Str -> {s : Number => Str} = + \wijn -> noun wijn (wijn + "en"); + + regadj : Str -> {s : AForm => Str} = + \koud -> adj koud (koud+"e"); + + adj : Str -> Str -> {s : AForm => Str} = + \duur, dure -> {s = table {APred => duur; AAttr => dure}}; + + copula : Number => Str = + table {Sg => "is" ; Pl => "zijn"}; +} diff --git a/samples/Grammatical Framework/FoodsEng.gf b/samples/Grammatical Framework/FoodsEng.gf new file mode 100644 index 00000000..e7359a4f --- /dev/null +++ b/samples/Grammatical Framework/FoodsEng.gf @@ -0,0 +1,43 @@ +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsEng of Foods = { + flags language = en_US; + lincat + Comment, Quality = {s : Str} ; + Kind = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ quality.s} ; + This = det Sg "this" ; + That = det Sg "that" ; + These = det Pl "these" ; + Those = det Pl "those" ; + Mod quality kind = + {s = \\n => quality.s ++ kind.s ! n} ; + Wine = regNoun "wine" ; + Cheese = regNoun "cheese" ; + Fish = noun "fish" "fish" ; + Pizza = regNoun "pizza" ; + Very a = {s = "very" ++ a.s} ; + Fresh = adj "fresh" ; + Warm = adj "warm" ; + Italian = adj "Italian" ; + Expensive = adj "expensive" ; + Delicious = adj "delicious" ; + Boring = adj "boring" ; + param + Number = Sg | Pl ; + oper + det : Number -> Str -> + {s : Number => Str} -> {s : Str ; n : Number} = + \n,det,noun -> {s = det ++ noun.s ! n ; n = n} ; + noun : Str -> Str -> {s : Number => Str} = + \man,men -> {s = table {Sg => man ; Pl => men}} ; + regNoun : Str -> {s : Number => Str} = + \car -> noun car (car + "s") ; + adj : Str -> {s : Str} = + \cold -> {s = cold} ; + copula : Number => Str = + table {Sg => "is" ; Pl => "are"} ; +} diff --git a/samples/Grammatical Framework/FoodsEpo.gf b/samples/Grammatical Framework/FoodsEpo.gf new file mode 100644 index 00000000..dd2400fe --- /dev/null +++ b/samples/Grammatical Framework/FoodsEpo.gf @@ -0,0 +1,48 @@ +-- (c) 2009 Julia Hammar under LGPL + +concrete FoodsEpo of Foods = open Prelude in { + + flags coding =utf8 ; + + lincat + Comment = SS ; + Kind, Quality = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + + lin + Pred item quality = ss (item.s ++ copula ! item.n ++ quality.s ! item.n) ; + This = det Sg "ĉi tiu" ; + That = det Sg "tiu" ; + These = det Pl "ĉi tiuj" ; + Those = det Pl "tiuj" ; + Mod quality kind = {s = \\n => quality.s ! n ++ kind.s ! n} ; + Wine = regNoun "vino" ; + Cheese = regNoun "fromaĝo" ; + Fish = regNoun "fiŝo" ; + Pizza = regNoun "pico" ; + Very quality = {s = \\n => "tre" ++ quality.s ! n} ; + Fresh = regAdj "freŝa" ; + Warm = regAdj "varma" ; + Italian = regAdj "itala" ; + Expensive = regAdj "altekosta" ; + Delicious = regAdj "bongusta" ; + Boring = regAdj "enuiga" ; + + param + Number = Sg | Pl ; + + oper + det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} = + \n,d,cn -> { + s = d ++ cn.s ! n ; + n = n + } ; + regNoun : Str -> {s : Number => Str} = + \vino -> {s = table {Sg => vino ; Pl => vino + "j"} + } ; + regAdj : Str -> {s : Number => Str} = + \nova -> {s = table {Sg => nova ; Pl => nova + "j"} + } ; + copula : Number => Str = \\_ => "estas" ; +} + diff --git a/samples/Grammatical Framework/FoodsFin.gf b/samples/Grammatical Framework/FoodsFin.gf new file mode 100644 index 00000000..34da5764 --- /dev/null +++ b/samples/Grammatical Framework/FoodsFin.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsFin of Foods = FoodsI with + (Syntax = SyntaxFin), + (LexFoods = LexFoodsFin) ; diff --git a/samples/Grammatical Framework/FoodsFre.gf b/samples/Grammatical Framework/FoodsFre.gf new file mode 100644 index 00000000..ac6c8c63 --- /dev/null +++ b/samples/Grammatical Framework/FoodsFre.gf @@ -0,0 +1,32 @@ +--# -path=.:../foods:present + +concrete FoodsFre of Foods = open SyntaxFre, ParadigmsFre in { + + flags coding = utf8 ; + + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_QuantSg kind ; + That kind = mkNP that_QuantSg kind ; + These kind = mkNP these_QuantPl kind ; + Those kind = mkNP those_QuantPl kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; + + Wine = mkCN (mkN "vin" masculine) ; + Pizza = mkCN (mkN "pizza" feminine) ; + Cheese = mkCN (mkN "fromage" masculine) ; + Fish = mkCN (mkN "poisson" masculine) ; + Fresh = mkAP (mkA "frais" "fraîche" "frais" "fraîchement") ; + Warm = mkAP (mkA "chaud") ; + Italian = mkAP (mkA "italien") ; + Expensive = mkAP (mkA "cher") ; + Delicious = mkAP (mkA "délicieux") ; + Boring = mkAP (mkA "ennuyeux") ; + } \ No newline at end of file diff --git a/samples/Grammatical Framework/FoodsGer.gf b/samples/Grammatical Framework/FoodsGer.gf new file mode 100644 index 00000000..934cefb9 --- /dev/null +++ b/samples/Grammatical Framework/FoodsGer.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsGer of Foods = FoodsI with + (Syntax = SyntaxGer), + (LexFoods = LexFoodsGer) ; diff --git a/samples/Grammatical Framework/FoodsHeb.gf b/samples/Grammatical Framework/FoodsHeb.gf new file mode 100644 index 00000000..3d76b639 --- /dev/null +++ b/samples/Grammatical Framework/FoodsHeb.gf @@ -0,0 +1,108 @@ +--# -path=alltenses + +--(c) 2009 Dana Dannells +-- Licensed under LGPL + +concrete FoodsHeb of Foods = open Prelude in { + + flags coding=utf8 ; + + lincat + Comment = SS ; + Quality = {s: Number => Species => Gender => Str} ; + Kind = {s : Number => Species => Str ; g : Gender ; mod : Modified} ; + Item = {s : Str ; g : Gender ; n : Number ; sp : Species ; mod : Modified} ; + + + lin + Pred item quality = ss (item.s ++ quality.s ! item.n ! Indef ! item.g ) ; + This = det Sg Def "הזה" "הזאת"; + That = det Sg Def "ההוא" "ההיא" ; + These = det Pl Def "האלה" "האלה" ; + Those = det Pl Def "ההם" "ההן" ; + Mod quality kind = { + s = \\n,sp => kind.s ! n ! sp ++ quality.s ! n ! sp ! kind.g; + g = kind.g ; + mod = T + } ; + Wine = regNoun "יין" "יינות" Masc ; + Cheese = regNoun "גבינה" "גבינות" Fem ; + Fish = regNoun "דג" "דגים" Masc ; + Pizza = regNoun "פיצה" "פיצות" Fem ; + Very qual = {s = \\g,n,sp => "מאוד" ++ qual.s ! g ! n ! sp} ; + Fresh = regAdj "טרי" ; + Warm = regAdj "חם" ; + Italian = regAdj2 "איטלקי" ; + Expensive = regAdj "יקר" ; + Delicious = regAdj "טעים" ; + Boring = regAdj2 "משעמם"; + + param + Number = Sg | Pl ; + Gender = Masc | Fem ; + Species = Def | Indef ; + Modified = T | F ; + + oper + Noun : Type = {s : Number => Species => Str ; g : Gender ; mod : Modified } ; + Adj : Type = {s : Number => Species => Gender => Str} ; + + det : Number -> Species -> Str -> Str -> Noun -> + {s : Str ; g :Gender ; n : Number ; sp : Species ; mod : Modified} = + \n,sp,m,f,cn -> { + s = case cn.mod of { _ => cn.s ! n ! sp ++ case cn.g of {Masc => m ; Fem => f} }; + g = cn.g ; + n = n ; + sp = sp ; + mod = cn.mod + } ; + + noun : (gvina,hagvina,gvinot,hagvinot : Str) -> Gender -> Noun = + \gvina,hagvina,gvinot,hagvinot,g -> { + s = table { + Sg => table { + Indef => gvina ; + Def => hagvina + } ; + Pl => table { + Indef => gvinot ; + Def => hagvinot + } + } ; + g = g ; + mod = F + } ; + + regNoun : Str -> Str -> Gender -> Noun = + \gvina,gvinot, g -> + noun gvina (defH gvina) gvinot (defH gvinot) g ; + + defH : Str -> Str = \cn -> + case cn of {_ => "ה" + cn}; + + replaceLastLetter : Str -> Str = \c -> + case c of {"ף" => "פ" ; "ם" => "מ" ; "ן" => "נ" ; "ץ" => "צ" ; "ך" => "כ"; _ => c} ; + + adjective : (_,_,_,_ : Str) -> Adj = + \tov,tova,tovim,tovot -> { + s = table { + Sg => table { + Indef => table { Masc => tov ; Fem => tova } ; + Def => table { Masc => defH tov ; Fem => defH tova } + } ; + Pl => table { + Indef => table {Masc => tovim ; Fem => tovot } ; + Def => table { Masc => defH tovim ; Fem => defH tovot } + } + } + } ; + + regAdj : Str -> Adj = \tov -> + case tov of { to + c@? => + adjective tov (to + replaceLastLetter (c) + "ה" ) (to + replaceLastLetter (c) +"ים" ) (to + replaceLastLetter (c) + "ות" )}; + + regAdj2 : Str -> Adj = \italki -> + case italki of { italk+ c@? => + adjective italki (italk + replaceLastLetter (c) +"ת" ) (italk + replaceLastLetter (c)+ "ים" ) (italk + replaceLastLetter (c) + "ות" )}; + +} -- FoodsHeb diff --git a/samples/Grammatical Framework/FoodsHin.gf b/samples/Grammatical Framework/FoodsHin.gf new file mode 100644 index 00000000..67c29df8 --- /dev/null +++ b/samples/Grammatical Framework/FoodsHin.gf @@ -0,0 +1,75 @@ +-- (c) 2010 Vikash Rauniyar under LGPL + +concrete FoodsHin of Foods = { + + flags coding=utf8 ; + + param + Gender = Masc | Fem ; + Number = Sg | Pl ; + lincat + Comment = {s : Str} ; + Item = {s : Str ; g : Gender ; n : Number} ; + Kind = {s : Number => Str ; g : Gender} ; + Quality = {s : Gender => Number => Str} ; + lin + Pred item quality = { + s = item.s ++ quality.s ! item.g ! item.n ++ copula item.n + } ; + This kind = {s = "यह" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ; + That kind = {s = "वह" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ; + These kind = {s = "ये" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ; + Those kind = {s = "वे" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ; + Mod quality kind = { + s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ; + g = kind.g + } ; + Wine = regN "मदिरा" ; + Cheese = regN "पनीर" ; + Fish = regN "मछली" ; + Pizza = regN "पिज़्ज़ा" ; + Very quality = {s = \\g,n => "अति" ++ quality.s ! g ! n} ; + Fresh = regAdj "ताज़ा" ; + Warm = regAdj "गरम" ; + Italian = regAdj "इटली" ; + Expensive = regAdj "बहुमूल्य" ; + Delicious = regAdj "स्वादिष्ट" ; + Boring = regAdj "अरुचिकर" ; + + oper + mkN : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = + \s,p,g -> { + s = table { + Sg => s ; + Pl => p + } ; + g = g + } ; + + regN : Str -> {s : Number => Str ; g : Gender} = \s -> case s of { + lark + "ा" => mkN s (lark + "े") Masc ; + lark + "ी" => mkN s (lark + "ीयँा") Fem ; + _ => mkN s s Masc + } ; + + mkAdj : Str -> Str -> Str -> {s : Gender => Number => Str} = \ms,mp,f -> { + s = table { + Masc => table { + Sg => ms ; + Pl => mp + } ; + Fem => \\_ => f + } + } ; + + regAdj : Str -> {s : Gender => Number => Str} = \a -> case a of { + acch + "ा" => mkAdj a (acch + "े") (acch + "ी") ; + _ => mkAdj a a a + } ; + + copula : Number -> Str = \n -> case n of { + Sg => "है" ; + Pl => "हैं" + } ; + + } diff --git a/samples/Grammatical Framework/FoodsI.gf b/samples/Grammatical Framework/FoodsI.gf new file mode 100644 index 00000000..f4113b72 --- /dev/null +++ b/samples/Grammatical Framework/FoodsI.gf @@ -0,0 +1,29 @@ +-- (c) 2009 Aarne Ranta under LGPL + +incomplete concrete FoodsI of Foods = + open Syntax, LexFoods in { + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_Det kind ; + That kind = mkNP that_Det kind ; + These kind = mkNP these_Det kind ; + Those kind = mkNP those_Det kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; + + Wine = mkCN wine_N ; + Pizza = mkCN pizza_N ; + Cheese = mkCN cheese_N ; + Fish = mkCN fish_N ; + Fresh = mkAP fresh_A ; + Warm = mkAP warm_A ; + Italian = mkAP italian_A ; + Expensive = mkAP expensive_A ; + Delicious = mkAP delicious_A ; + Boring = mkAP boring_A ; +} diff --git a/samples/Grammatical Framework/FoodsIce.gf b/samples/Grammatical Framework/FoodsIce.gf new file mode 100644 index 00000000..ab1297c7 --- /dev/null +++ b/samples/Grammatical Framework/FoodsIce.gf @@ -0,0 +1,84 @@ +--# -path=.:prelude + +-- (c) 2009 Martha Dis Brandt under LGPL + +concrete FoodsIce of Foods = open Prelude in { + + flags coding=utf8; + + lincat + Comment = SS ; + Quality = {s : Gender => Number => Defin => Str} ; + Kind = {s : Number => Str ; g : Gender} ; + Item = {s : Str ; g : Gender ; n : Number} ; + + lin + Pred item quality = ss (item.s ++ copula item.n ++ quality.s ! item.g ! item.n ! Ind) ; + This, That = det Sg "þessi" "þessi" "þetta" ; + These, Those = det Pl "þessir" "þessar" "þessi" ; + Mod quality kind = { s = \\n => quality.s ! kind.g ! n ! Def ++ kind.s ! n ; g = kind.g } ; + Wine = noun "vín" "vín" Neutr ; + Cheese = noun "ostur" "ostar" Masc ; + Fish = noun "fiskur" "fiskar" Masc ; + -- the word "pizza" is more commonly used in Iceland, but "flatbaka" is the Icelandic word for it + Pizza = noun "flatbaka" "flatbökur" Fem ; + Very qual = {s = \\g,n,defOrInd => "mjög" ++ qual.s ! g ! n ! defOrInd } ; + Fresh = regAdj "ferskur" ; + Warm = regAdj "heitur" ; + Boring = regAdj "leiðinlegur" ; + -- the order of the given adj forms is: mSg fSg nSg mPl fPl nPl mSgDef f/nSgDef _PlDef + Italian = adjective "ítalskur" "ítölsk" "ítalskt" "ítalskir" "ítalskar" "ítölsk" "ítalski" "ítalska" "ítalsku" ; + Expensive = adjective "dýr" "dýr" "dýrt" "dýrir" "dýrar" "dýr" "dýri" "dýra" "dýru" ; + Delicious = adjective "ljúffengur" "ljúffeng" "ljúffengt" "ljúffengir" "ljúffengar" "ljúffeng" "ljúffengi" "ljúffenga" "ljúffengu" ; + + param + Number = Sg | Pl ; + Gender = Masc | Fem | Neutr ; + Defin = Ind | Def ; + + oper + det : Number -> Str -> Str -> Str -> {s : Number => Str ; g : Gender} -> + {s : Str ; g : Gender ; n : Number} = + \n,masc,fem,neutr,cn -> { + s = case cn.g of {Masc => masc ; Fem => fem; Neutr => neutr } ++ cn.s ! n ; + g = cn.g ; + n = n + } ; + + noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = + \man,men,g -> { + s = table { + Sg => man ; + Pl => men + } ; + g = g + } ; + + adjective : (x1,_,_,_,_,_,_,_,x9 : Str) -> {s : Gender => Number => Defin => Str} = + \ferskur,fersk,ferskt,ferskir,ferskar,fersk_pl,ferski,ferska,fersku -> { + s = \\g,n,t => case of { + < Masc, Sg, Ind > => ferskur ; + < Masc, Pl, Ind > => ferskir ; + < Fem, Sg, Ind > => fersk ; + < Fem, Pl, Ind > => ferskar ; + < Neutr, Sg, Ind > => ferskt ; + < Neutr, Pl, Ind > => fersk_pl; + < Masc, Sg, Def > => ferski ; + < Fem, Sg, Def > | < Neutr, Sg, Def > => ferska ; + < _ , Pl, Def > => fersku + } + } ; + + regAdj : Str -> {s : Gender => Number => Defin => Str} = \ferskur -> + let fersk = Predef.tk 2 ferskur + in adjective + ferskur fersk (fersk + "t") + (fersk + "ir") (fersk + "ar") fersk + (fersk + "i") (fersk + "a") (fersk + "u") ; + + copula : Number -> Str = + \n -> case n of { + Sg => "er" ; + Pl => "eru" + } ; +} diff --git a/samples/Grammatical Framework/FoodsIta.gf b/samples/Grammatical Framework/FoodsIta.gf new file mode 100644 index 00000000..51baf9d7 --- /dev/null +++ b/samples/Grammatical Framework/FoodsIta.gf @@ -0,0 +1,8 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsIta of Foods = FoodsI with + (Syntax = SyntaxIta), + (LexFoods = LexFoodsIta) ; + diff --git a/samples/Grammatical Framework/FoodsJpn.gf b/samples/Grammatical Framework/FoodsJpn.gf new file mode 100644 index 00000000..9525ff16 --- /dev/null +++ b/samples/Grammatical Framework/FoodsJpn.gf @@ -0,0 +1,72 @@ +--# -path=.:../lib/src/prelude + +-- (c) 2009 Zofia Stankiewicz under LGPL + +concrete FoodsJpn of Foods = open Prelude in { + +flags coding=utf8 ; + + lincat + Comment = {s: Style => Str}; + Quality = {s: AdjUse => Str ; t: AdjType} ; + Kind = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + + lin + Pred item quality = {s = case quality.t of { + IAdj => table {Plain => item.s ++ quality.s ! APred ; Polite => item.s ++ quality.s ! APred ++ copula ! Polite ! item.n } ; + NaAdj => \\p => item.s ++ quality.s ! APred ++ copula ! p ! item.n } + } ; + This = det Sg "この" ; + That = det Sg "その" ; + These = det Pl "この" ; + Those = det Pl "その" ; + Mod quality kind = {s = \\n => quality.s ! Attr ++ kind.s ! n} ; + Wine = regNoun "ワインは" ; + Cheese = regNoun "チーズは" ; + Fish = regNoun "魚は" ; + Pizza = regNoun "ピザは" ; + Very quality = {s = \\a => "とても" ++ quality.s ! a ; t = quality.t } ; + Fresh = adj "新鮮な" "新鮮"; + Warm = regAdj "あたたかい" ; + Italian = adj "イタリアの" "イタリアのもの"; + Expensive = regAdj "たかい" ; + Delicious = regAdj "おいしい" ; + Boring = regAdj "つまらない" ; + + param + Number = Sg | Pl ; + AdjUse = Attr | APred ; -- na-adjectives have different forms as noun attributes and predicates + Style = Plain | Polite ; -- for phrase types + AdjType = IAdj | NaAdj ; -- IAdj can form predicates without the copula, NaAdj cannot + + oper + det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} = + \n,d,cn -> { + s = d ++ cn.s ! n ; + n = n + } ; + noun : Str -> Str -> {s : Number => Str} = + \sakana,sakana -> {s = \\_ => sakana } ; + + regNoun : Str -> {s : Number => Str} = + \sakana -> noun sakana sakana ; + + adj : Str -> Str -> {s : AdjUse => Str ; t : AdjType} = + \chosenna, chosen -> { + s = table { + Attr => chosenna ; + APred => chosen + } ; + t = NaAdj + } ; + + regAdj : Str -> {s: AdjUse => Str ; t : AdjType} =\akai -> { + s = \\_ => akai ; t = IAdj} ; + + copula : Style => Number => Str = + table { + Plain => \\_ => "だ" ; + Polite => \\_ => "です" } ; + +} diff --git a/samples/Grammatical Framework/FoodsLav.gf b/samples/Grammatical Framework/FoodsLav.gf new file mode 100644 index 00000000..efab6345 --- /dev/null +++ b/samples/Grammatical Framework/FoodsLav.gf @@ -0,0 +1,91 @@ +--# -path=.:prelude + +-- (c) 2009 Inese Bernsone under LGPL + +concrete FoodsLav of Foods = open Prelude in { + + flags + coding=utf8 ; + + lincat + Comment = SS ; + Quality = {s : Q => Gender => Number => Defin => Str } ; + Kind = {s : Number => Str ; g : Gender} ; + Item = {s : Str ; g : Gender ; n : Number } ; + + lin + Pred item quality = ss (item.s ++ {- copula item.n -} "ir" ++ quality.s ! Q1 ! item.g ! item.n ! Ind ) ; + This = det Sg "šis" "šī" ; + That = det Sg "tas" "tā" ; + These = det Pl "šie" "šīs" ; + Those = det Pl "tie" "tās" ; + Mod quality kind = {s = \\n => quality.s ! Q1 ! kind.g ! n ! Def ++ kind.s ! n ; g = kind.g } ; + Wine = noun "vīns" "vīni" Masc ; + Cheese = noun "siers" "sieri" Masc ; + Fish = noun "zivs" "zivis" Fem ; + Pizza = noun "pica" "picas" Fem ; + Very qual = {s = \\q,g,n,spec => "ļoti" ++ qual.s ! Q2 ! g ! n ! spec }; + + Fresh = adjective "svaigs" "svaiga" "svaigi" "svaigas" "svaigais" "svaigā" "svaigie" "svaigās" ; + Warm = regAdj "silts" ; + Italian = specAdj "itāļu" (regAdj "itālisks") ; + Expensive = regAdj "dārgs" ; + Delicious = regAdj "garšīgs" ; + Boring = regAdj "garlaicīgs" ; + + param + Number = Sg | Pl ; + Gender = Masc | Fem ; + Defin = Ind | Def ; + Q = Q1 | Q2 ; + + oper + det : Number -> Str -> Str -> {s : Number => Str ; g : Gender} -> + {s : Str ; g : Gender ; n : Number} = + \n,m,f,cn -> { + s = case cn.g of {Masc => m ; Fem => f} ++ cn.s ! n ; + g = cn.g ; + n = n + } ; + noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = + \man,men,g -> { + s = table { + Sg => man ; + Pl => men + } ; + g = g + } ; + adjective : (_,_,_,_,_,_,_,_ : Str) -> {s : Q => Gender => Number => Defin => Str} = + \skaists,skaista,skaisti,skaistas,skaistais,skaistaa,skaistie,skaistaas -> { + s = table { + _ => table { + Masc => table { + Sg => table {Ind => skaists ; Def => skaistais} ; + Pl => table {Ind => skaisti ; Def => skaistie} + } ; + Fem => table { + Sg => table {Ind => skaista ; Def => skaistaa} ; + Pl => table {Ind => skaistas ; Def => skaistaas} + } + } + } + } ; + + {- irregAdj : Str -> {s : Gender => Number => Defin => Str} = \itaalju -> + let itaalju = itaalju + in adjective itaalju (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) ; -} + + regAdj : Str -> {s : Q => Gender => Number => Defin => Str} = \skaists -> + let skaist = init skaists + in adjective skaists (skaist + "a") (skaist + "i") (skaist + "as") (skaist + "ais") (skaist + "ā") (skaist + "ie") (skaist + "ās"); + + Adjective : Type = {s : Q => Gender => Number => Defin => Str} ; + + specAdj : Str -> Adjective -> Adjective = \s,a -> { + s = table { + Q2 => a.s ! Q1 ; + Q1 => \\_,_,_ => s + } + } ; + + } diff --git a/samples/Grammatical Framework/FoodsMlt.gf b/samples/Grammatical Framework/FoodsMlt.gf new file mode 100644 index 00000000..5fcd4de7 --- /dev/null +++ b/samples/Grammatical Framework/FoodsMlt.gf @@ -0,0 +1,105 @@ +-- (c) 2013 John J. Camilleri under LGPL + +concrete FoodsMlt of Foods = open Prelude in { + flags coding=utf8 ; + + lincat + Comment = SS ; + Quality = {s : Gender => Number => Str} ; + Kind = {s : Number => Str ; g : Gender} ; + Item = {s : Str ; g : Gender ; n : Number} ; + + lin + -- Pred item quality = ss (item.s ++ copula item.n item.g ++ quality.s ! item.g ! item.n) ; + Pred item quality = ss (item.s ++ quality.s ! item.g ! item.n) ; + + This kind = det Sg "dan" "din" kind ; + That kind = det Sg "dak" "dik" kind ; + These kind = det Pl "dawn" "" kind ; + Those kind = det Pl "dawk" "" kind ; + + Mod quality kind = { + s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ; + g = kind.g + } ; + + Wine = noun "inbid" "inbejjed" Masc ; + Cheese = noun "ġobon" "ġobniet" Masc ; + Fish = noun "ħuta" "ħut" Fem ; + Pizza = noun "pizza" "pizzez" Fem ; + + Very qual = {s = \\g,n => qual.s ! g ! n ++ "ħafna"} ; + + Warm = adjective "sħun" "sħuna" "sħan" ; + Expensive = adjective "għali" "għalja" "għaljin" ; + Delicious = adjective "tajjeb" "tajba" "tajbin" ; + Boring = uniAdj "tad-dwejjaq" ; + Fresh = regAdj "frisk" ; + Italian = regAdj "Taljan" ; + + param + Number = Sg | Pl ; + Gender = Masc | Fem ; + + oper + --Create an adjective (full function) + --Params: Sing Masc, Sing Fem, Plural + adjective : (_,_,_ : Str) -> {s : Gender => Number => Str} = \iswed,sewda,suwed -> { + s = table { + Masc => table { + Sg => iswed ; + Pl => suwed + } ; + Fem => table { + Sg => sewda ; + Pl => suwed + } + } + } ; + + --Create a regular adjective + --Param: Sing Masc + regAdj : Str -> {s : Gender => Number => Str} = \frisk -> + adjective frisk (frisk + "a") (frisk + "i") ; + + --Create a "uni-adjective" eg tal-buzz + --Param: Sing Masc + uniAdj : Str -> {s : Gender => Number => Str} = \uni -> + adjective uni uni uni ; + + --Create a noun + --Params: Singular, Plural, Gender (inherent) + noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = \ktieb,kotba,g -> { + s = table { + Sg => ktieb ; + Pl => kotba + } ; + g = g + } ; + + --Copula is a linking verb + --Params: Number, Gender + -- copula : Number -> Gender -> Str = \n,g -> case n of { + -- Sg => case g of { Masc => "huwa" ; Fem => "hija" } ; + -- Pl => "huma" + -- } ; + + --Create an article, taking into account first letter of next word + article = pre { + "a"|"e"|"i"|"o"|"u" => "l-" ; + --cons@("ċ"|"d"|"n"|"r"|"s"|"t"|"x"|"ż") => "i" + cons + "-" ; + _ => "il-" + } ; + + --Create a determinant + --Params: Sg/Pl, Masc, Fem + det : Number -> Str -> Str -> {s : Number => Str ; g : Gender} -> {s : Str ; g : Gender ; n : Number} = \n,m,f,cn -> { + s = case n of { + Sg => case cn.g of {Masc => m ; Fem => f}; --string + Pl => m --default to masc + } ++ article ++ cn.s ! n ; + g = cn.g ; --gender + n = n --number + } ; + +} diff --git a/samples/Grammatical Framework/FoodsMon.gf b/samples/Grammatical Framework/FoodsMon.gf new file mode 100644 index 00000000..eda2012f --- /dev/null +++ b/samples/Grammatical Framework/FoodsMon.gf @@ -0,0 +1,49 @@ +--# -path=.:/GF/lib/src/prelude + +-- (c) 2009 Nyamsuren Erdenebadrakh under LGPL + +concrete FoodsMon of Foods = open Prelude in { + flags coding=utf8; + + lincat + Comment, Quality = SS ; + Kind = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + + lin + Pred item quality = ss (item.s ++ "бол" ++ quality.s) ; + This = det Sg "энэ" ; + That = det Sg "тэр" ; + These = det Pl "эдгээр" ; + Those = det Pl "тэдгээр" ; + Mod quality kind = {s = \\n => quality.s ++ kind.s ! n} ; + Wine = regNoun "дарс" ; + Cheese = regNoun "бяслаг" ; + Fish = regNoun "загас" ; + Pizza = regNoun "пицца" ; + Very = prefixSS "маш" ; + Fresh = ss "шинэ" ; + Warm = ss "халуун" ; + Italian = ss "итали" ; + Expensive = ss "үнэтэй" ; + Delicious = ss "амттай" ; + Boring = ss "амтгүй" ; + + param + Number = Sg | Pl ; + + oper + det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} = + \n,d,cn -> { + s = d ++ cn.s ! n ; + n = n + } ; + + regNoun : Str -> {s : Number => Str} = + \x -> {s = table { + Sg => x ; + Pl => x + "нууд"} + } ; + } + + diff --git a/samples/Grammatical Framework/FoodsNep.gf b/samples/Grammatical Framework/FoodsNep.gf new file mode 100644 index 00000000..ea02e64a --- /dev/null +++ b/samples/Grammatical Framework/FoodsNep.gf @@ -0,0 +1,60 @@ +-- (c) 2011 Dinesh Simkhada under LGPL + +concrete FoodsNep of Foods = { + + flags coding = utf8 ; + + lincat + Comment, Quality = {s : Str} ; + Kind = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + + lin + Pred item quality = + {s = item.s ++ quality.s ++ copula ! item.n} ; + + This = det Sg "यो" ; + That = det Sg "त्यो" ; + These = det Pl "यी" ; + Those = det Pl "ती" ; + Mod quality kind = + {s = \\n => quality.s ++ kind.s ! n} ; + + Wine = regNoun "रक्सी" ; + Cheese = regNoun "चिज" ; + Fish = regNoun "माछा" ; + Pizza = regNoun "पिज्जा" ; + Very a = {s = "धेरै" ++ a.s} ; + Fresh = adj "ताजा" ; + Warm = adj "तातो" ; + Italian = adj "इटालियन" ; + Expensive = adj "महँगो" | adj "बहुमूल्य" ; + Delicious = adj "स्वादिष्ट" | adj "मीठो" ; + Boring = adjPl "नमिठो" ; + + param + Number = Sg | Pl ; + + oper + det : Number -> Str -> + {s : Number => Str} -> {s : Str ; n : Number} = + \n,det,noun -> {s = det ++ noun.s ! n ; n = n} ; + + noun : Str -> Str -> {s : Number => Str} = + \man,men -> {s = table {Sg => man ; Pl => men}} ; + + regNoun : Str -> {s : Number => Str} = + \car -> noun car (car + "हरु") ; + + adjPl : Str -> {s : Str} = \a -> case a of { + bor + "ठो" => adj (bor + "ठा") ; + _ => adj a + } ; + + adj : Str -> {s : Str} = + \cold -> {s = cold} ; + + copula : Number => Str = + table {Sg => "छ" ; Pl => "छन्"} ; +} + diff --git a/samples/Grammatical Framework/FoodsOri.gf b/samples/Grammatical Framework/FoodsOri.gf new file mode 100644 index 00000000..ad4f492f --- /dev/null +++ b/samples/Grammatical Framework/FoodsOri.gf @@ -0,0 +1,30 @@ +concrete FoodsOri of Foods = { + +flags coding = utf8 ; + +lincat + Comment = Str; + Item = Str; + Kind = Str; + Quality = Str; + +lin + Pred item quality = item ++ quality ++ "ଅଟେ"; + This kind = "ଏଇ" ++ kind; + That kind = "ସେଇ" ++ kind; + These kind = "ଏଇ" ++ kind ++ "ଗୁଡିକ" ; + Those kind = "ସେଇ" ++ kind ++ "ଗୁଡିକ" ; + Mod quality kind = quality ++ kind; + Wine = "ମଦ"; + Cheese = "ଛେନା"; + Fish = "ମାଛ"; + Pizza = "ପିଜଜ଼ା" ; + Very quality = "ଅତି" ++ quality; + Fresh = "ତାଜା"; + Warm = "ଗରମ"; + Italian = "ଇଟାଲି"; + Expensive = "ମୁଲ୍ୟବାନ୍"; + Delicious = "ସ୍ଵାଦିସ୍ଟ "; + Boring = "ଅରୁଚିକର"; + +} diff --git a/samples/Grammatical Framework/FoodsPes.gf b/samples/Grammatical Framework/FoodsPes.gf new file mode 100644 index 00000000..c2e631e8 --- /dev/null +++ b/samples/Grammatical Framework/FoodsPes.gf @@ -0,0 +1,65 @@ +concrete FoodsPes of Foods = { + + flags optimize=noexpand ; coding=utf8 ; + + lincat + Comment = {s : Str} ; + Quality = {s : Add => Str; prep : Str} ; + Kind = {s : Add => Number => Str ; prep : Str}; + Item = {s : Str ; n : Number}; + lin + Pred item quality = {s = item.s ++ quality.s ! Indep ++ copula ! item.n} ; + This = det Sg "این" ; + That = det Sg "آن" ; + These = det Pl "این" ; + Those = det Pl "آن" ; + + Mod quality kind = {s = \\a,n => kind.s ! Attr ! n ++ kind.prep ++ quality.s ! a ; + prep = quality.prep + }; + Wine = regN "شراب" ; + Cheese = regN "پنیر" ; + Fish = regN "ماهى" ; + Pizza = regN "پیتزا" ; + Very a = {s = \\at => "خیلی" ++ a.s ! at ; prep = a.prep} ; + Fresh = adj "تازه" ; + Warm = adj "گرم" ; + Italian = adj "ایتالیایی" ; + Expensive = adj "گران" ; + Delicious = adj "لذىذ" ; + Boring = adj "ملال آور" ; -- it must be written as ملال آور. + + param + Number = Sg | Pl ; + Add = Indep | Attr ; + oper + det : Number -> Str -> {s: Add => Number => Str ; prep : Str} -> {s : Str ; n: Number} = + \n,det,noun -> {s = det ++ noun.s ! Indep ! n ; n = n }; + + noun : (x1,_,_,x4 : Str) -> {s : Add => Number => Str ; prep : Str} = \pytzA, pytzAy, pytzAhA,pr -> + {s = \\a,n => case of + { => pytzA ; => pytzAhA ; + =>pytzA ; => pytzAhA + "ى" }; + prep = pr + }; + + regN : Str -> {s: Add => Number => Str ; prep : Str} = \mrd -> + case mrd of + { _ + ("ا"|"ه"|"ى"|"و"|"") => noun mrd (mrd+"ى") (mrd + "ها") ""; + _ => noun mrd mrd (mrd + "ها") "e" + }; + + adj : Str -> {s : Add => Str; prep : Str} = \tAzh -> + case tAzh of + { _ + ("ا"|"ه"|"ى"|"و"|"") => mkAdj tAzh (tAzh ++ "ى") "" ; + _ => mkAdj tAzh tAzh "ه" + }; + + mkAdj : Str -> Str -> Str -> {s : Add => Str; prep : Str} = \tAzh, tAzhy, pr -> + {s = table {Indep => tAzh; + Attr => tAzhy}; + prep = pr + }; + copula : Number => Str = table {Sg => "است"; Pl => "هستند"}; + +} \ No newline at end of file diff --git a/samples/Grammatical Framework/FoodsPor.gf b/samples/Grammatical Framework/FoodsPor.gf new file mode 100644 index 00000000..6171c707 --- /dev/null +++ b/samples/Grammatical Framework/FoodsPor.gf @@ -0,0 +1,79 @@ +-- (c) 2009 Rami Shashati under LGPL + +concrete FoodsPor of Foods = open Prelude in { + flags coding=utf8; + + lincat + Comment = {s : Str} ; + Quality = {s : Gender => Number => Str} ; + Kind = {s : Number => Str ; g : Gender} ; + Item = {s : Str ; n : Number ; g : Gender } ; + + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ quality.s ! item.g ! item.n } ; + This = det Sg (table {Masc => "este" ; Fem => "esta"}) ; + That = det Sg (table {Masc => "esse" ; Fem => "essa"}) ; + These = det Pl (table {Masc => "estes" ; Fem => "estas"}) ; + Those = det Pl (table {Masc => "esses" ; Fem => "essas"}) ; + + Mod quality kind = { s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ; g = kind.g } ; + + Wine = regNoun "vinho" Masc ; + Cheese = regNoun "queijo" Masc ; + Fish = regNoun "peixe" Masc ; + Pizza = regNoun "pizza" Fem ; + + Very a = { s = \\g,n => "muito" ++ a.s ! g ! n } ; + + Fresh = mkAdjReg "fresco" ; + Warm = mkAdjReg "quente" ; + Italian = mkAdjReg "Italiano" ; + Expensive = mkAdjReg "caro" ; + Delicious = mkAdjReg "delicioso" ; + Boring = mkAdjReg "chato" ; + + param + Number = Sg | Pl ; + Gender = Masc | Fem ; + + oper + QualityT : Type = {s : Gender => Number => Str} ; + + mkAdj : (_,_,_,_ : Str) -> QualityT = \bonito,bonita,bonitos,bonitas -> { + s = table { + Masc => table { Sg => bonito ; Pl => bonitos } ; + Fem => table { Sg => bonita ; Pl => bonitas } + } ; + } ; + + -- regular pattern + adjSozinho : Str -> QualityT = \sozinho -> + let sozinh = Predef.tk 1 sozinho + in mkAdj sozinho (sozinh + "a") (sozinh + "os") (sozinh + "as") ; + + -- for gender-independent adjectives + adjUtil : Str -> Str -> QualityT = \util,uteis -> + mkAdj util util uteis uteis ; + + -- smart paradigm for adjcetives + mkAdjReg : Str -> QualityT = \a -> case last a of { + "o" => adjSozinho a ; + "e" => adjUtil a (a + "s") + } ; + + ItemT : Type = {s : Str ; n : Number ; g : Gender } ; + + det : Number -> (Gender => Str) -> KindT -> ItemT = + \num,det,noun -> {s = det ! noun.g ++ noun.s ! num ; n = num ; g = noun.g } ; + + KindT : Type = {s : Number => Str ; g : Gender} ; + + noun : Str -> Str -> Gender -> KindT = + \animal,animais,gen -> {s = table {Sg => animal ; Pl => animais} ; g = gen } ; + + regNoun : Str -> Gender -> KindT = + \carro,gen -> noun carro (carro + "s") gen ; + + copula : Number => Str = table {Sg => "é" ; Pl => "são"} ; +} diff --git a/samples/Grammatical Framework/FoodsRon.gf b/samples/Grammatical Framework/FoodsRon.gf new file mode 100644 index 00000000..d7d917ff --- /dev/null +++ b/samples/Grammatical Framework/FoodsRon.gf @@ -0,0 +1,72 @@ +-- (c) 2009 Ramona Enache under LGPL + +concrete FoodsRon of Foods = +{ +flags coding=utf8 ; + +param Number = Sg | Pl ; + Gender = Masc | Fem ; + NGender = NMasc | NFem | NNeut ; +lincat +Comment = {s : Str}; +Quality = {s : Number => Gender => Str}; +Kind = {s : Number => Str; g : NGender}; +Item = {s : Str ; n : Number; g : Gender}; + +lin + +This = det Sg (mkTab "acest" "această"); +That = det Sg (mkTab "acel" "acea"); +These = det Pl (mkTab "acești" "aceste"); +Those = det Pl (mkTab "acei" "acele"); + +Wine = mkNoun "vin" "vinuri" NNeut ; +Cheese = mkNoun "brânză" "brânzeturi" NFem ; +Fish = mkNoun "peşte" "peşti" NMasc ; +Pizza = mkNoun "pizza" "pizze" NFem; + +Very a = {s = \\n,g => "foarte" ++ a.s ! n ! g}; + +Fresh = mkAdj "proaspăt" "proaspătă" "proaspeţi" "proaspete" ; +Warm = mkAdj "cald" "caldă" "calzi" "calde" ; +Italian = mkAdj "italian" "italiană" "italieni" "italiene" ; +Expensive = mkAdj "scump" "scumpă" "scumpi" "scumpe" ; +Delicious = mkAdj "delicios" "delcioasă" "delicioşi" "delicioase" ; +Boring = mkAdj "plictisitor" "plictisitoare" "plictisitori" "plictisitoare" ; + +Pred item quality = {s = item.s ++ copula ! item.n ++ quality.s ! item.n ! item.g} ; + +Mod quality kind = {s = \\n => kind.s ! n ++ quality.s ! n ! (getAgrGender kind.g n) ; g = kind.g}; + +oper + +mkTab : Str -> Str -> {s : Gender => Str} = \acesta, aceasta -> +{s = table{Masc => acesta; + Fem => aceasta}}; + +det : Number -> {s : Gender => Str} -> {s : Number => Str ; g : NGender} -> {s : Str; n : Number; g : Gender} = +\n,det,noun -> let gg = getAgrGender noun.g n + in + {s = det.s ! gg ++ noun.s ! n ; n = n ; g = gg}; + +mkNoun : Str -> Str -> NGender -> {s : Number => Str; g : NGender} = \peste, pesti,g -> +{s = table {Sg => peste; + Pl => pesti}; + g = g +}; + +oper mkAdj : (x1,_,_,x4 : Str) -> {s : Number => Gender => Str} = \scump, scumpa, scumpi, scumpe -> +{s = \\n,g => case of +{ => scump ; => scumpa; + => scumpi ; => scumpe +}}; + +copula : Number => Str = table {Sg => "este" ; Pl => "sunt"}; + +getAgrGender : NGender -> Number -> Gender = \ng,n -> +case of +{ => Masc ; => Fem; + => Masc ; => Fem +}; + +} diff --git a/samples/Grammatical Framework/FoodsSpa.gf b/samples/Grammatical Framework/FoodsSpa.gf new file mode 100644 index 00000000..972282ae --- /dev/null +++ b/samples/Grammatical Framework/FoodsSpa.gf @@ -0,0 +1,31 @@ +--# -path=.:present + +concrete FoodsSpa of Foods = open SyntaxSpa, StructuralSpa, ParadigmsSpa in { + + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_QuantSg kind ; + That kind = mkNP that_QuantSg kind ; + These kind = mkNP these_QuantPl kind ; + Those kind = mkNP those_QuantPl kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; + Wine = mkCN (mkN "vino") ; + Pizza = mkCN (mkN "pizza") ; + Cheese = mkCN (mkN "queso") ; + Fish = mkCN (mkN "pescado") ; + Fresh = mkAP (mkA "fresco") ; + Warm = mkAP (mkA "caliente") ; + Italian = mkAP (mkA "italiano") ; + Expensive = mkAP (mkA "caro") ; + Delicious = mkAP (mkA "delicioso") ; + Boring = mkAP (mkA "aburrido") ; + +} + diff --git a/samples/Grammatical Framework/FoodsSwe.gf b/samples/Grammatical Framework/FoodsSwe.gf new file mode 100644 index 00000000..cbb35fb9 --- /dev/null +++ b/samples/Grammatical Framework/FoodsSwe.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsSwe of Foods = FoodsI with + (Syntax = SyntaxSwe), + (LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ; diff --git a/samples/Grammatical Framework/FoodsTha.gf b/samples/Grammatical Framework/FoodsTha.gf new file mode 100644 index 00000000..b031a7e2 --- /dev/null +++ b/samples/Grammatical Framework/FoodsTha.gf @@ -0,0 +1,33 @@ +--# -path=.:alltenses + +concrete FoodsTha of Foods = open SyntaxTha, LexiconTha, + ParadigmsTha, (R=ResTha) in { + + flags coding = utf8 ; + + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_Det kind ; + That kind = mkNP that_Det kind ; + These kind = mkNP these_Det kind ; + Those kind = mkNP those_Det kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; + Wine = mkCN (mkN (R.thword "เหล้าอ" "งุ่น") "ขวด") ; + Pizza = mkCN (mkN (R.thword "พิซ" "ซา") "ถาด") ; + Cheese = mkCN (mkN (R.thword "เนย" "แข็ง") "ก้อน") ; + Fish = mkCN fish_N ; + Fresh = mkAP (mkA "สด") ; + Warm = mkAP warm_A ; + Italian = mkAP (mkA " อิตาลี") ; + Expensive = mkAP (mkA "แพง") ; + Delicious = mkAP (mkA "อร่อย") ; + Boring = mkAP (mkA (R.thword "น่า" "เบิ่อ")) ; + +} diff --git a/samples/Grammatical Framework/FoodsTsn.gf b/samples/Grammatical Framework/FoodsTsn.gf new file mode 100644 index 00000000..a7a69a1a --- /dev/null +++ b/samples/Grammatical Framework/FoodsTsn.gf @@ -0,0 +1,178 @@ +--# -path=alltenses + +-- (c) 2009 Laurette Pretorius Sr & Jr and Ansu Berg under LGPL + +concrete FoodsTsn of Foods = open Prelude, Predef in { + flags coding = utf8; + lincat + Comment = {s:Str}; + Item = {s:Str; c:NounClass; n:Number}; + Kind = {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool}; + Quality = {s: NounClass => Number => Str; p_form: Str; t: TType}; + lin + Pred item quality = {s = item.s ++ ((mkPredDescrCop quality.t) ! item.c ! item.n) ++ quality.p_form}; + + This kind = {s = (kind.w ! Sg) ++ (mkDemPron1 ! kind.c ! Sg) ++ (kind.q ! Sg); c = kind.c; n = Sg}; + That kind = {s = (kind.w ! Sg) ++ (mkDemPron2 ! kind.c ! Sg) ++ (kind.q ! Sg); c = kind.c; n = Sg}; + These kind = {s = (kind.w ! Pl) ++ (mkDemPron1 ! kind.c ! Pl) ++ (kind.q ! Pl); c = kind.c; n = Pl}; + Those kind = {s = (kind.w ! Pl) ++ (mkDemPron2 ! kind.c ! Pl) ++ (kind.q ! Pl); c = kind.c; n = Pl}; + + Mod quality kind = mkMod quality kind; + + -- Lexicon + Wine = mkNounNC14_6 "jalwa"; + Cheese = mkNounNC9_10 "kase"; + Fish = mkNounNC9_10 "thlapi"; + Pizza = mkNounNC9_10 "pizza"; + Very quality = smartVery quality; + Fresh = mkVarAdj "ntsha"; + Warm = mkOrdAdj "bothitho"; + Italian = mkPerAdj "Itali"; + Expensive = mkVerbRel "tura"; + Delicious = mkOrdAdj "monate"; + Boring = mkOrdAdj "bosula"; + + param + NounClass = NC9_10 | NC14_6; + Number = Sg | Pl; + TType = P | V | ModV | R ; + oper + mkMod : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; + b: Bool} = \x,y -> case y.b of + { + True => {w = y.w; r = y.r; c = y.c; + q = table { + Sg => ((y.q ! Sg) ++ "le" ++ ((smartQualRelPart (x.t)) ! y.c ! Sg) ++ ((smartDescrCop (x.t)) ! y.c ! Sg) ++ (x.s ! y.c ! Sg)); + Pl => ((y.q ! Pl) ++ "le" ++ ((smartQualRelPart (x.t))! y.c ! Pl) ++ ((smartDescrCop (x.t)) ! y.c ! Pl) ++(x.s ! y.c ! Pl)) + }; b = True + }; + False => {w = y.w; r = y.r; c = y.c; + q = table { + Sg => ((y.q ! Sg) ++ ((smartQualRelPart (x.t)) ! y.c ! Sg) ++ ((smartDescrCop (x.t)) ! y.c ! Sg) ++ (x.s ! y.c ! Sg)); + Pl => ((y.q ! Pl) ++ ((smartQualRelPart (x.t)) ! y.c ! Pl) ++ ((smartDescrCop (x.t)) ! y.c ! Pl) ++(x.s ! y.c ! Pl)) + }; b = True + } + }; + + mkNounNC14_6 : Str -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} = \x -> {w = table {Sg => "bo" + x; Pl => "ma" + x}; r = x; c = NC14_6; + q = table {Sg => ""; Pl => ""}; b = False}; + + mkNounNC9_10 : Str -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} = \x -> {w = table {Sg => "" + x; Pl => "di" + x}; r = x; c = NC9_10; + q = table {Sg => ""; Pl => ""}; b = False}; + + mkVarAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table { + NC9_10 => table {Sg => "" + x; Pl => "di" + x}; + NC14_6 => table {Sg => "bo" + x; Pl => "ma" + x} + }; + p_form = x; + t = R; + }; + + mkOrdAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table { + NC9_10 => table {Sg => "" + x; Pl => "" + x}; + NC14_6 => table {Sg => "" + x; Pl => "" + x} + }; + p_form = x; + t = R; + }; + + mkVerbRel : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table { + NC9_10 => table {Sg => x + "ng"; Pl => x + "ng"}; + NC14_6 => table {Sg => x + "ng"; Pl => x + "ng"} + }; + p_form = x; + t = V; + }; + + mkPerAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table { + NC9_10 => table {Sg => "" + x; Pl => "" + x}; + NC14_6 => table {Sg => "" + x; Pl => "" + x} + }; + p_form = "mo" ++ x; + t = P; + }; + + mkVeryAdj : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table{c => table{n => (x.s!c!n) ++ "thata"}}; p_form = x.p_form ++ "thata"; t = x.t + }; + + mkVeryVerb : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x -> + { + s = table{c => table{n => (x.s!c!n) ++ "thata"}}; p_form = x.p_form ++ "thata"; t = ModV + }; + + smartVery : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} = +\x -> case x.t of --(x.s!c!n) + { + (V | ModV) => mkVeryVerb x; + --ModV => mkVeryVerb x; + _ => mkVeryAdj x + }; + + mkDemPron1 : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "e"; Pl => "tse"}; + NC14_6 => table {Sg => "bo"; Pl => "a"} + }; + + mkDemPron2 : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "eo"; Pl => "tseo"}; + NC14_6 => table {Sg => "boo"; Pl => "ao"} + }; + + smartQualRelPart : TType -> (NounClass => Number => Str) = \x -> case x of + { + P => mkQualRelPart_PName; + _ => mkQualRelPart + }; + + mkQualRelPart : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "e"; Pl => "tse"}; + NC14_6 => table {Sg => "bo"; Pl => "a"} + }; + + mkQualRelPart_PName : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "ya"; Pl => "tsa"}; + NC14_6 => table {Sg => "ba"; Pl => "a"} + }; + + smartDescrCop : TType -> (NounClass => Number => Str) = \x -> case x of + { + P => mkDescrCop_PName; + _ => mkDescrCop + }; + + mkDescrCop : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "e"; Pl => "di"}; + NC14_6 => table {Sg => "bo"; Pl => "a"} + }; + + mkDescrCop_PName : NounClass => Number => Str = table + { + NC9_10 => table {Sg => "ga"; Pl => "ga"}; + NC14_6 => table {Sg => "ga"; Pl => "ga"} + }; + + mkPredDescrCop : TType -> (NounClass => Number => Str) = \x -> case x of + { + V => table {NC9_10 => table {Sg => "e" ++ "a"; Pl => "di" ++ "a"}; + NC14_6 => table {Sg => "bo" ++ "a"; Pl => "a" ++ "a"}}; + + _ => table {NC9_10 => table {Sg => "e"; Pl => "di"}; + NC14_6 => table {Sg => "bo"; Pl => "a"}} + }; + +} diff --git a/samples/Grammatical Framework/FoodsTur.gf b/samples/Grammatical Framework/FoodsTur.gf new file mode 100644 index 00000000..9d6cd035 --- /dev/null +++ b/samples/Grammatical Framework/FoodsTur.gf @@ -0,0 +1,140 @@ +{- + File : FoodsTur.gf + Author : Server Çimen + Version : 1.0 + Created on: August 26, 2009 + + This file contains concrete grammar of Foods abstract grammar for Turkish Language. + This grammar is to be used for Fridge demo and developed in the scope of GF Resource + Grammar Summer School. + +-} + +concrete FoodsTur of Foods = open Predef in { + flags + coding=utf8 ; + lincat + Comment = {s : Str} ; + Quality = {s : Str ; c : Case; softness : Softness; h : Harmony} ; + Kind = {s : Case => Number => Str} ; + Item = {s : Str; n : Number} ; + lin + This = det Sg "bu" ; + That = det Sg "şu" ; + These = det Pl "bu" ; + Those = det Pl "şu" ; + -- Reason for excluding plural form of copula: In Turkish if subject is not a human being, + -- then singular form of copula is used regardless of the number of subject. Since all + -- possible subjects are non human, copula do not need to have plural form. + Pred item quality = {s = item.s ++ quality.s ++ "&+" ++ copula ! quality.softness ! quality.h} ;--! item.n} ; + Mod quality kind = {s = case quality.c of { + Nom => \\t,n => quality.s ++ kind.s ! t ! n ; + Gen => \\t,n => quality.s ++ kind.s ! Gen ! n + } + } ; + Wine = mkN "şarap" "şaraplar" "şarabı" "şarapları" ; + Cheese = mkN "peynir" "peynirler" "peyniri" "peynirleri" ; + Fish = mkN "balık" "balıklar" "balığı" "balıkları" ; + Pizza = mkN "pizza" "pizzalar" "pizzası" "pizzaları" ; + Very a = {s = "çok" ++ a.s ; c = a.c; softness = a.softness; h = a.h} ; + Fresh = adj "taze" Nom; + Warm = adj "ılık" Nom; + Italian = adj "İtalyan" Gen ; + Expensive = adj "pahalı" Nom; + Delicious = adj "lezzetli" Nom; + Boring = adj "sıkıcı" Nom; + param + Number = Sg | Pl ; + Case = Nom | Gen ; + Harmony = I_Har | Ih_Har | U_Har | Uh_Har ; --Ih = İ; Uh = Ü + Softness = Soft | Hard ; + oper + det : Number -> Str -> {s : Case => Number => Str} -> {s : Str; n : Number} = + \num,det,noun -> {s = det ++ noun.s ! Nom ! num; n = num} ; + mkN = overload { + mkN : Str -> Str -> {s : Case => Number => Str} = regNoun ; + mkn : Str -> Str -> Str -> Str-> {s : Case => Number => Str} = noun ; + } ; + regNoun : Str -> Str -> {s : Case => Number => Str} = + \peynir,peynirler -> noun peynir peynirler [] [] ; + noun : Str -> Str -> Str -> Str-> {s : Case => Number => Str} = + \sarap,saraplar,sarabi,saraplari -> { + s = table { + Nom => table { + Sg => sarap ; + Pl => saraplar + } ; + Gen => table { + Sg => sarabi ; + Pl => saraplari + } + } + }; + {- + Since there is a bug in overloading, this overload is useless. + + mkA = overload { + mkA : Str -> {s : Str; c : Case; softness : Softness; h : Harmony} = \base -> adj base Nom ; + mkA : Str -> Case -> {s : Str; c : Case; softness : Softness; h : Harmony} = adj ; + } ; + -} + adj : Str -> Case -> {s : Str; c : Case; softness : Softness; h : Harmony} = + \italyan,ca -> {s = italyan ; c = ca; softness = (getSoftness italyan); h = (getHarmony italyan)} ; + -- See the comment at lines 26 and 27 for excluded plural form of copula. + copula : Softness => Harmony {-=> Number-} => Str = + table { + Soft => table { + I_Har => "dır" ;--table { + -- Sg => "dır" ; + -- Pl => "dırlar" + --} ; + Ih_Har => "dir" ;--table { + --Sg => "dir" ; + --Pl => "dirler" + --} ; + U_Har => "dur" ;--table { + -- Sg => "dur" ; + -- Pl => "durlar" + --} ; + Uh_Har => "dür" --table { + --Sg => "dür" ; + --Pl => "dürler" + --} + } ; + Hard => table { + I_Har => "tır" ;--table { + --Sg => "tır" ; + --Pl => "tırlar" + --} ; + Ih_Har => "tir" ;--table { + --Sg => "tir" ; + --Pl => "tirler" + --} ; + U_Har => "tur" ;--table { + -- Sg => "tur" ; + -- Pl => "turlar" + --} ; + Uh_Har => "tür"--table { + --Sg => "tür" ; + --Pl => "türler" + --} + } + } ; + + getHarmony : Str -> Harmony + = \base -> case base of { + _+c@("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+ + ("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")* => + case c of { + ("ı"|"a") => I_Har ; + ("i"|"e") => Ih_Har ; + ("u"|"o") => U_Har ; + ("ü"|"ö") => Uh_Har + } + } ; + getSoftness : Str -> Softness + = \base -> case base of { + _+("f"|"s"|"t"|"k"|"ç"|"ş"|"h"|"p") => Hard ; + _ => Soft + } ; +} \ No newline at end of file diff --git a/samples/Grammatical Framework/FoodsUrd.gf b/samples/Grammatical Framework/FoodsUrd.gf new file mode 100644 index 00000000..186b2f92 --- /dev/null +++ b/samples/Grammatical Framework/FoodsUrd.gf @@ -0,0 +1,53 @@ +-- (c) 2009 Shafqat Virk under LGPL + +concrete FoodsUrd of Foods = { + + flags coding=utf8 ; + + + param Number = Sg | Pl ; + param Gender = Masc | Fem; + + oper coupla : Number -> Str =\n -> case n of {Sg => "ہے" ; Pl => "ہیں"}; + + + lincat + Comment = {s : Str} ; + Item = {s: Str ; n: Number ; g:Gender}; + Kind = {s: Number => Str ; g:Gender}; + Quality = {s: Gender => Number => Str}; + + lin + Pred item quality = {s = item.s ++ quality.s ! item.g ! item.n ++ coupla item.n} ; + This kind = {s = "یھ" ++ kind.s ! Sg; n= Sg ; g = kind.g } ; + These kind = {s = "یھ" ++ kind.s ! Pl; n = Pl ; g = kind.g} ; + That kind = {s = "وہ" ++ kind.s ! Sg; n= Sg ; g = kind.g} ; + Those kind = {s = "وہ" ++ kind.s ! Pl; n=Pl ; g = kind.g} ; + Mod quality kind = {s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ; g = kind.g}; + Wine = {s = table { Sg => "شراب" ; Pl => "شرابیں"} ; g = Fem}; + Cheese = {s = table { Sg => "پنیر" ; Pl => "پنیریں"} ; g = Fem}; + Fish = {s = table { Sg => "مچھلی" ; Pl => "مچھلیاں"} ; g = Fem}; + Pizza = {s = table { Sg => "پیزہ" ; Pl => "پیزے"} ; g = Masc}; + Very quality = {s = \\g,n => "بہت" ++ quality.s ! g ! n} ; + Fresh = regAdj "تازہ" ; + Warm = regAdj "گرم" ; + Italian = regAdj "اٹا لوی" ; + Expensive = regAdj "مہنگا" ; + Delicious = regAdj "مزیدار" ; + Boring = regAdj "فضول" ; + + oper + regAdj : Str -> {s: Gender => Number => Str} = \a -> case a of { + x + "ا" => mkAdj a (x+"ے") (x+"ی"); + _ => mkAdj a a a + }; + mkAdj : Str -> Str -> Str -> {s: Gender => Number => Str} = \s,p,f -> { + s = table { + Masc => table { + Sg => s; + Pl => p + }; + Fem => \\_ => f + } + }; + } \ No newline at end of file diff --git a/samples/Grammatical Framework/LexFoods.gf b/samples/Grammatical Framework/LexFoods.gf new file mode 100644 index 00000000..12ace208 --- /dev/null +++ b/samples/Grammatical Framework/LexFoods.gf @@ -0,0 +1,15 @@ +-- (c) 2009 Aarne Ranta under LGPL + +interface LexFoods = open Syntax in { + oper + wine_N : N ; + pizza_N : N ; + cheese_N : N ; + fish_N : N ; + fresh_A : A ; + warm_A : A ; + italian_A : A ; + expensive_A : A ; + delicious_A : A ; + boring_A : A ; +} diff --git a/samples/Grammatical Framework/LexFoodsCat.gf b/samples/Grammatical Framework/LexFoodsCat.gf new file mode 100644 index 00000000..624fc98c --- /dev/null +++ b/samples/Grammatical Framework/LexFoodsCat.gf @@ -0,0 +1,18 @@ +-- (c) 2009 Jordi Saludes under LGPL + +instance LexFoodsCat of LexFoods = + open SyntaxCat, ParadigmsCat, (M = MorphoCat) in { + flags + coding = utf8 ; + oper + wine_N = mkN "vi" "vins" M.Masc ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "formatge" ; + fish_N = mkN "peix" "peixos" M.Masc; + fresh_A = mkA "fresc" "fresca" "frescos" "fresques" "frescament"; + warm_A = mkA "calent" ; + italian_A = mkA "italià" "italiana" "italians" "italianes" "italianament" ; + expensive_A = mkA "car" ; + delicious_A = mkA "deliciós" "deliciosa" "deliciosos" "delicioses" "deliciosament"; + boring_A = mkA "aburrit" "aburrida" "aburrits" "aburrides" "aburridament" ; +} diff --git a/samples/Grammatical Framework/LexFoodsFin.gf b/samples/Grammatical Framework/LexFoodsFin.gf new file mode 100644 index 00000000..dbf8af6b --- /dev/null +++ b/samples/Grammatical Framework/LexFoodsFin.gf @@ -0,0 +1,21 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsFin of LexFoods = + open SyntaxFin, ParadigmsFin in { + flags coding=utf8; + oper + wine_N = mkN "viini" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "juusto" ; + fish_N = mkN "kala" ; + fresh_A = mkA "tuore" ; + warm_A = mkA + (mkN "lämmin" "lämpimän" "lämmintä" "lämpimänä" "lämpimään" + "lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin" + ) + "lämpimämpi" "lämpimin" ; + italian_A = mkA "italialainen" ; + expensive_A = mkA "kallis" ; + delicious_A = mkA "herkullinen" ; + boring_A = mkA "tylsä" ; +} diff --git a/samples/Grammatical Framework/LexFoodsGer.gf b/samples/Grammatical Framework/LexFoodsGer.gf new file mode 100644 index 00000000..253384f2 --- /dev/null +++ b/samples/Grammatical Framework/LexFoodsGer.gf @@ -0,0 +1,17 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsGer of LexFoods = + open SyntaxGer, ParadigmsGer in { + flags coding=utf8; + oper + wine_N = mkN "Wein" ; + pizza_N = mkN "Pizza" "Pizzen" feminine ; + cheese_N = mkN "Käse" "Käse" masculine ; + fish_N = mkN "Fisch" ; + fresh_A = mkA "frisch" ; + warm_A = mkA "warm" "wärmer" "wärmste" ; + italian_A = mkA "italienisch" ; + expensive_A = mkA "teuer" ; + delicious_A = mkA "köstlich" ; + boring_A = mkA "langweilig" ; +} diff --git a/samples/Grammatical Framework/LexFoodsIta.gf b/samples/Grammatical Framework/LexFoodsIta.gf new file mode 100644 index 00000000..11de5fcd --- /dev/null +++ b/samples/Grammatical Framework/LexFoodsIta.gf @@ -0,0 +1,16 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsIta of LexFoods = + open SyntaxIta, ParadigmsIta in { + oper + wine_N = mkN "vino" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "formaggio" ; + fish_N = mkN "pesce" ; + fresh_A = mkA "fresco" ; + warm_A = mkA "caldo" ; + italian_A = mkA "italiano" ; + expensive_A = mkA "caro" ; + delicious_A = mkA "delizioso" ; + boring_A = mkA "noioso" ; +} diff --git a/samples/Grammatical Framework/LexFoodsSwe.gf b/samples/Grammatical Framework/LexFoodsSwe.gf new file mode 100644 index 00000000..f9f02c33 --- /dev/null +++ b/samples/Grammatical Framework/LexFoodsSwe.gf @@ -0,0 +1,17 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsSwe of LexFoods = + open SyntaxSwe, ParadigmsSwe in { + flags coding=utf8; + oper + wine_N = mkN "vin" "vinet" "viner" "vinerna" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "ost" ; + fish_N = mkN "fisk" ; + fresh_A = mkA "färsk" ; + warm_A = mkA "varm" ; + italian_A = mkA "italiensk" ; + expensive_A = mkA "dyr" ; + delicious_A = mkA "läcker" ; + boring_A = mkA "tråkig" ; +} diff --git a/samples/Grammatical Framework/ResCze.gf b/samples/Grammatical Framework/ResCze.gf new file mode 100644 index 00000000..56b4aa6e --- /dev/null +++ b/samples/Grammatical Framework/ResCze.gf @@ -0,0 +1,46 @@ +-- (c) 2011 Katerina Bohmova under LGPL + +resource ResCze = open Prelude in { + flags + coding = utf8 ; + param + Number = Sg | Pl ; + Gender = Masc | Fem | Neutr; + oper + NounPhrase : Type = + {s : Str ; g : Gender ; n : Number} ; + Noun : Type = {s : Number => Str ; g : Gender} ; + Adjective : Type = {s : Gender => Number => Str} ; + + det : Number -> Str -> Str -> Str -> Noun -> NounPhrase = + \n,m,f,ne,cn -> { + s = table {Masc => m ; Fem => f; Neutr => ne} ! cn.g ++ + cn.s ! n ; + g = cn.g ; + n = n + } ; + noun : Str -> Str -> Gender -> Noun = + \muz,muzi,g -> { + s = table {Sg => muz ; Pl => muzi} ; + g = g + } ; + adjective : (msg,fsg,nsg,mpl,fpl,npl : Str) -> Adjective = + \msg,fsg,nsg,mpl,fpl,npl -> { + s = table { + Masc => table {Sg => msg ; Pl => mpl} ; + Fem => table {Sg => fsg ; Pl => fpl} ; + Neutr => table {Sg => nsg ; Pl => npl} + } + } ; + regAdj : Str -> Adjective = + \mlad -> + adjective (mlad+"ý") (mlad+"á") (mlad+"é") + (mlad+"é") (mlad+"é") (mlad+"á") ; + regnfAdj : Str -> Adjective = + \vynikajici -> + adjective vynikajici vynikajici vynikajici + vynikajici vynikajici vynikajici; + copula : Number => Str = + table {Sg => "je" ; Pl => "jsou"} ; +} + diff --git a/samples/Grammatical Framework/transFoodsHin.gf b/samples/Grammatical Framework/transFoodsHin.gf new file mode 100644 index 00000000..21d1d2ac --- /dev/null +++ b/samples/Grammatical Framework/transFoodsHin.gf @@ -0,0 +1,75 @@ +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsHin of Foods = { + + flags coding=utf8 ; + + param + Gender = Masc | Fem ; + Number = Sg | Pl ; + lincat + Comment = {s : Str} ; + Item = {s : Str ; g : Gender ; n : Number} ; + Kind = {s : Number => Str ; g : Gender} ; + Quality = {s : Gender => Number => Str} ; + lin + Pred item quality = { + s = item.s ++ quality.s ! item.g ! item.n ++ copula item.n + } ; + This kind = {s = "yah" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ; + That kind = {s = "vah" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ; + These kind = {s = "ye" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ; + Those kind = {s = "ve" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ; + Mod quality kind = { + s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ; + g = kind.g + } ; + Wine = regN "madirA" ; + Cheese = regN "panIr" ; + Fish = regN "maClI" ; + Pizza = regN "pijjA" ; + Very quality = {s = \\g,n => "bahut" ++ quality.s ! g ! n} ; + Fresh = regAdj "tAzA" ; + Warm = regAdj "garam" ; + Italian = regAdj "i-t.alI" ; + Expensive = regAdj "mahaNgA" ; + Delicious = regAdj "rucikar" ; + Boring = regAdj "pEriyA" ; + + oper + mkN : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = + \s,p,g -> { + s = table { + Sg => s ; + Pl => p + } ; + g = g + } ; + + regN : Str -> {s : Number => Str ; g : Gender} = \s -> case s of { + lark + "A" => mkN s (lark + "e") Masc ; + lark + "I" => mkN s (lark + "iyaM") Fem ; + _ => mkN s s Masc + } ; + + mkAdj : Str -> Str -> Str -> {s : Gender => Number => Str} = \ms,mp,f -> { + s = table { + Masc => table { + Sg => ms ; + Pl => mp + } ; + Fem => \\_ => f + } + } ; + + regAdj : Str -> {s : Gender => Number => Str} = \a -> case a of { + acch + "A" => mkAdj a (acch + "e") (acch + "I") ; + _ => mkAdj a a a + } ; + + copula : Number -> Str = \n -> case n of { + Sg => "hE" ; + Pl => "hEN" + } ; + + } diff --git a/samples/Groovy/script.gvy b/samples/Groovy/script.gvy new file mode 100644 index 00000000..25ef2eab --- /dev/null +++ b/samples/Groovy/script.gvy @@ -0,0 +1,2 @@ +#!/usr/bin/env groovy +println "Hello World" diff --git a/samples/Groovy/template.grt b/samples/Groovy/template.grt new file mode 100644 index 00000000..59bb9c22 --- /dev/null +++ b/samples/Groovy/template.grt @@ -0,0 +1,9 @@ +html { + head { + component "bootstrap" + title "Bootstrap Template" + } + + html { + } +} diff --git a/samples/Groovy/template.gtpl b/samples/Groovy/template.gtpl new file mode 100644 index 00000000..f2e594d1 --- /dev/null +++ b/samples/Groovy/template.gtpl @@ -0,0 +1,9 @@ +html { + head { + title "Example Template" + } + + body { + p "This is a quick template example" + } +} diff --git a/samples/HTML/ApiOverviewPage.st b/samples/HTML/ApiOverviewPage.st new file mode 100644 index 00000000..4faa1935 --- /dev/null +++ b/samples/HTML/ApiOverviewPage.st @@ -0,0 +1,60 @@ + + + +$Common_meta()$ + +Android API Differences Report + + +

+ + + + + + + diff --git a/samples/HTML/pages.html b/samples/HTML/pages.html new file mode 100644 index 00000000..e068e4fa --- /dev/null +++ b/samples/HTML/pages.html @@ -0,0 +1,31 @@ + + + + +Related Pages + + + + + + +
+
+
Related Pages
+
+
+
Here is a list of all related documentation pages:
+
+ + + diff --git a/samples/Haskell/Hello.hs b/samples/Haskell/Hello.hs new file mode 100644 index 00000000..cef0b4a9 --- /dev/null +++ b/samples/Haskell/Hello.hs @@ -0,0 +1,6 @@ +import Data.Char + +main :: IO () +main = do + let hello = "hello world" + putStrLn $ map toUpper hello \ No newline at end of file diff --git a/samples/Haskell/Main.hs b/samples/Haskell/Main.hs new file mode 100644 index 00000000..4a37a8c0 --- /dev/null +++ b/samples/Haskell/Main.hs @@ -0,0 +1,33 @@ +module Main where + +import Sudoku +import Data.Maybe + + +sudoku :: Sudoku +sudoku = [8, 0, 1, 3, 4, 0, 0, 0, 0, + 4, 3, 0, 8, 0, 0, 1, 0, 7, + 0, 0, 0, 0, 6, 0, 0, 0, 3, + 2, 0, 8, 0, 5, 0, 0, 0, 9, + 0, 0, 9, 0, 0, 0, 7, 0, 0, + 6, 0, 0, 0, 7, 0, 8, 0, 4, + 3, 0, 0, 0, 1, 0, 0, 0, 0, + 1, 0, 5, 0, 0, 6, 0, 4, 2, + 0, 0, 0, 0, 2, 4, 3, 0, 8] + +{- +sudoku :: Sudoku +sudoku = [8, 6, 1, 3, 4, 7, 2, 9, 5, + 4, 3, 2, 8, 9, 5, 1, 6, 7, + 9, 5, 7, 1, 6, 2, 4, 8, 3, + 2, 7, 8, 4, 5, 1, 6, 3, 9, + 5, 4, 9, 6, 8, 3, 7, 2, 1, + 6, 1, 3, 2, 7, 9, 8, 5, 4, + 3, 2, 4, 9, 1, 8, 5, 7, 6, + 1, 8, 5, 7, 3, 6, 9, 4, 2, + 7, 9, 6, 5, 2, 4, 3, 1, 8] +-} +main :: IO () +main = do + putStrLn $ pPrint sudoku ++ "\n\n" + putStrLn $ pPrint $ fromMaybe [] $ solve sudoku \ No newline at end of file diff --git a/samples/Haskell/Sudoku.hs b/samples/Haskell/Sudoku.hs new file mode 100644 index 00000000..ca6122e3 --- /dev/null +++ b/samples/Haskell/Sudoku.hs @@ -0,0 +1,46 @@ +module Sudoku +( + Sudoku, + solve, + isSolved, + pPrint +) where + +import Data.Maybe +import Data.List +import Data.List.Split + +type Sudoku = [Int] + +solve :: Sudoku -> Maybe Sudoku +solve sudoku + | isSolved sudoku = Just sudoku + | otherwise = do + index <- elemIndex 0 sudoku + let sudokus = [nextTest sudoku index i | i <- [1..9], + checkRow (nextTest sudoku index i) index, + checkColumn (nextTest sudoku index i) index, + checkBox (nextTest sudoku index i) index] + listToMaybe $ mapMaybe solve sudokus + where nextTest sudoku index i = take index sudoku ++ [i] ++ drop (index+1) sudoku + checkRow sudoku index = (length $ getRow sudoku index) == (length $ nub $ getRow sudoku index) + checkColumn sudoku index = (length $ getColumn sudoku index) == (length $ nub $ getColumn sudoku index) + checkBox sudoku index = (length $ getBox sudoku index) == (length $ nub $ getBox sudoku index) + getRow sudoku index = filter (/=0) $ (chunksOf 9 sudoku) !! (quot index 9) + getColumn sudoku index = filter (/=0) $ (transpose $ chunksOf 9 sudoku) !! (mod index 9) + getBox sudoku index = filter (/=0) $ (map concat $ concatMap transpose $ chunksOf 3 $ map (chunksOf 3) $ chunksOf 9 sudoku) + !! (3 * (quot index 27) + (quot (mod index 9) 3)) + +isSolved :: Sudoku -> Bool +isSolved sudoku + | product sudoku == 0 = False + | map (length . nub) sudokuRows /= map length sudokuRows = False + | map (length . nub) sudokuColumns /= map length sudokuColumns = False + | map (length . nub) sudokuBoxes /= map length sudokuBoxes = False + | otherwise = True + where sudokuRows = chunksOf 9 sudoku + sudokuColumns = transpose sudokuRows + sudokuBoxes = map concat $ concatMap transpose $ chunksOf 3 $ map (chunksOf 3) $ chunksOf 9 sudoku + +pPrint :: Sudoku -> String +pPrint sudoku = intercalate "\n" $ map (intercalate " " . map show) $ chunksOf 9 sudoku \ No newline at end of file diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x new file mode 100644 index 00000000..1aae1b85 --- /dev/null +++ b/samples/Inform 7/Trivial Extension.i7x @@ -0,0 +1,6 @@ +Version 1 of Trivial Extension by Andrew Plotkin begins here. + +A cow is a kind of animal. A cow can be purple. + +Trivial Extension ends here. + diff --git a/samples/Inform 7/story.ni b/samples/Inform 7/story.ni new file mode 100644 index 00000000..f8873369 --- /dev/null +++ b/samples/Inform 7/story.ni @@ -0,0 +1,12 @@ +"Test Case" by Andrew Plotkin. + +Include Trivial Extension by Andrew Plotkin. + +The Kitchen is a room. + +[This kitchen is modelled after the one in Zork, although it lacks the detail to establish this to the player.] + +A purple cow called Gelett is in the Kitchen. + +Instead of examining Gelett: + say "You'd rather see than be one." diff --git a/samples/Isabelle/HelloWorld.thy b/samples/Isabelle/HelloWorld.thy new file mode 100644 index 00000000..7c814dae --- /dev/null +++ b/samples/Isabelle/HelloWorld.thy @@ -0,0 +1,46 @@ +theory HelloWorld +imports Main +begin + +section{*Playing around with Isabelle*} + +text{* creating a lemma with the name hello_world*} +lemma hello_world: "True" by simp + +(*inspecting it*) +thm hello_world + +text{* defining a string constant HelloWorld *} + +definition HelloWorld :: "string" where + "HelloWorld \ ''Hello World!''" + +(*reversing HelloWorld twice yilds HelloWorld again*) +theorem "rev (rev HelloWorld) = HelloWorld" + by (fact List.rev_rev_ident) + +text{*now we delete the already proven List.rev_rev_ident lema and show it by hand*} +declare List.rev_rev_ident[simp del] +hide_fact List.rev_rev_ident + +(*It's trivial since we can just 'execute' it*) +corollary "rev (rev HelloWorld) = HelloWorld" + apply(simp add: HelloWorld_def) + done + +text{*does it hold in general?*} +theorem rev_rev_ident:"rev (rev l) = l" + proof(induction l) + case Nil thus ?case by simp + next + case (Cons l ls) + assume IH: "rev (rev ls) = ls" + have "rev (l#ls) = (rev ls) @ [l]" by simp + hence "rev (rev (l#ls)) = rev ((rev ls) @ [l])" by simp + also have "\ = [l] @ rev (rev ls)" by simp + finally show "rev (rev (l#ls)) = l#ls" using IH by simp + qed + +corollary "\(l::string). rev (rev l) = l" by(fastforce intro: rev_rev_ident) + +end diff --git a/samples/JSONiq/detail.jq b/samples/JSONiq/detail.jq new file mode 100644 index 00000000..9ae43f8b --- /dev/null +++ b/samples/JSONiq/detail.jq @@ -0,0 +1,9 @@ +(: Query for returning one database entry :) + +import module namespace req = "http://www.28msec.com/modules/http-request"; +import module namespace catalog = "http://guide.com/catalog"; + +variable $id := (req:param-values("id"), "London")[1]; +variable $part := (req:param-values("part"), "main")[1]; + +catalog:get-data-by-key($id, $part) diff --git a/samples/JSONiq/query.jq b/samples/JSONiq/query.jq new file mode 100644 index 00000000..d1abbaba --- /dev/null +++ b/samples/JSONiq/query.jq @@ -0,0 +1,17 @@ +(: Query for searching the database for keywords :) + +import module namespace index = "http://guide.com/index"; +import module namespace catalog = "http://guide.com/catalog"; + +import module namespace req = "http://www.28msec.com/modules/http-request"; + +variable $phrase := (req:param-values("q"), "London")[1]; +variable $limit := integer((req:param-values("limit"), 5)[1]); + +[ +for $result at $idx in index:index-search($phrase) +where $idx le $limit +let $data := catalog:get-data-by-id($result.s, $result.p) +return + {| { score : $result.r } , $data |} +] diff --git a/samples/JavaScript/intro.js.frag b/samples/JavaScript/intro.js.frag new file mode 100644 index 00000000..a4e06b08 --- /dev/null +++ b/samples/JavaScript/intro.js.frag @@ -0,0 +1,7 @@ +(function(window, angular) { + +Array.prototype.last = function() { + return this[this.length-1]; +}; + +var app = angular.module('ConwayGameOfLife', []); diff --git a/samples/JavaScript/outro.js.frag b/samples/JavaScript/outro.js.frag new file mode 100644 index 00000000..8634f6ed --- /dev/null +++ b/samples/JavaScript/outro.js.frag @@ -0,0 +1,3 @@ + +})(window, window.angular); + diff --git a/samples/Kit/demo.kit b/samples/Kit/demo.kit new file mode 100644 index 00000000..7c948f16 --- /dev/null +++ b/samples/Kit/demo.kit @@ -0,0 +1,8 @@ + + +
+

+

+ +

+
\ No newline at end of file diff --git a/samples/Latte/layout.latte b/samples/Latte/layout.latte new file mode 100644 index 00000000..5e94975f --- /dev/null +++ b/samples/Latte/layout.latte @@ -0,0 +1,59 @@ +{** + * @param string $basePath web base path + * @param string $robots tell robots how to index the content of a page (optional) + * @param array $flashes flash messages + *} + + + + + + + + + + + {ifset $title}{$title} › {/ifset}Translation report + + + + + + + {block #head}{/block} + + + + + + {block #navbar} + {include _navbar.latte} + {/block} + +
+
+
+ {include _flash.latte, flash => $flash} +
+
+ + {include #content} +
+ +
+
+ + + {block #scripts}{/block} + + diff --git a/samples/Latte/template.latte b/samples/Latte/template.latte new file mode 100644 index 00000000..1718045a --- /dev/null +++ b/samples/Latte/template.latte @@ -0,0 +1,243 @@ +{var $title => "⚐ {$new->title}"} +{define author} + + + {$author->name|trim} + + + {$author->estimatedTimeTranslated|secondsToTime}{* + *}{if $author->joined}, {/if} + {if $author->joined}joined {$author->joined|timeAgo}{/if}{* + *}{ifset $postfix}, {$postfix}{/ifset} +{/define} +{block #scripts} + +{/block} +{block #content} + +{if isset($old)} +

Diffing revision #{$old->revision} and #{$new->revision}

+{else} +

First revision

+{/if} + +{var $editor = $user->loggedIn && $new->language === 'cs'} +{var $rev = $new->video->siteRevision} +
+
+

+ published {$new->publishedAt|timeAgo}{* + *}{ifset $old}, + + {$new->textChange * 100|number} % text change{* + *}{* + *}{if $new->timeChange}, + + {$new->timeChange * 100|number} % timing change + + {/if} + {/ifset} +

+ {cache $new->id, expires => '+4 hours'} +

+ {if isset($old) && $old->author->name !== $new->author->name} + {include author, author => $old->author, class => 'author-old'} + — + {include author, author => $new->author, class => 'author-new'} + {elseif isset($old)} + {include author, author => $new->author, class => 'author-new', postfix => 'authored both revisions'} + {else} + {include author, author => $new->author, class => 'author-new'} + {/if} +

+ {/cache} + + {var $threshold = 10} + {cache $new->id} + {var $done = $new->timeTranslated} + {var $outOf = $new->video->canonicalTimeTranslated} + {if $outOf} +

+ Only {$done|time} translated out of {$outOf|time}, + {(1-$done/$outOf) * 100|number} % ({$outOf - $done|time}) left +

+

+ Seems complete: {$done|time} translated out of {$outOf|time} +

+ {elseif $done} +

+ Although {$done|time} is translated, there are no English subtitles for comparison. +

+ {/if} + {/cache} + + {if $editor} + {var $ksid = $new->video->siteId} + {if $ksid} + + Video on khanovaskola.cz + {if $new->revision === $rev} + (on this revision) + {elseif $new->revision > $rev} + (on older revision #{$rev}) + {else} + (on newer revision #{$rev}) + {/if} + + {/if} + {/if} + +

{$diffs->title|noescape}

+
{$diffs->description|noescape}
+
+
+ {$line->text|noescape}  +
+
+ + + +
+
+ + {if $editor} + {if $new->approved} + + Revision has been approved{if $new->editor} by {$new->editor->name}{/if}. + + + + Edit on Amara + + + on Khan Academy + + + {elseif $new->incomplete} + + Revision has been marked as incomplete by {if $new->editor}{$new->editor->name}{/if}. + + {include editButton} + {include kaButton} + + {* else $new->status === UNSET: *} + {elseif $new->video->siteId} + + {include kaButton} + + {else} + + {include kaButton} +
+
Filed under category:
+ {foreach $new->video->categories as $list} + — {$list|implode:' › '}{sep}
{/sep} + {/foreach} +
+ {/if} + {/if} +
+
+

All revisions:

+ + {foreach $new->video->getRevisionsIn($new->language) as $revision} + + + + + + + {if $user->loggedIn && $revision->comments->count()} + + + + {/if} + {if $user->loggedIn && $new->id === $revision->id} + + + + {/if} + + {/foreach} +
+ #{$revision->revision} + + + + {$revision->author->name} + + + + {$revision->publishedAt|timeAgo} + + + {* vars $outOf, $threshold already set *} + {default $outOf = $new->video->canonicalTimeTranslated} + {if $outOf} {* ignore if canonical time not set *} + {var $done = $revision->timeTranslated} + + {$done/$outOf * 100|number} % + + + ~100 % + + {/if} + + {if $revision->incomplete || $revision->approved} + {var $i = $revision->incomplete} + + {if $i}incomplete{else}approved{/if} + + {/if} +
+ + + + + +
+ + {$comment->user->name}: + + + + {$comment->text} + +
+
+ {form commentForm} +
+ {input text, class => "form-control", placeholder => "Comment this revision (only visible to other editors)"} + + + +
+ {/form} +
+ +
+
diff --git a/samples/Liquid/layout.liquid b/samples/Liquid/layout.liquid new file mode 100644 index 00000000..7954c7ec --- /dev/null +++ b/samples/Liquid/layout.liquid @@ -0,0 +1,104 @@ + + + + + + {{shop.name}} - {{page_title}} + + {{ 'textile.css' | global_asset_url | stylesheet_tag }} + {{ 'lightbox/v204/lightbox.css' | global_asset_url | stylesheet_tag }} + + {{ 'prototype/1.6/prototype.js' | global_asset_url | script_tag }} + {{ 'scriptaculous/1.8.2/scriptaculous.js' | global_asset_url | script_tag }} + {{ 'lightbox/v204/lightbox.js' | global_asset_url | script_tag }} + {{ 'option_selection.js' | shopify_asset_url | script_tag }} + + {{ 'layout.css' | asset_url | stylesheet_tag }} + {{ 'shop.js' | asset_url | script_tag }} + + {{ content_for_header }} + + + + +

Skip to navigation.

+ + {% if cart.item_count > 0 %} + + {% endif %} + +
+ +
+
+ +
+
+ {{ content_for_layout }} +
+
+ +
+
+ + + + {% if tags %} + + {% endif %} + + + +
+ +

+ + + +
+
+ +
+ + + + diff --git a/samples/Liquid/template.liquid b/samples/Liquid/template.liquid new file mode 100644 index 00000000..5502c2e7 --- /dev/null +++ b/samples/Liquid/template.liquid @@ -0,0 +1,70 @@ +

We have wonderful products!

+
    +
    +
    + {% for image in product.images %} + {% if forloop.first %} + + {{product.title | escape }} + + {% else %} + + {{product.title | escape }} + + {% endif %} + {% endfor %} +
    + +

    {{ product.title }}

    + +
      +
    • Vendor: {{ product.vendor | link_to_vendor }}
    • +
    • Type: {{ product.type | link_to_type }}
    • +
    + + {{ product.price_min | money }}{% if product.price_varies %} - {{ product.price_max | money }}{% endif %} + +
    +
    + + + +
    + +
    +
    +
    + +
    + {{ product.description }} +
    +
    + + +
diff --git a/samples/M/Comment.m b/samples/M/Comment.m new file mode 100644 index 00000000..6ddd7653 --- /dev/null +++ b/samples/M/Comment.m @@ -0,0 +1,36 @@ +Comment ; + ; this is a comment block + ; comments always start with a semicolon + ; the next line, while not a comment, is a legal blank line + + ;whitespace alone is a valid line in a routine + ;** Comments can have any graphic character, but no "control" + ;** characters + + ;graphic characters such as: !@#$%^&*()_+=-{}[]|\:"?/>.<, + ;the space character is considered a graphic character, even + ;though you can't see it. + ; ASCII characters whose numeric code is above 128 and below 32 + ; are NOT allowed on a line in a routine. + ;; multiple semicolons are okay + ; a line that has a tag must have whitespace after the tag, bug + ; does not have to have a comment or a command on it +Tag1 + ; + ;Tags can start with % or an uppercase or lowercase alphabetic + ; or can be a series of numeric characters +%HELO ; + ; +0123 ; + ; +%987 ; + ; the most common label is uppercase alphabetic +LABEL ; + ; + ; Tags can be followed directly by an open parenthesis and a + ; formal list of variables, and a close parenthesis +ANOTHER(X) ; + ; + ;Normally, a subroutine would be ended by a QUIT command, but we + ; are taking advantage of the rule that the END of routine is an + ; implicit QUIT diff --git a/samples/MTML/categories_to_columns.mtml b/samples/MTML/categories_to_columns.mtml new file mode 100644 index 00000000..a46c0674 --- /dev/null +++ b/samples/MTML/categories_to_columns.mtml @@ -0,0 +1,35 @@ +<$mt:Var name="num_cols" value="6"$> +<$mt:Var name="index" value="0"$> + + <$mt:Var name="index" op="++" setvar="index"$> + + <$mt:CategoryLabel remove_html="1"$> + + +<$mt:Var name="categories" function="count" setvar="cat_count"$> +<$mt:Var name="cat_count" op="%" value="$num_cols" setvar="modulus"$> + + <$mt:Var name="cat_count" op="-" value="$modulus" setvar="cat_count_minus_mod"$> + <$mt:Var name="cat_count_minus_mod" op="/" value="$num_cols" setvar="cats_per_col"$> + <$mt:Var name="cats_per_col" op="+" value="1" setvar="cats_per_col"$> + + <$mt:Var name="cat_count" op="/" value="$num_cols" setvar="cats_per_col"$> + + + <$mt:Var name="index" op="++" setvar="index"$> + + <$mt:Var name="categories{$index}"$> + + + +<$mt:Var name="index" value="0"$> +<$mt:Var name="col_num" value="1"$> + +
"> + + <$mt:Var name="for_inner"$> + +
+ <$mt:Var name="col_num" op="++" setvar="col_num"$> +
+ diff --git a/samples/Mathematica/Init.m b/samples/Mathematica/Init.m new file mode 100644 index 00000000..720d6100 --- /dev/null +++ b/samples/Mathematica/Init.m @@ -0,0 +1,3 @@ +(* Mathematica Init File *) + +Get[ "Foobar`Foobar`"] diff --git a/samples/Mathematica/PacletInfo.m b/samples/Mathematica/PacletInfo.m new file mode 100644 index 00000000..489b58c7 --- /dev/null +++ b/samples/Mathematica/PacletInfo.m @@ -0,0 +1,17 @@ +(* Paclet Info File *) + +(* created 2014/02/07*) + +Paclet[ + Name -> "Foobar", + Version -> "0.0.1", + MathematicaVersion -> "8+", + Description -> "Example of an automatically generated PacletInfo file.", + Creator -> "Chris Granade", + Extensions -> + { + {"Documentation", Language -> "English", MainPage -> "Guides/Foobar"} + } +] + + diff --git a/samples/Mathematica/Predicates.m b/samples/Mathematica/Predicates.m new file mode 100644 index 00000000..3c569691 --- /dev/null +++ b/samples/Mathematica/Predicates.m @@ -0,0 +1,150 @@ +(* ::Package:: *) + +BeginPackage["Predicates`"]; + + +(* ::Title:: *) +(*Predicates*) + + +(* ::Section::Closed:: *) +(*Fuzzy Logic*) + + +(* ::Subsection:: *) +(*Documentation*) + + +PossiblyTrueQ::usage="Returns True if the argument is not definitely False."; +PossiblyFalseQ::usage="Returns True if the argument is not definitely True."; +PossiblyNonzeroQ::usage="Returns True if and only if its argument is not definitely zero."; + + +(* ::Subsection:: *) +(*Implimentation*) + + +Begin["`Private`"]; + + +PossiblyTrueQ[expr_]:=\[Not]TrueQ[\[Not]expr] + + +PossiblyFalseQ[expr_]:=\[Not]TrueQ[expr] + + +End[]; + + +(* ::Section::Closed:: *) +(*Numbers and Lists*) + + +(* ::Subsection:: *) +(*Documentation*) + + +AnyQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for at least one element of the list."; +AnyElementQ::usage="Returns True if cond matches any element of L."; +AllQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for all elements of the list."; +AllElementQ::usage="Returns True if cond matches any element of L."; + + +AnyNonzeroQ::usage="Returns True if L is a list such that at least one element is definitely not zero."; +AnyPossiblyNonzeroQ::usage="Returns True if expr is a list such that at least one element is not definitely zero."; + + +RealQ::usage="Returns True if and only if the argument is a real number"; +PositiveQ::usage="Returns True if and only if the argument is a positive real number"; +NonnegativeQ::usage="Returns True if and only if the argument is a non-negative real number"; +PositiveIntegerQ::usage="Returns True if and only if the argument is a positive integer"; +NonnegativeIntegerQ::usage="Returns True if and only if the argument is a non-negative integer"; + + +IntegerListQ::usage="Returns True if and only if the input is a list of integers."; +PositiveIntegerListQ::usage="Returns True if and only if the input is a list of positive integers."; +NonnegativeIntegerListQ::usage="Returns True if and only if the input is a list of non-negative integers."; +IntegerOrListQ::usage="Returns True if and only if the input is a list of integers or an integer."; +PositiveIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer."; +NonnegativeIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer."; + + +SymbolQ::usage="Returns True if argument is an unassigned symbol."; +SymbolOrNumberQ::usage="Returns True if argument is a number of has head 'Symbol'"; + + +(* ::Subsection:: *) +(*Implimentation*) + + +Begin["`Private`"]; + + +AnyQ[cond_, L_] := Fold[Or, False, cond /@ L] + + +AnyElementQ[cond_,L_]:=AnyQ[cond,Flatten[L]] + + +AllQ[cond_, L_] := Fold[And, True, cond /@ L] + + +AllElementQ[cond_, L_] := Fold[And, True, cond /@ L] + + +AnyNonzeroQ[L_]:=AnyElementQ[#!=0&,L] + + +PossiblyNonzeroQ[expr_]:=PossiblyTrueQ[expr!=0] + + +AnyPossiblyNonzeroQ[expr_]:=AnyElementQ[PossiblyNonzeroQ,expr] + + +RealQ[n_]:=TrueQ[Im[n]==0]; + + +PositiveQ[n_]:=Positive[n]; + + +PositiveIntegerQ[n_]:=PositiveQ[n]\[And]IntegerQ[n]; + + +NonnegativeQ[n_]:=TrueQ[RealQ[n]&&n>=0]; + + +NonnegativeIntegerQ[n_]:=NonnegativeQ[n]\[And]IntegerQ[n]; + + +IntegerListQ[input_]:=ListQ[input]&&Not[MemberQ[IntegerQ/@input,False]]; + + +IntegerOrListQ[input_]:=IntegerListQ[input]||IntegerQ[input]; + + +PositiveIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[Positive[input],False]]; + + +PositiveIntegerOrListQ[input_]:=PositiveIntegerListQ[input]||PositiveIntegerQ[input]; + + +NonnegativeIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[NonnegativeIntegerQ[input],False]]; + + +NonnegativeIntegerOrListQ[input_]:=NonnegativeIntegerListQ[input]||NonnegativeIntegerQ[input]; + + +SymbolQ[a_]:=Head[a]===Symbol; + + +SymbolOrNumberQ[a_]:=NumericQ[a]||Head[a]===Symbol; + + +End[]; + + +(* ::Section:: *) +(*Epilogue*) + + +EndPackage[]; diff --git a/samples/Mercury/code_info.m b/samples/Mercury/code_info.m new file mode 100644 index 00000000..59f8eee4 --- /dev/null +++ b/samples/Mercury/code_info.m @@ -0,0 +1,4843 @@ +%---------------------------------------------------------------------------% +% vim: ft=mercury ts=4 sw=4 et +%---------------------------------------------------------------------------% +% Copyright (C) 1994-2012 The University of Melbourne. +% This file may only be copied under the terms of the GNU General +% Public License - see the file COPYING in the Mercury distribution. +%---------------------------------------------------------------------------% +% +% File: code_info.m. +% Main authors: conway, zs. +% +% This file defines the code_info type and various operations on it. +% The code_info structure is the 'state' of the code generator. +% +% This file is organized into ten submodules: +% +% - the code_info structure and its access predicates +% - simple wrappers around access predicates +% - handling branched control structures +% - handling failure continuations +% - handling liveness issues +% - saving and restoring heap pointers, trail tickets etc +% - interfacing to var_locn +% - managing the info required by garbage collection and value numbering +% - managing stack slots +% - support for debugging the code generator itself. +% +%---------------------------------------------------------------------------% + +:- module ll_backend.code_info. +:- interface. + +:- import_module check_hlds.type_util. +:- import_module hlds.code_model. +:- import_module hlds.hlds_data. +:- import_module hlds.hlds_goal. +:- import_module hlds.hlds_llds. +:- import_module hlds.hlds_module. +:- import_module hlds.hlds_pred. +:- import_module hlds.instmap. +:- import_module libs.globals. +:- import_module ll_backend.continuation_info. +:- import_module ll_backend.global_data. +:- import_module ll_backend.layout. +:- import_module ll_backend.llds. +:- import_module ll_backend.trace_gen. +:- import_module mdbcomp.prim_data. +:- import_module mdbcomp.goal_path. +:- import_module parse_tree.prog_data. +:- import_module parse_tree.set_of_var. + +:- import_module assoc_list. +:- import_module bool. +:- import_module counter. +:- import_module io. +:- import_module list. +:- import_module map. +:- import_module maybe. +:- import_module set. +:- import_module set_tree234. +:- import_module term. + +%----------------------------------------------------------------------------% +%----------------------------------------------------------------------------% + +:- implementation. + +:- import_module backend_libs.builtin_ops. +:- import_module backend_libs.proc_label. +:- import_module hlds.arg_info. +:- import_module hlds.hlds_desc. +:- import_module hlds.hlds_rtti. +:- import_module libs.options. +:- import_module libs.trace_params. +:- import_module ll_backend.code_util. +:- import_module ll_backend.opt_debug. +:- import_module ll_backend.var_locn. +:- import_module parse_tree.builtin_lib_types. +:- import_module parse_tree.prog_type. +:- import_module parse_tree.mercury_to_mercury. + +:- import_module cord. +:- import_module int. +:- import_module pair. +:- import_module require. +:- import_module set. +:- import_module stack. +:- import_module string. +:- import_module varset. + +%---------------------------------------------------------------------------% + + % Submodule for the code_info type and its access predicates. + % + % This submodule has the following components: + % + % declarations for exported access predicates + % declarations for non-exported access predicates + % the definition of the type and the init predicate + % the definition of the get access predicates + % the definition of the set access predicates + % + % Please keep the order of mention of the various fields + % consistent in each of these five components. + +:- interface. + +:- type code_info. + + % Create a new code_info structure. Also return the + % outermost resumption point, and info about the non-fixed + % stack slots used for tracing purposes. + % +:- pred code_info_init(bool::in, globals::in, pred_id::in, proc_id::in, + pred_info::in, proc_info::in, abs_follow_vars::in, module_info::in, + static_cell_info::in, const_struct_map::in, resume_point_info::out, + trace_slot_info::out, maybe(containing_goal_map)::in, + list(string)::in, int::in, code_info::out) is det. + + % Get the globals table. + % +:- pred get_globals(code_info::in, globals::out) is det. + + % Get the exprn_opts. + % +:- pred get_exprn_opts(code_info::in, exprn_opts::out) is det. + + % Get the HLDS of the entire module. + % +:- pred get_module_info(code_info::in, module_info::out) is det. + + % Get the id of the predicate we are generating code for. + % +:- pred get_pred_id(code_info::in, pred_id::out) is det. + + % Get the id of the procedure we are generating code for. + % +:- pred get_proc_id(code_info::in, proc_id::out) is det. + + % Get the HLDS of the predicate containing the procedure + % we are generating code for. + % +:- pred get_pred_info(code_info::in, pred_info::out) is det. + + % Get the HLDS of the procedure we are generating code for. + % +:- pred get_proc_info(code_info::in, proc_info::out) is det. + + % Get the variables for the current procedure. + % +:- pred get_varset(code_info::in, prog_varset::out) is det. + +:- func get_var_types(code_info) = vartypes. + +:- pred get_maybe_trace_info(code_info::in, maybe(trace_info)::out) is det. + +:- pred get_emit_trail_ops(code_info::in, add_trail_ops::out) is det. + +:- pred get_emit_region_ops(code_info::in, add_region_ops::out) is det. + + % Get the set of currently forward-live variables. + % +:- pred get_forward_live_vars(code_info::in, set_of_progvar::out) is det. + + % Set the set of currently forward-live variables. + % +:- pred set_forward_live_vars(set_of_progvar::in, + code_info::in, code_info::out) is det. + + % Get the table mapping variables to the current + % instantiation states. + % +:- pred get_instmap(code_info::in, instmap::out) is det. + + % Set the table mapping variables to the current + % instantiation states. + % +:- pred set_instmap(instmap::in, code_info::in, code_info::out) is det. + + % Get the current nesting depth for parallel conjunctions. + % +:- pred get_par_conj_depth(code_info::in, int::out) is det. + + % Set the current nesting depth for parallel conjunctions. + % +:- pred set_par_conj_depth(int::in, code_info::in, code_info::out) is det. + + % The number of the last local label allocated. + % +:- pred get_label_counter(code_info::in, counter::out) is det. + + % Get the flag that indicates whether succip is used or not. + % +:- pred get_succip_used(code_info::in, bool::out) is det. + + % Get the label layout information created by tracing + % during code generation. + % +:- pred get_layout_info(code_info::in, proc_label_layout_info::out) is det. + +:- pred get_proc_trace_events(code_info::in, bool::out) is det. + +:- pred set_proc_trace_events(bool::in, code_info::in, code_info::out) is det. + + % Get the global static data structures that have + % been created during code generation for closure layouts. + % +:- pred get_closure_layouts(code_info::in, list(closure_proc_id_data)::out) + is det. + +:- pred get_max_reg_in_use_at_trace(code_info::in, int::out, int::out) is det. + +:- pred set_max_reg_in_use_at_trace(int::in, int::in, + code_info::in, code_info::out) is det. + + % Get the flag which is true iff the procedure has so far + % emitted code that creates a temporary nondet stack frame. + % +:- pred get_created_temp_frame(code_info::in, bool::out) is det. + +:- pred get_static_cell_info(code_info::in, static_cell_info::out) is det. + +:- pred set_static_cell_info(static_cell_info::in, + code_info::in, code_info::out) is det. + +:- pred get_alloc_sites(code_info::in, set_tree234(alloc_site_info)::out) + is det. + +:- pred set_alloc_sites(set_tree234(alloc_site_info)::in, + code_info::in, code_info::out) is det. + +:- pred get_used_env_vars(code_info::in, set(string)::out) is det. + +:- pred set_used_env_vars(set(string)::in, code_info::in, code_info::out) + is det. + +:- pred get_opt_trail_ops(code_info::in, bool::out) is det. + +:- pred get_opt_region_ops(code_info::in, bool::out) is det. + +:- pred get_auto_comments(code_info::in, bool::out) is det. + +:- pred get_lcmc_null(code_info::in, bool::out) is det. + +:- pred get_containing_goal_map(code_info::in, maybe(containing_goal_map)::out) + is det. + +:- pred get_containing_goal_map_det(code_info::in, containing_goal_map::out) + is det. + +:- pred get_const_struct_map(code_info::in, const_struct_map::out) is det. + +:- pred add_out_of_line_code(llds_code::in, code_info::in, code_info::out) + is det. + +:- pred get_out_of_line_code(code_info::in, llds_code::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + +:- pred get_var_slot_count(code_info::in, int::out) is det. + +:- pred set_maybe_trace_info(maybe(trace_info)::in, + code_info::in, code_info::out) is det. + +:- pred get_opt_no_return_calls(code_info::in, bool::out) is det. + +:- pred get_zombies(code_info::in, set_of_progvar::out) is det. + +:- pred set_zombies(set_of_progvar::in, code_info::in, code_info::out) is det. + +:- pred get_var_locn_info(code_info::in, var_locn_info::out) is det. + +:- pred set_var_locn_info(var_locn_info::in, + code_info::in, code_info::out) is det. + +:- pred get_temps_in_use(code_info::in, set(lval)::out) is det. + +:- pred set_temps_in_use(set(lval)::in, code_info::in, code_info::out) is det. + +:- pred get_fail_info(code_info::in, fail_info::out) is det. + +:- pred set_fail_info(fail_info::in, code_info::in, code_info::out) is det. + +:- pred set_label_counter(counter::in, code_info::in, code_info::out) is det. + +:- pred set_succip_used(bool::in, code_info::in, code_info::out) is det. + +:- pred set_layout_info(proc_label_layout_info::in, + code_info::in, code_info::out) is det. + +:- pred get_max_temp_slot_count(code_info::in, int::out) is det. + +:- pred set_max_temp_slot_count(int::in, code_info::in, code_info::out) is det. + +:- pred get_temp_content_map(code_info::in, + map(lval, slot_contents)::out) is det. + +:- pred set_temp_content_map(map(lval, slot_contents)::in, + code_info::in, code_info::out) is det. + +:- pred get_persistent_temps(code_info::in, set(lval)::out) is det. + +:- pred set_persistent_temps(set(lval)::in, + code_info::in, code_info::out) is det. + +:- pred set_closure_layouts(list(closure_proc_id_data)::in, + code_info::in, code_info::out) is det. + +:- pred get_closure_seq_counter(code_info::in, counter::out) is det. + +:- pred set_closure_seq_counter(counter::in, + code_info::in, code_info::out) is det. + +:- pred set_created_temp_frame(bool::in, code_info::in, code_info::out) is det. + +%---------------------------------------------------------------------------% + + % The code_info structure has three groups of fields. + % + % Some fields are static; they are set when the code_info structure + % is initialized, and never changed afterwards. + % + % Some fields record information about the state of the code generator + % at a particular location in the HLDS code of the current procedure. + % At the start of the branched control structure, the code generator + % remembers the values of these fields, and starts generating code + % for each branch from the same location-dependent state. + % + % Some fields record persistent information that does not depend + % on a code location. Updates to these fields must remain effective + % even when the code generator resets its location-dependent state. + +:- type code_info + ---> code_info( + code_info_static :: code_info_static, + code_info_loc_dep :: code_info_loc_dep, + code_info_persistent :: code_info_persistent + ). + +:- type code_info_static + ---> code_info_static( + % For the code generation options. + cis_globals :: globals, + cis_exprn_opts :: exprn_opts, + + % The module_info structure - you just never know + % when you might need it. + cis_module_info :: module_info, + + % The id of the current predicate. + cis_pred_id :: pred_id, + + % The id of the current procedure. + cis_proc_id :: proc_id, + + % The pred_info for the predicate containing this procedure. + cis_pred_info :: pred_info, + + % The proc_info for this procedure. + cis_proc_info :: proc_info, + + % The proc_label for this procedure. + cis_proc_label :: proc_label, + + % The variables in this procedure. + cis_varset :: prog_varset, + + % The number of stack slots allocated. for storing variables. + % (Some extra stack slots are used for saving and restoring + % registers.) + cis_var_slot_count :: int, + + % Information about which stack slots the call sequence number + % and depth are stored in, provided tracing is switched on. + cis_maybe_trace_info :: maybe(trace_info), + + % Should we optimize calls that cannot return? + cis_opt_no_resume_calls :: bool, + + % Should we emit trail operations? + cis_emit_trail_ops :: add_trail_ops, + + % Should we try to avoid generating trail operations? + cis_opt_trail_ops :: bool, + + % Should we emit region operations? + cis_emit_region_ops :: add_region_ops, + + % Should we try to avoid generating region operations? + cis_opt_region_ops :: bool, + + % The setting of --auto-comments. + cis_auto_comments :: bool, + + % The setting of --optimize-constructor-last-call-null. + cis_lcmc_null :: bool, + + cis_containing_goal_map :: maybe(containing_goal_map), + + % Maps the number of an entry in the module's const_struct_db + % to its rval. + cis_const_struct_map :: const_struct_map + ). + +:- type code_info_loc_dep + ---> code_info_loc_dep( + % Variables that are forward live after this goal. + cild_forward_live_vars :: set_of_progvar, + + % Current insts of the live variables. + cild_instmap :: instmap, + + % Zombie variables; variables that are not forward live + % but which are protected by an enclosing resume point. + cild_zombies :: set_of_progvar, + + % A map storing the information about the status of each known + % variable. (Known vars = forward live vars + zombies.) + cild_var_locn_info :: var_locn_info, + + % The set of temporary locations currently in use. These lvals + % must be all be keys in the map of temporary locations ever + % used, which is one of the persistent fields below. Any keys + % in that map which are not in this set are free for reuse. + cild_temps_in_use :: set(lval), + + % Information about how to manage failures. + cild_fail_info :: fail_info, + + % How deep in a nested parallel conjunction we are. + % This is zero at the beginning of a procedure and + % is incremented as we enter parallel conjunctions. + cild_par_conj_depth :: int + ). + +:- type code_info_persistent + ---> code_info_persistent( + % Counter for the local labels used by this procedure. + cip_label_num_src :: counter, + + % do we need to store succip? + cip_store_succip :: bool, + + % Information on which values are live and where at which + % labels, for tracing and/or accurate gc. + cip_label_info :: proc_label_layout_info, + + % Did the procedure have any trace events? + cip_proc_trace_events :: bool, + + % The maximum number of extra temporary stackslots that + % have been used during the procedure. + cip_stackslot_max :: int, + + % The temporary locations that have ever been used on the + % stack, and what they contain. Once we have used a stack slot + % to store e.g. a ticket, we never reuse that slot to hold + % something else, e.g. a saved hp. This policy prevents us + % from making such conflicting choices in parallel branches, + % which would make it impossible to describe to gc what the + % slot contains after the end of the branched control + % structure. + cip_temp_contents :: map(lval, slot_contents), + + % Stack slot locations that should not be released even when + % the code generator resets its location-dependent state. + cip_persistent_temps :: set(lval), + + cip_closure_layout_seq :: counter, + + % Closure layout structures generated by this procedure. + cip_closure_layouts :: list(closure_proc_id_data), + + % At each call to MR_trace, we compute the highest rN and fN + % registers that contain useful values. These slot contain the + % maximum of these highest values. Therefore at all calls to + % MR_trace in the procedure, we need only save the registers + % whose numbers are equal to or smaller than this field. + % This slot contains -1 if tracing is not enabled. + cip_max_reg_r_used :: int, + cip_max_reg_f_used :: int, + + % True iff the procedure has created one or more temporary + % nondet frames. + cip_created_temp_frame :: bool, + + cip_static_cell_info :: static_cell_info, + + cip_alloc_sites :: set_tree234(alloc_site_info), + + cip_used_env_vars :: set(string), + + % A counter and table for allocating and maintaining slots + % where string IDs will be placed at runtime for threadscope + % profiling. The actual string IDs are allocated at runtime + % and their IDs are placed in an array slot which can be + % referred to statically. + cip_ts_string_table_size :: int, + cip_ts_rev_string_table :: list(string), + + % Code that is part of this procedure, but that can be placed + % after the procedure without a cache penalty. For example, + % code that is spawned off by loop control is placed here. + cip_out_of_line_code :: llds_code + ). + +%---------------------------------------------------------------------------% + +code_info_init(SaveSuccip, Globals, PredId, ProcId, PredInfo, ProcInfo, + FollowVars, ModuleInfo, StaticCellInfo, ConstStructMap, ResumePoint, + TraceSlotInfo, MaybeContainingGoalMap, + TSRevStringTable, TSStringTableSize, CodeInfo) :- + ProcLabel = make_proc_label(ModuleInfo, PredId, ProcId), + proc_info_get_initial_instmap(ProcInfo, ModuleInfo, InstMap), + proc_info_get_liveness_info(ProcInfo, Liveness), + CodeModel = proc_info_interface_code_model(ProcInfo), + build_input_arg_list(ProcInfo, ArgList), + proc_info_get_varset(ProcInfo, VarSet), + proc_info_get_vartypes(ProcInfo, VarTypes), + proc_info_get_stack_slots(ProcInfo, StackSlots), + ExprnOpts = init_exprn_opts(Globals), + globals.lookup_bool_option(Globals, use_float_registers, UseFloatRegs), + ( + UseFloatRegs = yes, + FloatRegType = reg_f + ; + UseFloatRegs = no, + FloatRegType = reg_r + ), + globals.get_trace_level(Globals, TraceLevel), + ( + eff_trace_level_is_none(ModuleInfo, PredInfo, ProcInfo, TraceLevel) + = no + -> + trace_fail_vars(ModuleInfo, ProcInfo, FailVars), + MaybeFailVars = yes(FailVars), + set_of_var.union(Liveness, FailVars, EffLiveness) + ; + MaybeFailVars = no, + EffLiveness = Liveness + ), + init_var_locn_state(ArgList, EffLiveness, VarSet, VarTypes, FloatRegType, + StackSlots, FollowVars, VarLocnInfo), + stack.init(ResumePoints), + globals.lookup_bool_option(Globals, allow_hijacks, AllowHijack), + ( + AllowHijack = yes, + Hijack = allowed + ; + AllowHijack = no, + Hijack = not_allowed + ), + DummyFailInfo = fail_info(ResumePoints, resume_point_unknown, + may_be_different, not_inside_non_condition, Hijack), + map.init(TempContentMap), + set.init(PersistentTemps), + set.init(TempsInUse), + Zombies = set_of_var.init, + map.init(LayoutMap), + max_var_slot(StackSlots, VarSlotMax), + trace_reserved_slots(ModuleInfo, PredInfo, ProcInfo, Globals, + FixedSlots, _), + int.max(VarSlotMax, FixedSlots, SlotMax), + globals.lookup_bool_option(Globals, opt_no_return_calls, + OptNoReturnCalls), + globals.lookup_bool_option(Globals, use_trail, UseTrail), + globals.lookup_bool_option(Globals, disable_trail_ops, DisableTrailOps), + ( + UseTrail = yes, + DisableTrailOps = no + -> + EmitTrailOps = add_trail_ops + ; + EmitTrailOps = do_not_add_trail_ops + ), + globals.lookup_bool_option(Globals, optimize_trail_usage, OptTrailOps), + globals.lookup_bool_option(Globals, optimize_region_ops, OptRegionOps), + globals.lookup_bool_option(Globals, region_analysis, UseRegions), + ( + UseRegions = yes, + EmitRegionOps = add_region_ops + ; + UseRegions = no, + EmitRegionOps = do_not_add_region_ops + ), + globals.lookup_bool_option(Globals, auto_comments, AutoComments), + globals.lookup_bool_option(Globals, optimize_constructor_last_call_null, + LCMCNull), + CodeInfo0 = code_info( + code_info_static( + Globals, + ExprnOpts, + ModuleInfo, + PredId, + ProcId, + PredInfo, + ProcInfo, + ProcLabel, + VarSet, + SlotMax, + no, + OptNoReturnCalls, + EmitTrailOps, + OptTrailOps, + EmitRegionOps, + OptRegionOps, + AutoComments, + LCMCNull, + MaybeContainingGoalMap, + ConstStructMap + ), + code_info_loc_dep( + Liveness, + InstMap, + Zombies, + VarLocnInfo, + TempsInUse, + DummyFailInfo, % init_fail_info will override this dummy value + 0 % nested parallel conjunction depth + ), + code_info_persistent( + counter.init(1), + SaveSuccip, + LayoutMap, + no, + 0, + TempContentMap, + PersistentTemps, + counter.init(1), + [], + -1, + -1, + no, + StaticCellInfo, + set_tree234.init, + set.init, + TSStringTableSize, + TSRevStringTable, + cord.empty + ) + ), + init_maybe_trace_info(TraceLevel, Globals, ModuleInfo, + PredInfo, ProcInfo, TraceSlotInfo, CodeInfo0, CodeInfo1), + init_fail_info(CodeModel, MaybeFailVars, ResumePoint, + CodeInfo1, CodeInfo). + +:- func init_exprn_opts(globals) = exprn_opts. + +init_exprn_opts(Globals) = ExprnOpts :- + globals.lookup_bool_option(Globals, gcc_non_local_gotos, OptNLG), + ( + OptNLG = yes, + NLG = have_non_local_gotos + ; + OptNLG = no, + NLG = do_not_have_non_local_gotos + ), + globals.lookup_bool_option(Globals, asm_labels, OptASM), + ( + OptASM = yes, + ASM = have_asm_labels + ; + OptASM = no, + ASM = do_not_have_asm_labels + ), + globals.lookup_bool_option(Globals, static_ground_cells, OptSGCell), + ( + OptSGCell = yes, + SGCell = have_static_ground_cells + ; + OptSGCell = no, + SGCell = do_not_have_static_ground_cells + ), + globals.lookup_bool_option(Globals, unboxed_float, OptUBF), + ( + OptUBF = yes, + UBF = have_unboxed_floats + ; + OptUBF = no, + UBF = do_not_have_unboxed_floats + ), + globals.lookup_bool_option(Globals, use_float_registers, OptFloatRegs), + ( + OptFloatRegs = yes, + UseFloatRegs = use_float_registers + ; + OptFloatRegs = no, + UseFloatRegs = do_not_use_float_registers + ), + globals.lookup_bool_option(Globals, static_ground_floats, OptSGFloat), + ( + OptSGFloat = yes, + SGFloat = have_static_ground_floats + ; + OptSGFloat = no, + SGFloat = do_not_have_static_ground_floats + ), + globals.lookup_bool_option(Globals, static_code_addresses, + OptStaticCodeAddr), + ( + OptStaticCodeAddr = yes, + StaticCodeAddrs = have_static_code_addresses + ; + OptStaticCodeAddr = no, + StaticCodeAddrs = do_not_have_static_code_addresses + ), + ExprnOpts = exprn_opts(NLG, ASM, UBF, UseFloatRegs, SGCell, SGFloat, + StaticCodeAddrs). + +:- pred init_maybe_trace_info(trace_level::in, globals::in, + module_info::in, pred_info::in, proc_info::in, trace_slot_info::out, + code_info::in, code_info::out) is det. + +init_maybe_trace_info(TraceLevel, Globals, ModuleInfo, PredInfo, + ProcInfo, TraceSlotInfo, !CI) :- + ( + eff_trace_level_is_none(ModuleInfo, PredInfo, ProcInfo, TraceLevel) + = no + -> + proc_info_get_has_tail_call_events(ProcInfo, HasTailCallEvents), + ( + HasTailCallEvents = tail_call_events, + get_next_label(TailRecLabel, !CI), + MaybeTailRecLabel = yes(TailRecLabel) + ; + HasTailCallEvents = no_tail_call_events, + MaybeTailRecLabel = no + ), + trace_setup(ModuleInfo, PredInfo, ProcInfo, Globals, MaybeTailRecLabel, + TraceSlotInfo, TraceInfo, !CI), + set_maybe_trace_info(yes(TraceInfo), !CI) + ; + TraceSlotInfo = trace_slot_info(no, no, no, no, no, no) + ). + +%---------------------------------------------------------------------------% + +get_globals(CI, CI ^ code_info_static ^ cis_globals). +get_module_info(CI, CI ^ code_info_static ^ cis_module_info). +get_exprn_opts(CI, CI ^ code_info_static ^ cis_exprn_opts). +get_pred_id(CI, CI ^ code_info_static ^ cis_pred_id). +get_proc_id(CI, CI ^ code_info_static ^ cis_proc_id). +get_pred_info(CI, CI ^ code_info_static ^ cis_pred_info). +get_proc_info(CI, CI ^ code_info_static ^ cis_proc_info). +get_varset(CI, CI ^ code_info_static ^ cis_varset). +get_var_slot_count(CI, CI ^ code_info_static ^ cis_var_slot_count). +get_maybe_trace_info(CI, CI ^ code_info_static ^ cis_maybe_trace_info). +get_opt_no_return_calls(CI, CI ^ code_info_static ^ cis_opt_no_resume_calls). +get_emit_trail_ops(CI, CI ^ code_info_static ^ cis_emit_trail_ops). +get_opt_trail_ops(CI, CI ^ code_info_static ^ cis_opt_trail_ops). +get_emit_region_ops(CI, CI ^ code_info_static ^ cis_emit_region_ops). +get_opt_region_ops(CI, CI ^ code_info_static ^ cis_opt_region_ops). +get_auto_comments(CI, CI ^ code_info_static ^ cis_auto_comments). +get_lcmc_null(CI, CI ^ code_info_static ^ cis_lcmc_null). +get_containing_goal_map(CI, CI ^ code_info_static ^ cis_containing_goal_map). +get_const_struct_map(CI, CI ^ code_info_static ^ cis_const_struct_map). +get_forward_live_vars(CI, CI ^ code_info_loc_dep ^ cild_forward_live_vars). +get_instmap(CI, CI ^ code_info_loc_dep ^ cild_instmap). +get_zombies(CI, CI ^ code_info_loc_dep ^ cild_zombies). +get_var_locn_info(CI, CI ^ code_info_loc_dep ^ cild_var_locn_info). +get_temps_in_use(CI, CI ^ code_info_loc_dep ^ cild_temps_in_use). +get_fail_info(CI, CI ^ code_info_loc_dep ^ cild_fail_info). +get_par_conj_depth(CI, CI ^ code_info_loc_dep ^ cild_par_conj_depth). +get_label_counter(CI, CI ^ code_info_persistent ^ cip_label_num_src). +get_succip_used(CI, CI ^ code_info_persistent ^ cip_store_succip). +get_layout_info(CI, CI ^ code_info_persistent ^ cip_label_info). +get_proc_trace_events(CI, CI ^ code_info_persistent ^ cip_proc_trace_events). +get_max_temp_slot_count(CI, CI ^ code_info_persistent ^ cip_stackslot_max). +get_temp_content_map(CI, CI ^ code_info_persistent ^ cip_temp_contents). +get_persistent_temps(CI, CI ^ code_info_persistent ^ cip_persistent_temps). +get_closure_seq_counter(CI, + CI ^ code_info_persistent ^ cip_closure_layout_seq). +get_closure_layouts(CI, CI ^ code_info_persistent ^ cip_closure_layouts). +get_max_reg_in_use_at_trace(CI, MaxRegR, MaxRegF) :- + MaxRegR = CI ^ code_info_persistent ^ cip_max_reg_r_used, + MaxRegF = CI ^ code_info_persistent ^ cip_max_reg_f_used. +get_created_temp_frame(CI, CI ^ code_info_persistent ^ cip_created_temp_frame). +get_static_cell_info(CI, CI ^ code_info_persistent ^ cip_static_cell_info). +get_alloc_sites(CI, CI ^ code_info_persistent ^ cip_alloc_sites). +get_used_env_vars(CI, CI ^ code_info_persistent ^ cip_used_env_vars). + +%---------------------------------------------------------------------------% + +set_maybe_trace_info(TI, CI, + CI ^ code_info_static ^ cis_maybe_trace_info := TI). +set_forward_live_vars(LV, CI, + CI ^ code_info_loc_dep ^ cild_forward_live_vars := LV). +set_instmap(IM, CI, CI ^ code_info_loc_dep ^ cild_instmap := IM). +set_zombies(Zs, CI, CI ^ code_info_loc_dep ^ cild_zombies := Zs). +set_var_locn_info(EI, CI, CI ^ code_info_loc_dep ^ cild_var_locn_info := EI). +set_temps_in_use(TI, CI, CI ^ code_info_loc_dep ^ cild_temps_in_use := TI). +set_fail_info(FI, CI, CI ^ code_info_loc_dep ^ cild_fail_info := FI). +set_par_conj_depth(N, CI, CI ^ code_info_loc_dep ^ cild_par_conj_depth := N). +set_label_counter(LC, CI, CI ^ code_info_persistent ^ cip_label_num_src := LC). +set_succip_used(SU, CI, CI ^ code_info_persistent ^ cip_store_succip := SU). +set_layout_info(LI, CI, CI ^ code_info_persistent ^ cip_label_info := LI). +set_proc_trace_events(PTE, CI, + CI ^ code_info_persistent ^ cip_proc_trace_events := PTE). +set_max_temp_slot_count(TM, CI, + CI ^ code_info_persistent ^ cip_stackslot_max := TM). +set_temp_content_map(CM, CI, + CI ^ code_info_persistent ^ cip_temp_contents := CM). +set_persistent_temps(PT, CI, + CI ^ code_info_persistent ^ cip_persistent_temps := PT). +set_closure_seq_counter(CLS, CI, + CI ^ code_info_persistent ^ cip_closure_layout_seq := CLS). +set_closure_layouts(CG, CI, + CI ^ code_info_persistent ^ cip_closure_layouts := CG). +set_max_reg_in_use_at_trace(MR, MF, !CI) :- + !CI ^ code_info_persistent ^ cip_max_reg_r_used := MR, + !CI ^ code_info_persistent ^ cip_max_reg_f_used := MF. +set_created_temp_frame(MR, CI, + CI ^ code_info_persistent ^ cip_created_temp_frame := MR). +set_static_cell_info(SCI, CI, + CI ^ code_info_persistent ^ cip_static_cell_info := SCI). +set_alloc_sites(ASI, CI, + CI ^ code_info_persistent ^ cip_alloc_sites := ASI). +set_used_env_vars(UEV, CI, + CI ^ code_info_persistent ^ cip_used_env_vars := UEV). + +get_containing_goal_map_det(CI, ContainingGoalMap) :- + get_containing_goal_map(CI, MaybeContainingGoalMap), + ( + MaybeContainingGoalMap = yes(ContainingGoalMap) + ; + MaybeContainingGoalMap = no, + unexpected($module, $pred, "no map") + ). + +add_out_of_line_code(NewCode, !CI) :- + Code0 = !.CI ^ code_info_persistent ^ cip_out_of_line_code, + Code = Code0 ++ NewCode, + !CI ^ code_info_persistent ^ cip_out_of_line_code := Code. + +get_out_of_line_code(CI, CI ^ code_info_persistent ^ cip_out_of_line_code). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for simple wrappers around access predicates. + +:- interface. + + % Get the hlds mapping from variables to stack slots + % +:- pred get_stack_slots(code_info::in, stack_slots::out) is det. + + % Get the table that contains advice about where + % variables should be put. + % +:- pred get_follow_var_map(code_info::in, abs_follow_vars_map::out) is det. + + % Get the integer that gives the number of the next + % non-reserved register. + % +:- pred get_next_non_reserved(code_info::in, reg_type::in, int::out) is det. + + % Set the table that contains advice about where + % variables should be put. +:- pred set_follow_vars(abs_follow_vars::in, + code_info::in, code_info::out) is det. + + % pre_goal_update(GoalInfo, HasSubGoal, OldCodeInfo, NewCodeInfo) + % updates OldCodeInfo to produce NewCodeInfo with the changes + % specified by GoalInfo. + % +:- pred pre_goal_update(hlds_goal_info::in, has_subgoals::in, + code_info::in, code_info::out) is det. + + % post_goal_update(GoalInfo, OldCodeInfo, NewCodeInfo) + % updates OldCodeInfo to produce NewCodeInfo with the changes described + % by GoalInfo. + % +:- pred post_goal_update(hlds_goal_info::in, + code_info::in, code_info::out) is det. + + % Find out whether the body of the current procedure should use + % typeinfo liveness. + % +:- func body_typeinfo_liveness(code_info) = bool. + + % Find out the type of the given variable. + % +:- func variable_type(code_info, prog_var) = mer_type. + +:- func variable_is_of_dummy_type(code_info, prog_var) = is_dummy_type. + + % Compute the principal type constructor of the given type, and return the + % definition of this type constructor, if it has one (some type + % constructors are built in, and some are hidden behind abstraction + % barriers). + % +:- pred search_type_defn(code_info::in, mer_type::in, hlds_type_defn::out) is + semidet. + + % Compute the principal type constructor of the given type, and return the + % definition of this type constructor. Abort if it doesn't have a + % definition (e.g. because it is a builtin). + % +:- func lookup_type_defn(code_info, mer_type) = hlds_type_defn. + +:- func lookup_cheaper_tag_test(code_info, mer_type) = maybe_cheaper_tag_test. + +:- func filter_region_vars(code_info, set_of_progvar) = set_of_progvar. + + % Get the code model of the current procedure. + % +:- func get_proc_model(code_info) = code_model. + + % Get the list of the head variables of the current procedure. + % +:- func get_headvars(code_info) = list(prog_var). + + % Get the call argument information for the current procedure + % +:- func get_arginfo(code_info) = list(arg_info). + + % Get the call argument info for a given mode of a given predicate + % +:- func get_pred_proc_arginfo(code_info, pred_id, proc_id) = list(arg_info). + + % Get the set of variables currently needed by the resume + % points of enclosing goals. + % +:- func current_resume_point_vars(code_info) = set_of_progvar. + +:- func variable_name(code_info, prog_var) = string. + + % Create a code address which holds the address of the specified + % procedure. + % The fourth argument should be `no' if the the caller wants the + % returned address to be valid from everywhere in the program. + % If being valid from within the current procedure is enough, + % this argument should be `yes' wrapped around the value of the + % --procs-per-c-function option and the current procedure id. + % Using an address that is only valid from within the current + % procedure may make jumps more efficient. + % + % If the procs_per_c_function option tells us to put more than one + % procedure into each C function, but not all procedures in the module + % are in one function, then we would like to be able to use the + % fast form of reference to a procedure for references not only from + % within the same procedure but also from other procedures within + % the same C function. However, at the time of code generation, + % we do not yet know which procedures will be put into the same + % C functions, and so we cannot do this. + % +:- func make_proc_entry_label(code_info, module_info, pred_id, proc_id, bool) + = code_addr. + + % Generate the next local label in sequence. + % +:- pred get_next_label(label::out, code_info::in, code_info::out) + is det. + + % Note that the succip slot is used, and thus cannot be optimized away. + % +:- pred succip_is_used(code_info::in, code_info::out) is det. + +:- pred add_trace_layout_for_label(label::in, term.context::in, trace_port::in, + bool::in, forward_goal_path::in, maybe(user_event_info)::in, + layout_label_info::in, code_info::in, code_info::out) is det. + +:- pred get_cur_proc_label(code_info::in, proc_label::out) is det. + +:- pred get_next_closure_seq_no(int::out, + code_info::in, code_info::out) is det. + +:- pred add_closure_layout(closure_proc_id_data::in, + code_info::in, code_info::out) is det. + +:- pred add_threadscope_string(string::in, int::out, + code_info::in, code_info::out) is det. + +:- pred get_threadscope_rev_string_table(code_info::in, + list(string)::out, int::out) is det. + +:- pred add_scalar_static_cell(list(typed_rval)::in, + data_id::out, code_info::in, code_info::out) is det. + +:- pred add_scalar_static_cell_natural_types(list(rval)::in, + data_id::out, code_info::in, code_info::out) is det. + +:- pred add_vector_static_cell(list(llds_type)::in, list(list(rval))::in, + data_id::out, code_info::in, code_info::out) is det. + +:- pred add_alloc_site_info(prog_context::in, string::in, int::in, + alloc_site_id::out, code_info::in, code_info::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + +:- pred add_resume_layout_for_label(label::in, + layout_label_info::in, code_info::in, code_info::out) is det. + +get_stack_slots(CI, StackSlots) :- + get_var_locn_info(CI, VarLocnInfo), + var_locn_get_stack_slots(VarLocnInfo, StackSlots). + +get_follow_var_map(CI, FollowVarMap) :- + get_var_locn_info(CI, VarLocnInfo), + var_locn_get_follow_var_map(VarLocnInfo, FollowVarMap). + +get_next_non_reserved(CI, RegType, NextNonReserved) :- + get_var_locn_info(CI, VarLocnInfo), + var_locn_get_next_non_reserved(VarLocnInfo, RegType, NextNonReserved). + +set_follow_vars(FollowVars, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_set_follow_vars(FollowVars, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +%-----------------------------------------------------------------------------% + +pre_goal_update(GoalInfo, HasSubGoals, !CI) :- + % The liveness pass puts resume_point annotations on some kinds + % of goals. The parts of the code generator that handle those kinds + % of goals should handle the resume point annotation as well; + % when they do, they remove the annotation. The following code + % is a sanity check to make sure that this has in fact been done. + goal_info_get_resume_point(GoalInfo, ResumePoint), + ( + ResumePoint = no_resume_point + ; + ResumePoint = resume_point(_, _), + unexpected($module, $pred, "pre_goal_update with resume point") + ), + goal_info_get_follow_vars(GoalInfo, MaybeFollowVars), + ( + MaybeFollowVars = yes(FollowVars), + set_follow_vars(FollowVars, !CI) + ; + MaybeFollowVars = no + ), + % NOTE: we must be careful to apply deaths before births + goal_info_get_pre_deaths(GoalInfo, PreDeaths), + rem_forward_live_vars(PreDeaths, !CI), + maybe_make_vars_forward_dead(PreDeaths, no, !CI), + goal_info_get_pre_births(GoalInfo, PreBirths), + add_forward_live_vars(PreBirths, !CI), + ( + HasSubGoals = does_not_have_subgoals, + goal_info_get_post_deaths(GoalInfo, PostDeaths), + rem_forward_live_vars(PostDeaths, !CI) + ; + HasSubGoals = has_subgoals + ). + +post_goal_update(GoalInfo, !CI) :- + % note: we must be careful to apply deaths before births + goal_info_get_post_deaths(GoalInfo, PostDeaths), + rem_forward_live_vars(PostDeaths, !CI), + maybe_make_vars_forward_dead(PostDeaths, no, !CI), + goal_info_get_post_births(GoalInfo, PostBirths), + add_forward_live_vars(PostBirths, !CI), + make_vars_forward_live(PostBirths, !CI), + InstMapDelta = goal_info_get_instmap_delta(GoalInfo), + get_instmap(!.CI, InstMap0), + instmap.apply_instmap_delta(InstMap0, InstMapDelta, InstMap), + set_instmap(InstMap, !CI). + +%---------------------------------------------------------------------------% + +body_typeinfo_liveness(CI) = TypeInfoLiveness :- + get_module_info(CI, ModuleInfo), + get_pred_id(CI, PredId), + module_info_pred_info(ModuleInfo, PredId, PredInfo), + get_globals(CI, Globals), + body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness). + +get_var_types(CI) = VarTypes :- + get_proc_info(CI, ProcInfo), + proc_info_get_vartypes(ProcInfo, VarTypes). + +variable_type(CI, Var) = Type :- + lookup_var_type(get_var_types(CI), Var, Type). + +variable_is_of_dummy_type(CI, Var) = IsDummy :- + VarType = variable_type(CI, Var), + get_module_info(CI, ModuleInfo), + IsDummy = check_dummy_type(ModuleInfo, VarType). + +search_type_defn(CI, Type, TypeDefn) :- + get_module_info(CI, ModuleInfo), + type_to_ctor_det(Type, TypeCtor), + module_info_get_type_table(ModuleInfo, TypeTable), + search_type_ctor_defn(TypeTable, TypeCtor, TypeDefn). + +lookup_type_defn(CI, Type) = TypeDefn :- + ( search_type_defn(CI, Type, TypeDefnPrime) -> + TypeDefn = TypeDefnPrime + ; + unexpected($module, $pred, "type ctor has no definition") + ). + +lookup_cheaper_tag_test(CI, Type) = CheaperTagTest :- + ( + search_type_defn(CI, Type, TypeDefn), + get_type_defn_body(TypeDefn, TypeBody), + TypeBody = hlds_du_type(_, _, CheaperTagTestPrime, _, _, _, _, _, _) + -> + CheaperTagTest = CheaperTagTestPrime + ; + CheaperTagTest = no_cheaper_tag_test + ). + +filter_region_vars(CI, ForwardLiveVarsBeforeGoal) = RegionVars :- + VarTypes = code_info.get_var_types(CI), + RegionVars = set_of_var.filter(is_region_var(VarTypes), + ForwardLiveVarsBeforeGoal). + +%---------------------------------------------------------------------------% + +get_proc_model(CI) = CodeModel :- + get_proc_info(CI, ProcInfo), + CodeModel = proc_info_interface_code_model(ProcInfo). + +get_headvars(CI) = HeadVars :- + get_module_info(CI, ModuleInfo), + get_pred_id(CI, PredId), + get_proc_id(CI, ProcId), + module_info_pred_proc_info(ModuleInfo, PredId, ProcId, _, ProcInfo), + proc_info_get_headvars(ProcInfo, HeadVars). + +get_arginfo(CI) = ArgInfo :- + get_pred_id(CI, PredId), + get_proc_id(CI, ProcId), + ArgInfo = get_pred_proc_arginfo(CI, PredId, ProcId). + +get_pred_proc_arginfo(CI, PredId, ProcId) = ArgInfo :- + get_module_info(CI, ModuleInfo), + module_info_pred_proc_info(ModuleInfo, PredId, ProcId, _, ProcInfo), + proc_info_arg_info(ProcInfo, ArgInfo). + +current_resume_point_vars(CI) = ResumeVars :- + get_fail_info(CI, FailInfo), + FailInfo = fail_info(ResumePointStack, _, _, _, _), + stack.det_top(ResumePointStack, ResumePointInfo), + pick_first_resume_point(ResumePointInfo, ResumeMap, _), + map.keys(ResumeMap, ResumeMapVarList), + ResumeVars = set_of_var.list_to_set(ResumeMapVarList). + +variable_name(CI, Var) = Name :- + get_varset(CI, Varset), + varset.lookup_name(Varset, Var, Name). + +%---------------------------------------------------------------------------% + +make_proc_entry_label(CI, ModuleInfo, PredId, ProcId, Immed0) = CodeAddr :- + ( + Immed0 = no, + Immed = no + ; + Immed0 = yes, + get_globals(CI, Globals), + globals.lookup_int_option(Globals, procs_per_c_function, ProcsPerFunc), + get_pred_id(CI, CurPredId), + get_proc_id(CI, CurProcId), + Immed = yes(ProcsPerFunc - proc(CurPredId, CurProcId)) + ), + CodeAddr = make_entry_label(ModuleInfo, PredId, ProcId, Immed). + +get_next_label(Label, !CI) :- + get_cur_proc_label(!.CI, ProcLabel), + get_label_counter(!.CI, C0), + counter.allocate(N, C0, C), + set_label_counter(C, !CI), + Label = internal_label(N, ProcLabel). + +succip_is_used(!CI) :- + set_succip_used(yes, !CI). + +add_trace_layout_for_label(Label, Context, Port, IsHidden, GoalPath, + MaybeSolverEventInfo, Layout, !CI) :- + get_layout_info(!.CI, Internals0), + Exec = yes(trace_port_layout_info(Context, Port, IsHidden, GoalPath, + MaybeSolverEventInfo, Layout)), + ( + Label = internal_label(LabelNum, _) + ; + Label = entry_label(_, _), + unexpected($module, $pred, "entry") + ), + ( map.search(Internals0, LabelNum, Internal0) -> + Internal0 = internal_layout_info(Exec0, Resume, Return), + ( + Exec0 = no + ; + Exec0 = yes(_), + unexpected($module, $pred, "already known label") + ), + Internal = internal_layout_info(Exec, Resume, Return), + map.det_update(LabelNum, Internal, Internals0, Internals) + ; + Internal = internal_layout_info(Exec, no, no), + map.det_insert(LabelNum, Internal, Internals0, Internals) + ), + set_layout_info(Internals, !CI). + +add_resume_layout_for_label(Label, LayoutInfo, !CI) :- + get_layout_info(!.CI, Internals0), + Resume = yes(LayoutInfo), + ( + Label = internal_label(LabelNum, _) + ; + Label = entry_label(_, _), + unexpected($module, $pred, "entry") + ), + ( map.search(Internals0, LabelNum, Internal0) -> + Internal0 = internal_layout_info(Exec, Resume0, Return), + ( + Resume0 = no + ; + Resume0 = yes(_), + unexpected($module, $pred, "already known label") + ), + Internal = internal_layout_info(Exec, Resume, Return), + map.det_update(LabelNum, Internal, Internals0, Internals) + ; + Internal = internal_layout_info(no, Resume, no), + map.det_insert(LabelNum, Internal, Internals0, Internals) + ), + set_layout_info(Internals, !CI). + +:- pred get_active_temps_data(code_info::in, + assoc_list(lval, slot_contents)::out) is det. + +get_active_temps_data(CI, Temps) :- + get_temps_in_use(CI, TempsInUse), + get_temp_content_map(CI, TempContentMap), + map.select(TempContentMap, TempsInUse, TempsInUseContentMap), + map.to_assoc_list(TempsInUseContentMap, Temps). + +get_cur_proc_label(CI, ProcLabel) :- + ProcLabel = CI ^ code_info_static ^ cis_proc_label. + +get_next_closure_seq_no(SeqNo, !CI) :- + get_closure_seq_counter(!.CI, C0), + counter.allocate(SeqNo, C0, C), + set_closure_seq_counter(C, !CI). + +add_closure_layout(ClosureLayout, !CI) :- + get_closure_layouts(!.CI, ClosureLayouts), + set_closure_layouts([ClosureLayout | ClosureLayouts], !CI). + +add_threadscope_string(String, SlotNum, !CI) :- + Size0 = !.CI ^ code_info_persistent ^ cip_ts_string_table_size, + RevTable0 = !.CI ^ code_info_persistent ^ cip_ts_rev_string_table, + SlotNum = Size0, + Size = Size0 + 1, + RevTable = [String | RevTable0], + !CI ^ code_info_persistent ^ cip_ts_string_table_size := Size, + !CI ^ code_info_persistent ^ cip_ts_rev_string_table := RevTable. + +get_threadscope_rev_string_table(CI, RevTable, TableSize) :- + RevTable = CI ^ code_info_persistent ^ cip_ts_rev_string_table, + TableSize = CI ^ code_info_persistent ^ cip_ts_string_table_size. + +add_scalar_static_cell(RvalsTypes, DataAddr, !CI) :- + get_static_cell_info(!.CI, StaticCellInfo0), + global_data.add_scalar_static_cell(RvalsTypes, DataAddr, + StaticCellInfo0, StaticCellInfo), + set_static_cell_info(StaticCellInfo, !CI). + +add_scalar_static_cell_natural_types(Rvals, DataAddr, !CI) :- + get_static_cell_info(!.CI, StaticCellInfo0), + global_data.add_scalar_static_cell_natural_types(Rvals, DataAddr, + StaticCellInfo0, StaticCellInfo), + set_static_cell_info(StaticCellInfo, !CI). + +add_vector_static_cell(Types, Vector, DataAddr, !CI) :- + get_static_cell_info(!.CI, StaticCellInfo0), + global_data.add_vector_static_cell(Types, Vector, DataAddr, + StaticCellInfo0, StaticCellInfo), + set_static_cell_info(StaticCellInfo, !CI). + +add_alloc_site_info(Context, Type, Size, AllocId, !CI) :- + get_cur_proc_label(!.CI, ProcLabel), + AllocSite = alloc_site_info(ProcLabel, Context, Type, Size), + AllocId = alloc_site_id(AllocSite), + get_alloc_sites(!.CI, AllocSites0), + set_tree234.insert(AllocSite, AllocSites0, AllocSites), + set_alloc_sites(AllocSites, !CI). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for handling branched control structures. + +:- interface. + +:- type position_info. +:- type branch_end_info. + +:- type branch_end == maybe(branch_end_info). + +:- pred remember_position(code_info::in, position_info::out) is det. + +:- pred reset_to_position(position_info::in, + code_info::in, code_info::out) is det. + +:- pred reset_resume_known(position_info::in, + code_info::in, code_info::out) is det. + +:- pred generate_branch_end(abs_store_map::in, branch_end::in, branch_end::out, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred after_all_branches(abs_store_map::in, branch_end::in, + code_info::in, code_info::out) is det. + +:- pred save_hp_in_branch(llds_code::out, lval::out, + position_info::in, position_info::out, code_info::in, code_info::out) + is det. + +:- implementation. + +:- type position_info + ---> position_info( + % The location-dependent part of the code_info + % at a given position. + code_info_loc_dep + ). + +:- type branch_end_info + ---> branch_end_info( + % The code_info at the end of a branch. + code_info + ). + +:- func pos_get_fail_info(position_info) = fail_info. + +pos_get_fail_info(position_info(LocDep)) = LocDep ^ cild_fail_info. + +remember_position(CI, position_info(CI ^ code_info_loc_dep)). + +reset_to_position(position_info(LocDep), CurCI, NextCI) :- + CurCI = code_info(Static, _, Persistent), + NextCI0 = code_info(Static, LocDep, Persistent), + + get_persistent_temps(NextCI0, PersistentTemps), + get_temps_in_use(NextCI0, TempsInUse0), + set.union(PersistentTemps, TempsInUse0, TempsInUse), + set_temps_in_use(TempsInUse, NextCI0, NextCI). + +reset_resume_known(BranchStart, !CI) :- + BranchStartFailInfo = pos_get_fail_info(BranchStart), + BranchStartFailInfo = fail_info(_, BSResumeKnown, _, _, _), + get_fail_info(!.CI, CurFailInfo), + CurFailInfo = fail_info(CurFailStack, _, CurCurfMaxfr, CurCondEnv, + CurHijack), + NewFailInfo = fail_info(CurFailStack, BSResumeKnown, CurCurfMaxfr, + CurCondEnv, CurHijack), + set_fail_info(NewFailInfo, !CI). + +generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd, Code, !CI) :- + % The code generator generates better code if it knows in advance where + % each variable should go. We don't need to reset the follow_vars + % afterwards, since every goal following a branched control structure + % must in any case be annotated with its own follow_var set. + map.to_assoc_list(StoreMap, AbsVarLocs), + assoc_list.values(AbsVarLocs, AbsLocs), + code_util.max_mentioned_abs_regs(AbsLocs, MaxRegR, MaxRegF), + set_follow_vars(abs_follow_vars(StoreMap, MaxRegR + 1, MaxRegF + 1), !CI), + get_instmap(!.CI, InstMap), + ( instmap_is_reachable(InstMap) -> + VarLocs = assoc_list.map_values_only(abs_locn_to_lval, AbsVarLocs), + place_vars(VarLocs, Code, !CI) + ; + % With --opt-no-return-call, the variables that we would have + % saved across a call that cannot return have had the last + % of their code generation state destroyed, so calling + % place_vars would cause a code generator abort. However, + % pretending that all the variables are where the store map + % says they should be is perfectly fine, since we can never + % reach the end of *this* branch anyway. + remake_with_store_map(StoreMap, !CI), + Code = empty + ), + EndCodeInfo1 = !.CI, + ( + MaybeEnd0 = no, + MaybeEnd = yes(branch_end_info(EndCodeInfo1)) + ; + MaybeEnd0 = yes(branch_end_info(EndCodeInfo0)), + + % Make sure the left context we leave the branched structure with + % is valid for all branches. + get_fail_info(EndCodeInfo0, FailInfo0), + get_fail_info(EndCodeInfo1, FailInfo1), + FailInfo0 = fail_info(_, ResumeKnown0, CurfrMaxfr0, CondEnv0, Hijack0), + FailInfo1 = fail_info(R, ResumeKnown1, CurfrMaxfr1, CondEnv1, Hijack1), + ( + ResumeKnown0 = resume_point_known(Redoip0), + ResumeKnown1 = resume_point_known(Redoip1) + -> + ResumeKnown = resume_point_known(Redoip0), + expect(unify(Redoip0, Redoip1), $module, $pred, "redoip mismatch") + ; + ResumeKnown = resume_point_unknown + ), + ( + CurfrMaxfr0 = must_be_equal, + CurfrMaxfr1 = must_be_equal + -> + CurfrMaxfr = must_be_equal + ; + CurfrMaxfr = may_be_different + ), + ( + Hijack0 = allowed, + Hijack1 = allowed + -> + Hijack = allowed + ; + Hijack = not_allowed + ), + expect(unify(CondEnv0, CondEnv1), $module, $pred, + "some but not all branches inside a non condition"), + FailInfo = fail_info(R, ResumeKnown, CurfrMaxfr, CondEnv0, Hijack), + set_fail_info(FailInfo, EndCodeInfo1, EndCodeInfoA), + + % Make sure the "temps in use" set at the end of the branched control + % structure includes every slot in use at the end of any branch. + get_temps_in_use(EndCodeInfo0, TempsInUse0), + get_temps_in_use(EndCodeInfo1, TempsInUse1), + set.union(TempsInUse0, TempsInUse1, TempsInUse), + set_temps_in_use(TempsInUse, EndCodeInfoA, EndCodeInfo), + + MaybeEnd = yes(branch_end_info(EndCodeInfo)) + ). + +after_all_branches(StoreMap, MaybeEnd, !CI) :- + ( + MaybeEnd = yes(BranchEnd), + BranchEnd = branch_end_info(BranchEndCodeInfo), + BranchEndLocDep = BranchEndCodeInfo ^ code_info_loc_dep, + reset_to_position(position_info(BranchEndLocDep), !CI), + remake_with_store_map(StoreMap, !CI) + ; + MaybeEnd = no, + unexpected($module, $pred, "no branches in branched control structure") + ). + + % remake_with_store_map throws away the var_info data structure, forgetting + % the current locations of all variables, and rebuilds it from scratch + % based on the given store map. The new var_info will know about only + % the variables present in the store map, and will believe they are + % where the store map says they are. + % +:- pred remake_with_store_map(abs_store_map::in, + code_info::in, code_info::out) is det. + +remake_with_store_map(StoreMap, !CI) :- + map.to_assoc_list(StoreMap, VarLocns), + VarLvals = assoc_list.map_values_only(abs_locn_to_lval, VarLocns), + get_var_locn_info(!.CI, VarLocnInfo0), + reinit_var_locn_state(VarLvals, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +save_hp_in_branch(Code, Slot, Pos0, Pos, CI0, CI) :- + CI0 = code_info(CIStatic0, CILocDep0, CIPersistent0), + Pos0 = position_info(LocDep0), + CI1 = code_info(CIStatic0, LocDep0, CIPersistent0), + save_hp(Code, Slot, CI1, CI2), + CI2 = code_info(CIStatic, LocDep, CIPersistent), + Pos = position_info(LocDep), + % Reset the location dependent part to the original. + CI = code_info(CIStatic, CILocDep0, CIPersistent). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for the handling of failure continuations. + + % The principles underlying this submodule of code_info.m are + % documented in the file compiler/notes/failure.html, which also + % defines terms such as "quarter hijack"). Some parts of the submodule + % also require knowledge of compiler/notes/allocation.html. + +:- interface. + +:- type resume_map. + +:- type resume_point_info. + + % `prepare_for_disj_hijack' should be called before entering + % a disjunction. It saves the values of any nondet stack slots + % the disjunction may hijack, and if necessary, sets the redofr + % slot of the top frame to point to this frame. The code at the + % start of the individual disjuncts will override the redoip slot. + % + % `undo_disj_hijack' should be called before entering the last disjunct + % of a disjunction. It undoes the effects of `prepare_for_disj_hijack'. + % +:- type disj_hijack_info. + +:- pred prepare_for_disj_hijack(code_model::in, + disj_hijack_info::out, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred undo_disj_hijack(disj_hijack_info::in, + llds_code::out, code_info::in, code_info::out) is det. + + % `prepare_for_ite_hijack' should be called before entering + % an if-then-else. It saves the values of any nondet stack slots + % the if-then-else may hijack, and if necessary, sets the redofr + % slot of the top frame to point to this frame. Our caller + % will then override the redoip slot to point to the start of + % the else part before generating the code of the condition. + % The maybe(lval) argument, if set to `yes', specifies the slot + % holding the success record to use in deciding whether to execute + % a region_ite_nondet_cond_fail operation at the start of the else branch. + % + % `ite_enter_then', which should be called after generating code for + % the condition, sets up the failure state of the code generator + % for generating the then-part, and returns the code sequences + % to be used at the starts of the then-part and the else-part + % to undo the effects of any hijacking. + % +:- type ite_hijack_info. + +:- pred prepare_for_ite_hijack(code_model::in, + maybe(embedded_stack_frame_id)::in, ite_hijack_info::out, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred ite_enter_then(ite_hijack_info::in, resume_point_info::in, + llds_code::out, llds_code::out, code_info::in, code_info::out) is det. + + % `enter_simple_neg' and `leave_simple_neg' should be called before + % and after generating the code for a negated unification, in + % situations where failure is a direct branch. We handle this case + % specially, because it occurs frequently and should not require + % a flushing of the expression cache, whereas the general way of + % handling negations does require a flush. These two predicates + % handle all aspects of the negation except for the unification itself. + % +:- type simple_neg_info. + +:- pred enter_simple_neg(list(prog_var)::in, hlds_goal_info::in, + simple_neg_info::out, code_info::in, code_info::out) is det. + +:- pred leave_simple_neg(hlds_goal_info::in, simple_neg_info::in, + code_info::in, code_info::out) is det. + + % `prepare_for_det_commit' and `generate_det_commit' should be + % called before and after generating the code for the multi goal + % being cut across. If the goal succeeds, the commit will cut away + % any choice points generated in the goal. + % + % The set_of_progvar should be the set of variables live before + % the scope goal. + % +:- type det_commit_info. + +:- pred prepare_for_det_commit(add_trail_ops::in, add_region_ops::in, + set_of_progvar::in, hlds_goal_info::in, det_commit_info::out, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred generate_det_commit(det_commit_info::in, + llds_code::out, code_info::in, code_info::out) is det. + + % `prepare_for_semi_commit' and `generate_semi_commit' should be + % called before and after generating the code for the nondet goal + % being cut across. If the goal succeeds, the commit will cut + % any choice points generated in the goal. + % + % The set_of_progvar should be the set of variables live before + % the scope goal. + % +:- type semi_commit_info. + +:- pred prepare_for_semi_commit(add_trail_ops::in, add_region_ops::in, + set_of_progvar::in, hlds_goal_info::in, semi_commit_info::out, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred generate_semi_commit(semi_commit_info::in, + llds_code::out, code_info::in, code_info::out) is det. + + % Put the given resume point into effect, by pushing it on to + % the resume point stack, and if necessary generating code to + % override the redoip of the top nondet stack frame. + % +:- pred effect_resume_point(resume_point_info::in, code_model::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred pop_resume_point(code_info::in, code_info::out) is det. + + % Return the details of the resume point currently on top of the + % failure continuation stack. + % +:- pred top_resume_point(code_info::in, resume_point_info::out) is det. + + % Call this predicate to say "we have just left a disjunction; + % we don't know what address the following code will need to + % backtrack to". + % +:- pred set_resume_point_to_unknown(code_info::in, code_info::out) is det. + + % Call this predicate to say "we have just returned from a model_non + % call; we don't know what address the following code will need to + % backtrack to, and there may now be nondet frames on top of ours + % that do not have their redofr slots pointing to our frame". + % +:- pred set_resume_point_and_frame_to_unknown(code_info::in, code_info::out) + is det. + + % Generate code for executing a failure that is appropriate for the + % current failure environment. + % +:- pred generate_failure(llds_code::out, code_info::in, code_info::out) is det. + + % Generate code that checks if the given rval is false, and if yes, + % executes a failure that is appropriate for the current failure + % environment. + % +:- pred fail_if_rval_is_false(rval::in, llds_code::out, + code_info::in, code_info::out) is det. + + % Checks whether the appropriate code for failure in the current + % failure environment is a direct branch. + % +:- pred failure_is_direct_branch(code_info::in, code_addr::out) is semidet. + + % Checks under what circumstances the current failure environment + % would allow a model_non call at this point to be turned into a + % tail call, provided of course that the return from the call is + % followed immediately by succeed(). + % +:- pred may_use_nondet_tailcall(code_info::in, nondet_tail_call::out) is det. + + % Materialize the given variables into registers or stack slots. + % +:- pred produce_vars(list(prog_var)::in, resume_map::out, llds_code::out, + code_info::in, code_info::out) is det. + + % Put the variables needed in enclosing failure continuations + % into their stack slots. + % +:- pred flush_resume_vars_to_stack(llds_code::out, + code_info::in, code_info::out) is det. + + % Set up the resume_point_info structure. + % The ResumeVars passed as the first arguments should be a sorted list + % without duplicates. + % +:- pred make_resume_point(list(prog_var)::in, resume_locs::in, resume_map::in, + resume_point_info::out, code_info::in, code_info::out) is det. + + % Generate the code for a resume point. + % +:- pred generate_resume_point(resume_point_info::in, llds_code::out, + code_info::in, code_info::out) is det. + + % List the variables that need to be preserved for the given resume point. + % +:- pred resume_point_vars(resume_point_info::in, list(prog_var)::out) is det. + + % See whether the given resume point includes a code address that presumes + % all the resume point variables to be in their stack slots. If yes, + % return that code address; otherwise, abort the compiler. + % +:- pred resume_point_stack_addr(resume_point_info::in, code_addr::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + + % The part of the code generator state that says how to handle + % failures; also called the failure continuation stack. + +:- type fail_info + ---> fail_info( + stack(resume_point_info), + resume_point_known, + curfr_vs_maxfr, + condition_env, + hijack_allowed + ). + + % A resumption point has one or two labels associated with it. + % Backtracking can arrive at either label. The code following + % each label will assume that the variables needed at the resumption + % point are in the locations given by the resume_map associated with + % the given label and nowhere else. Any code that can cause + % backtracking to a label must make sure that those variables are + % in the positions expected by the label. + % + % The only time when a code_addr in a resume_point info is not a label + % is when the code_addr is do_redo or do_fail, which indicate that + % the resumption point is either unknown or not in (this invocation of) + % this procedure. + % +:- type resume_point_info + ---> orig_only(resume_map, code_addr) + ; stack_only(resume_map, code_addr) + ; orig_and_stack(resume_map, code_addr, resume_map, code_addr) + ; stack_and_orig(resume_map, code_addr, resume_map, code_addr). + + % A resume map maps the variables that will be needed at a resumption + % point to the locations in which they will be. + % +:- type resume_map == map(prog_var, set(lval)). + +:- type redoip_update + ---> has_been_done + ; wont_be_done. + +:- type resume_point_known + ---> resume_point_known(redoip_update) + ; resume_point_unknown. + +:- type curfr_vs_maxfr + ---> must_be_equal + ; may_be_different. + +:- type condition_env + ---> inside_non_condition + ; not_inside_non_condition. + +:- type hijack_allowed + ---> allowed + ; not_allowed. + +%---------------------------------------------------------------------------% + +:- type disj_hijack_info + ---> disj_no_hijack + ; disj_temp_frame + ; disj_quarter_hijack + ; disj_half_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval + ) + ; disj_full_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval, + + % The stack slot in which we saved the value + % of the hijacked redofr. + lval + ). + +prepare_for_disj_hijack(CodeModel, HijackInfo, Code, !CI) :- + get_fail_info(!.CI, FailInfo), + FailInfo = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, CondEnv, + Allow), + ( + ( CodeModel = model_det + ; CodeModel = model_semi + ), + HijackInfo = disj_no_hijack, + Code = singleton( + llds_instr(comment("disj no hijack"), "") + ) + ; + CodeModel = model_non, + ( + CondEnv = inside_non_condition, + HijackInfo = disj_temp_frame, + create_temp_frame(do_fail, "prepare for disjunction", Code, !CI) + ; + CondEnv = not_inside_non_condition, + ( + Allow = not_allowed, + ( + CurfrMaxfr = must_be_equal, + ResumeKnown = resume_point_known(has_been_done), + stack.pop(TopResumePoint, ResumePoints, RestResumePoints), + stack.is_empty(RestResumePoints), + TopResumePoint = stack_only(_, do_fail) + -> + HijackInfo = disj_quarter_hijack, + Code = singleton( + llds_instr(comment("disj quarter hijack of do_fail"), + "") + ) + ; + HijackInfo = disj_temp_frame, + create_temp_frame(do_fail, "prepare for disjunction", Code, + !CI) + ) + ; + Allow = allowed, + ( + CurfrMaxfr = must_be_equal, + ( + ResumeKnown = resume_point_known(has_been_done), + HijackInfo = disj_quarter_hijack, + Code = singleton( + llds_instr(comment("disj quarter hijack"), "") + ) + ; + ( ResumeKnown = resume_point_known(wont_be_done) + ; ResumeKnown = resume_point_unknown + ), + acquire_temp_slot(slot_lval(redoip_slot(lval(curfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + HijackInfo = disj_half_hijack(RedoipSlot), + Code = singleton( + llds_instr(assign(RedoipSlot, + lval(redoip_slot(lval(curfr)))), + "prepare for half disj hijack") + ) + ) + ; + CurfrMaxfr = may_be_different, + acquire_temp_slot(slot_lval(redoip_slot(lval(maxfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + acquire_temp_slot(slot_lval(redofr_slot(lval(maxfr))), + non_persistent_temp_slot, RedofrSlot, !CI), + HijackInfo = disj_full_hijack(RedoipSlot, RedofrSlot), + Code = from_list([ + llds_instr( + assign(RedoipSlot, lval(redoip_slot(lval(maxfr)))), + "prepare for full disj hijack"), + llds_instr( + assign(RedofrSlot, lval(redofr_slot(lval(maxfr)))), + "prepare for full disj hijack"), + llds_instr( + assign(redofr_slot(lval(maxfr)), lval(curfr)), + "prepare for full disj hijack") + ]) + ) + ) + ) + ). + +undo_disj_hijack(HijackInfo, Code, !CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, CondEnv, + Allow), + ( + HijackInfo = disj_no_hijack, + Code = empty + ; + HijackInfo = disj_temp_frame, + Code = singleton( + llds_instr(assign(maxfr, lval(prevfr_slot(lval(maxfr)))), + "restore maxfr for temp frame disj") + ) + ; + HijackInfo = disj_quarter_hijack, + expect(unify(CurfrMaxfr, must_be_equal), $module, $pred, + "maxfr may differ from curfr in disj_quarter_hijack"), + stack.det_top(ResumePoints, ResumePoint), + pick_stack_resume_point(ResumePoint, _, StackLabel), + LabelConst = const(llconst_code_addr(StackLabel)), + % peephole.m looks for the "curfr==maxfr" pattern in the comment. + Code = singleton( + llds_instr(assign(redoip_slot(lval(curfr)), LabelConst), + "restore redoip for quarter disj hijack (curfr==maxfr)") + ) + ; + HijackInfo = disj_half_hijack(RedoipSlot), + expect(unify(ResumeKnown, resume_point_unknown), $module, $pred, + "resume point known in disj_half_hijack"), + expect(unify(CurfrMaxfr, must_be_equal), $module, $pred, + "maxfr may differ from curfr in disj_half_hijack"), + % peephole.m looks for the "curfr==maxfr" pattern in the comment. + Code = singleton( + llds_instr(assign(redoip_slot(lval(curfr)), lval(RedoipSlot)), + "restore redoip for half disj hijack (curfr==maxfr)") + ) + ; + HijackInfo = disj_full_hijack(RedoipSlot, RedofrSlot), + expect(unify(CurfrMaxfr, may_be_different), $module, $pred, + "maxfr same as curfr in disj_full_hijack"), + Code = from_list([ + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for full disj hijack"), + llds_instr(assign(redofr_slot(lval(maxfr)), lval(RedofrSlot)), + "restore redofr for full disj hijack") + ]) + ), + ( + % HijackInfo \= disj_no_hijack if and only if the disjunction + % is model_non. + HijackInfo \= disj_no_hijack, + CondEnv = inside_non_condition + -> + FailInfo = fail_info(ResumePoints, resume_point_unknown, CurfrMaxfr, + CondEnv, Allow), + set_fail_info(FailInfo, !CI) + ; + true + ). + +%---------------------------------------------------------------------------% + + % For model_non if-then-elses, we need to clean up the embedded stack frame + % we create for the if-then-else when the condition fails after succeeding. + % For such if-then-elses, we record the id of the embedded frame we need to + % clean up, and the id of the slot that is initialized to false, and set to + % true each time the condition succeeds. +:- type ite_region_info + ---> ite_region_info( + embedded_stack_frame_id, + lval + ). + +:- type ite_hijack_info + ---> ite_info( + resume_point_known, + condition_env, + ite_hijack_type, + maybe(ite_region_info) + ). + +:- type ite_hijack_type + ---> ite_no_hijack + ; ite_temp_frame( + % The stack slot in which we saved the value of maxfr. + lval + ) + ; ite_quarter_hijack + ; ite_half_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval + ) + ; ite_full_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval, + + % The stack slot in which we saved the value + % of the hijacked redofr. + lval, + + % The stack slot in which we saved the value of maxfr. + lval + ). + +prepare_for_ite_hijack(CondCodeModel, MaybeEmbeddedFrameId, HijackInfo, Code, + !CI) :- + get_fail_info(!.CI, FailInfo), + FailInfo = fail_info(_, ResumeKnown, CurfrMaxfr, CondEnv, Allow), + ( + % It is possible for a negated goal (which is the "Condition" of the + % equivalent if-then-else) to be det, if it is also impure. + ( CondCodeModel = model_det + ; CondCodeModel = model_semi + ), + expect(unify(MaybeEmbeddedFrameId, no), $module, $pred, + "MaybeEmbeddedFrameId in model_semi"), + HijackType = ite_no_hijack, + Code = singleton( + llds_instr(comment("ite no hijack"), "") + ), + MaybeRegionInfo = no + ; + CondCodeModel = model_non, + ( + ( Allow = not_allowed + ; CondEnv = inside_non_condition + ; MaybeEmbeddedFrameId = yes(_) + ) + -> + acquire_temp_slot(slot_lval(maxfr), non_persistent_temp_slot, + MaxfrSlot, !CI), + HijackType = ite_temp_frame(MaxfrSlot), + create_temp_frame(do_fail, "prepare for ite", TempFrameCode, !CI), + MaxfrCode = singleton( + llds_instr(assign(MaxfrSlot, lval(maxfr)), "prepare for ite") + ), + ( + MaybeEmbeddedFrameId = yes(EmbeddedFrameId), + % Note that this slot is intentionally not released anywhere. + acquire_temp_slot(slot_success_record, persistent_temp_slot, + SuccessRecordSlot, !CI), + InitSuccessCode = singleton( + llds_instr( + assign(SuccessRecordSlot, const(llconst_false)), + "record no success of the condition yes") + ), + MaybeRegionInfo = + yes(ite_region_info(EmbeddedFrameId, SuccessRecordSlot)) + ; + MaybeEmbeddedFrameId = no, + InitSuccessCode = empty, + MaybeRegionInfo = no + ), + Code = TempFrameCode ++ MaxfrCode ++ InitSuccessCode + ; + ( + CurfrMaxfr = must_be_equal, + ( + ResumeKnown = resume_point_known(_), + HijackType = ite_quarter_hijack, + Code = singleton( + llds_instr(comment("ite quarter hijack"), "") + ) + ; + ResumeKnown = resume_point_unknown, + acquire_temp_slot(slot_lval(redoip_slot(lval(curfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + HijackType = ite_half_hijack(RedoipSlot), + Code = singleton( + llds_instr( + assign(RedoipSlot, lval(redoip_slot(lval(curfr)))), + "prepare for half ite hijack") + ) + ) + ; + CurfrMaxfr = may_be_different, + acquire_temp_slot(slot_lval(redoip_slot(lval(maxfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + acquire_temp_slot(slot_lval(redofr_slot(lval(maxfr))), + non_persistent_temp_slot, RedofrSlot, !CI), + acquire_temp_slot(slot_lval(maxfr), + non_persistent_temp_slot, MaxfrSlot, !CI), + HijackType = ite_full_hijack(RedoipSlot, RedofrSlot, + MaxfrSlot), + Code = from_list([ + llds_instr( + assign(MaxfrSlot, lval(maxfr)), + "prepare for full ite hijack"), + llds_instr( + assign(RedoipSlot, lval(redoip_slot(lval(maxfr)))), + "prepare for full ite hijack"), + llds_instr( + assign(RedofrSlot, lval(redofr_slot(lval(maxfr)))), + "prepare for full ite hijack"), + llds_instr( + assign(redofr_slot(lval(maxfr)), lval(curfr)), + "prepare for full ite hijack") + ]) + ), + MaybeRegionInfo = no + ), + inside_non_condition(!CI) + ), + HijackInfo = ite_info(ResumeKnown, CondEnv, HijackType, MaybeRegionInfo). + +ite_enter_then(HijackInfo, ITEResumePoint, ThenCode, ElseCode, !CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints0, ResumeKnown0, CurfrMaxfr, _, Allow), + stack.det_pop(_, ResumePoints0, ResumePoints), + HijackInfo = ite_info(HijackResumeKnown, OldCondEnv, HijackType, + MaybeRegionInfo), + ( + HijackType = ite_no_hijack, + expect(unify(MaybeRegionInfo, no), $module, $pred, + "MaybeRegionInfo ite_no_hijack"), + ThenCode = empty, + ElseCode = empty + ; + HijackType = ite_temp_frame(MaxfrSlot), + ( + MaybeRegionInfo = no, + ThenCode = singleton( + % We can't remove the frame, it may not be on top. + llds_instr(assign(redoip_slot(lval(MaxfrSlot)), + const(llconst_code_addr(do_fail))), + "soft cut for temp frame ite") + ), + ElseCode = singleton( + % XXX search for assignments to maxfr + llds_instr(assign(maxfr, lval(prevfr_slot(lval(MaxfrSlot)))), + "restore maxfr for temp frame ite") + ) + ; + MaybeRegionInfo = yes(RegionInfo), + RegionInfo = ite_region_info(EmbeddedStackFrameId, + SuccessRecordSlot), + % XXX replace do_fail with ref to ResumePoint stack label + resume_point_stack_addr(ITEResumePoint, ITEStackResumeCodeAddr), + ThenCode = from_list([ + llds_instr(assign(SuccessRecordSlot, const(llconst_true)), + "record success of the condition"), + llds_instr(assign(redoip_slot(lval(MaxfrSlot)), + const(llconst_code_addr(ITEStackResumeCodeAddr))), + "redirect to cut for temp frame ite") + ]), + get_next_label(AfterRegionOp, !CI), + ElseCode = from_list([ + llds_instr(assign(maxfr, lval(prevfr_slot(lval(MaxfrSlot)))), + "restore maxfr for temp frame ite"), + llds_instr(if_val(unop(logical_not, lval(SuccessRecordSlot)), + code_label(AfterRegionOp)), + "jump around if the condition never succeeded"), + llds_instr(use_and_maybe_pop_region_frame( + region_ite_nondet_cond_fail, EmbeddedStackFrameId), + "cleanup after the post-success failure of the condition"), + llds_instr(goto(do_fail), + "the condition succeeded, so don't execute else branch"), + llds_instr(label(AfterRegionOp), + "after region op") + ]) + ) + ; + HijackType = ite_quarter_hijack, + expect(unify(MaybeRegionInfo, no), $module, $pred, + "MaybeRegionInfo ite_quarter_hijack"), + stack.det_top(ResumePoints, ResumePoint), + ( maybe_pick_stack_resume_point(ResumePoint, _, StackLabel) -> + LabelConst = const(llconst_code_addr(StackLabel)), + ThenCode = singleton( + llds_instr(assign(redoip_slot(lval(curfr)), LabelConst), + "restore redoip for quarter ite hijack") + ) + ; + % This can happen only if ResumePoint is unreachable from here. + ThenCode = empty + ), + ElseCode = ThenCode + ; + HijackType = ite_half_hijack(RedoipSlot), + expect(unify(MaybeRegionInfo, no), $module, $pred, + "MaybeRegionInfo ite_half_hijack"), + ThenCode = singleton( + llds_instr(assign(redoip_slot(lval(curfr)), lval(RedoipSlot)), + "restore redoip for half ite hijack") + ), + ElseCode = ThenCode + ; + HijackType = ite_full_hijack(RedoipSlot, RedofrSlot, MaxfrSlot), + expect(unify(MaybeRegionInfo, no), $module, $pred, + "MaybeRegionInfo ite_full_hijack"), + ThenCode = from_list([ + llds_instr(assign(redoip_slot(lval(MaxfrSlot)), lval(RedoipSlot)), + "restore redoip for full ite hijack"), + llds_instr(assign(redofr_slot(lval(MaxfrSlot)), lval(RedofrSlot)), + "restore redofr for full ite hijack") + ]), + ElseCode = from_list([ + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for full ite hijack"), + llds_instr(assign(redofr_slot(lval(maxfr)), lval(RedofrSlot)), + "restore redofr for full ite hijack") + ]) + ), + ( + ResumeKnown0 = resume_point_unknown, + ResumeKnown = resume_point_unknown + ; + ResumeKnown0 = resume_point_known(_), + ResumeKnown = HijackResumeKnown + ), + FailInfo = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, OldCondEnv, + Allow), + set_fail_info(FailInfo, !CI). + +%---------------------------------------------------------------------------% + +:- type simple_neg_info == fail_info. + +enter_simple_neg(ResumeVars, GoalInfo, FailInfo0, !CI) :- + get_fail_info(!.CI, FailInfo0), + % The only reason why we push a resume point at all is to protect + % the variables in ResumeVars from becoming unknown; by including them + % in the domain of the resume point, we guarantee that they will become + % zombies instead of unknown if they die in the pre- or post-goal updates. + % Therefore the only part of ResumePoint that matters is the set of + % variables in the resume map; the other parts of ResumePoint + % (the locations, the code address) will not be referenced. + map.init(ResumeMap0), + make_fake_resume_map(ResumeVars, ResumeMap0, ResumeMap), + ResumePoint = orig_only(ResumeMap, do_redo), + effect_resume_point(ResumePoint, model_semi, Code, !CI), + expect(is_empty(Code), $module, $pred, "nonempty code for simple neg"), + pre_goal_update(GoalInfo, does_not_have_subgoals, !CI). + +leave_simple_neg(GoalInfo, FailInfo, !CI) :- + post_goal_update(GoalInfo, !CI), + set_fail_info(FailInfo, !CI). + +:- pred make_fake_resume_map(list(prog_var)::in, + map(prog_var, set(lval))::in, map(prog_var, set(lval))::out) is det. + +make_fake_resume_map([], !ResumeMap). +make_fake_resume_map([Var | Vars], !ResumeMap) :- + % A visibly fake location. + Locns = set.make_singleton_set(reg(reg_r, -1)), + map.det_insert(Var, Locns, !ResumeMap), + make_fake_resume_map(Vars, !ResumeMap). + +%---------------------------------------------------------------------------% + +:- type det_commit_info + ---> det_commit_info( + % Location of saved maxfr. + maybe(lval), + + % Location of saved ticket % counter and trail pointer. + maybe(pair(lval)), + + maybe(region_commit_stack_frame) + ). + +:- type region_commit_stack_frame + ---> region_commit_stack_frame( + % The id of the region commit stack frame, which is emdedded + % in the current procedure's stack frame, and whose layout is: + + % saved region_commit_stack_pointer + % saved region sequence number + % number of live nonprotected regions + % space reserved for the ids of live nonprotected regions + + embedded_stack_frame_id, + + % The list of temporary slots that constitute + % this embedded stack frame. + list(lval) + ). + +prepare_for_det_commit(AddTrailOps, AddRegionOps, ForwardLiveVarsBeforeGoal, + CommitGoalInfo, DetCommitInfo, Code, !CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(_, _, CurfrMaxfr, _, _), + ( + CurfrMaxfr = may_be_different, + acquire_temp_slot(slot_lval(maxfr), non_persistent_temp_slot, + MaxfrSlot, !CI), + SaveMaxfrCode = singleton( + llds_instr(save_maxfr(MaxfrSlot), "save the value of maxfr") + ), + MaybeMaxfrSlot = yes(MaxfrSlot) + ; + CurfrMaxfr = must_be_equal, + SaveMaxfrCode = empty, + MaybeMaxfrSlot = no + ), + maybe_save_trail_info(AddTrailOps, MaybeTrailSlots, SaveTrailCode, !CI), + maybe_save_region_commit_frame(AddRegionOps, ForwardLiveVarsBeforeGoal, + CommitGoalInfo, MaybeRegionCommitFrameInfo, SaveRegionCommitFrameCode, + !CI), + DetCommitInfo = det_commit_info(MaybeMaxfrSlot, MaybeTrailSlots, + MaybeRegionCommitFrameInfo), + Code = SaveMaxfrCode ++ SaveTrailCode ++ SaveRegionCommitFrameCode. + +generate_det_commit(DetCommitInfo, Code, !CI) :- + DetCommitInfo = det_commit_info(MaybeMaxfrSlot, MaybeTrailSlots, + MaybeRegionCommitFrameInfo), + ( + MaybeMaxfrSlot = yes(MaxfrSlot), + RestoreMaxfrCode = singleton( + llds_instr(restore_maxfr(MaxfrSlot), + "restore the value of maxfr - perform commit") + ), + release_temp_slot(MaxfrSlot, non_persistent_temp_slot, !CI) + ; + MaybeMaxfrSlot = no, + RestoreMaxfrCode = singleton( + llds_instr(assign(maxfr, lval(curfr)), + "restore the value of maxfr - perform commit") + ) + ), + maybe_restore_trail_info(MaybeTrailSlots, CommitTrailCode, _, !CI), + maybe_restore_region_commit_frame(MaybeRegionCommitFrameInfo, + SuccessRegionCode, _FailureRegionCode, !CI), + Code = RestoreMaxfrCode ++ CommitTrailCode ++ SuccessRegionCode. + +%---------------------------------------------------------------------------% + +:- type semi_commit_info + ---> semi_commit_info( + % Fail_info on entry. + fail_info, + + resume_point_info, + commit_hijack_info, + + % Location of saved ticket counter and trail pointer. + maybe(pair(lval)), + + maybe(region_commit_stack_frame) + ). + +:- type commit_hijack_info + ---> commit_temp_frame( + % The stack slot in which we saved the old value of maxfr. + lval, + + % Do we bracket the goal with MR_commit_mark and MR_commit_cut? + bool + ) + ; commit_quarter_hijack + ; commit_half_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval + ) + ; commit_full_hijack( + % The stack slot in which we saved the value + % of the hijacked redoip. + lval, + + % The stack slot in which we saved the value + % of the hijacked redofr. + lval, + + % The stack slot in which we saved the value of maxfr. + lval + ). + +prepare_for_semi_commit(AddTrailOps, AddRegionOps, ForwardLiveVarsBeforeGoal, + CommitGoalInfo, SemiCommitInfo, Code, !CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints0, ResumeKnown, CurfrMaxfr, CondEnv, + Allow), + stack.det_top(ResumePoints0, TopResumePoint), + clone_resume_point(TopResumePoint, NewResumePoint, !CI), + stack.push(NewResumePoint, ResumePoints0, ResumePoints), + FailInfo = fail_info(ResumePoints, resume_point_known(has_been_done), + CurfrMaxfr, CondEnv, Allow), + set_fail_info(FailInfo, !CI), + + pick_stack_resume_point(NewResumePoint, _, StackLabel), + StackLabelConst = const(llconst_code_addr(StackLabel)), + ( + ( Allow = not_allowed ; CondEnv = inside_non_condition ) + -> + acquire_temp_slot(slot_lval(maxfr), non_persistent_temp_slot, + MaxfrSlot, !CI), + MaxfrCode = singleton( + llds_instr(save_maxfr(MaxfrSlot), + "prepare for temp frame commit") + ), + create_temp_frame(StackLabel, + "prepare for temp frame commit", TempFrameCode, !CI), + get_globals(!.CI, Globals), + globals.lookup_bool_option(Globals, use_minimal_model_stack_copy_cut, + UseMinimalModelStackCopyCut), + HijackInfo = commit_temp_frame(MaxfrSlot, UseMinimalModelStackCopyCut), + ( + UseMinimalModelStackCopyCut = yes, + % If the code we are committing across starts but does not complete + % the evaluation of a tabled subgoal, the cut will remove the + % generator's choice point, so that the evaluation of the subgoal + % will never be completed. We handle such "dangling" generators + % by removing them from the subgoal trie of the tabled procedure. + % This requires knowing what tabled subgoals are started inside + % commits, which is why we wrap the goal being committed across + % inside MR_commit_{mark,cut}. + Components = [ + foreign_proc_raw_code(cannot_branch_away, + proc_affects_liveness, live_lvals_info(set.init), + "\t\tMR_save_transient_registers();\n"), + foreign_proc_raw_code(cannot_branch_away, + proc_does_not_affect_liveness, live_lvals_info(set.init), + "\t\tMR_commit_mark();\n"), + foreign_proc_raw_code(cannot_branch_away, + proc_affects_liveness, live_lvals_info(set.init), + "\t\tMR_restore_transient_registers();\n") + ], + MD = proc_may_duplicate, + MarkCode = singleton( + llds_instr(foreign_proc_code([], Components, + proc_will_not_call_mercury, no, no, no, no, no, no, MD), + "") + ) + ; + UseMinimalModelStackCopyCut = no, + MarkCode = empty + ), + HijackCode = MaxfrCode ++ TempFrameCode ++ MarkCode + ; + ( + CurfrMaxfr = must_be_equal, + ( + ResumeKnown = resume_point_known(has_been_done), + HijackInfo = commit_quarter_hijack, + HijackCode = singleton( + llds_instr(assign(redoip_slot(lval(curfr)), + StackLabelConst), + "hijack the redofr slot") + ) + ; + ( ResumeKnown = resume_point_known(wont_be_done) + ; ResumeKnown = resume_point_unknown + ), + acquire_temp_slot(slot_lval(redoip_slot(lval(curfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + HijackInfo = commit_half_hijack(RedoipSlot), + HijackCode = from_list([ + llds_instr(assign(RedoipSlot, + lval(redoip_slot(lval(curfr)))), + "prepare for half commit hijack"), + llds_instr(assign(redoip_slot(lval(curfr)), + StackLabelConst), + "hijack the redofr slot") + ]) + ) + ; + CurfrMaxfr = may_be_different, + acquire_temp_slot(slot_lval(redoip_slot(lval(maxfr))), + non_persistent_temp_slot, RedoipSlot, !CI), + acquire_temp_slot(slot_lval(redofr_slot(lval(maxfr))), + non_persistent_temp_slot, RedofrSlot, !CI), + acquire_temp_slot(slot_lval(maxfr), + non_persistent_temp_slot, MaxfrSlot, !CI), + HijackInfo = commit_full_hijack(RedoipSlot, RedofrSlot, MaxfrSlot), + HijackCode = from_list([ + llds_instr(assign(RedoipSlot, lval(redoip_slot(lval(maxfr)))), + "prepare for full commit hijack"), + llds_instr(assign(RedofrSlot, lval(redofr_slot(lval(maxfr)))), + "prepare for full commit hijack"), + llds_instr(save_maxfr(MaxfrSlot), + "prepare for full commit hijack"), + llds_instr(assign(redofr_slot(lval(maxfr)), lval(curfr)), + "hijack the redofr slot"), + llds_instr(assign(redoip_slot(lval(maxfr)), StackLabelConst), + "hijack the redoip slot") + ]) + ) + ), + maybe_save_trail_info(AddTrailOps, MaybeTrailSlots, SaveTrailCode, !CI), + maybe_save_region_commit_frame(AddRegionOps, ForwardLiveVarsBeforeGoal, + CommitGoalInfo, MaybeRegionCommitFrameInfo, SaveRegionCommitFrameCode, + !CI), + SemiCommitInfo = semi_commit_info(FailInfo0, NewResumePoint, + HijackInfo, MaybeTrailSlots, MaybeRegionCommitFrameInfo), + Code = HijackCode ++ SaveTrailCode ++ SaveRegionCommitFrameCode. + +generate_semi_commit(SemiCommitInfo, Code, !CI) :- + SemiCommitInfo = semi_commit_info(FailInfo, ResumePoint, + HijackInfo, MaybeTrailSlots, MaybeRegionCommitFrameInfo), + + set_fail_info(FailInfo, !CI), + % XXX Should release the temp slots in each arm of the switch. + ( + HijackInfo = commit_temp_frame(MaxfrSlot, UseMinimalModel), + MaxfrCode = singleton( + llds_instr(restore_maxfr(MaxfrSlot), + "restore maxfr for temp frame hijack") + ), + ( + UseMinimalModel = yes, + % See the comment in prepare_for_semi_commit above. + Components = [ + foreign_proc_raw_code(cannot_branch_away, + proc_does_not_affect_liveness, live_lvals_info(set.init), + "\t\tMR_commit_cut();\n") + ], + MD = proc_may_duplicate, + CutCode = singleton( + llds_instr(foreign_proc_code([], Components, + proc_will_not_call_mercury, no, no, no, no, no, no, MD), + "commit for temp frame hijack") + ) + ; + UseMinimalModel = no, + CutCode = empty + ), + SuccessUndoCode = MaxfrCode ++ CutCode, + FailureUndoCode = MaxfrCode ++ CutCode + ; + HijackInfo = commit_quarter_hijack, + FailInfo = fail_info(ResumePoints, _, _, _, _), + stack.det_top(ResumePoints, TopResumePoint), + pick_stack_resume_point(TopResumePoint, _, StackLabel), + StackLabelConst = const(llconst_code_addr(StackLabel)), + SuccessUndoCode = from_list([ + llds_instr(assign(maxfr, lval(curfr)), + "restore maxfr for quarter commit hijack"), + llds_instr(assign(redoip_slot(lval(maxfr)), StackLabelConst), + "restore redoip for quarter commit hijack") + ]), + FailureUndoCode = singleton( + llds_instr(assign(redoip_slot(lval(maxfr)), StackLabelConst), + "restore redoip for quarter commit hijack") + ) + ; + HijackInfo = commit_half_hijack(RedoipSlot), + SuccessUndoCode = from_list([ + llds_instr(assign(maxfr, lval(curfr)), + "restore maxfr for half commit hijack"), + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for half commit hijack") + ]), + FailureUndoCode = singleton( + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for half commit hijack") + ) + ; + HijackInfo = commit_full_hijack(RedoipSlot, RedofrSlot, MaxfrSlot), + SuccessUndoCode = from_list([ + llds_instr(restore_maxfr(MaxfrSlot), + "restore maxfr for full commit hijack"), + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for full commit hijack"), + llds_instr(assign(redofr_slot(lval(maxfr)), lval(RedofrSlot)), + "restore redofr for full commit hijack") + ]), + FailureUndoCode = from_list([ + llds_instr(assign(redoip_slot(lval(maxfr)), lval(RedoipSlot)), + "restore redoip for full commit hijack"), + llds_instr(assign(redofr_slot(lval(maxfr)), lval(RedofrSlot)), + "restore redofr for full commit hijack") + ]) + ), + + remember_position(!.CI, AfterCommit), + generate_resume_point(ResumePoint, ResumePointCode, !CI), + generate_failure(FailCode, !CI), + reset_to_position(AfterCommit, !CI), + + maybe_restore_trail_info(MaybeTrailSlots, CommitTrailCode, + RestoreTrailCode, !CI), + maybe_restore_region_commit_frame(MaybeRegionCommitFrameInfo, + SuccessRegionCode, FailureRegionCode, !CI), + + get_next_label(SuccLabel, !CI), + GotoSuccLabel = singleton( + llds_instr(goto(code_label(SuccLabel)), "Jump to success continuation") + ), + SuccLabelCode = singleton( + llds_instr(label(SuccLabel), "Success continuation") + ), + SuccessCode = SuccessUndoCode ++ CommitTrailCode ++ SuccessRegionCode, + FailureCode = ResumePointCode ++ FailureUndoCode ++ RestoreTrailCode ++ + FailureRegionCode ++ FailCode, + Code = SuccessCode ++ GotoSuccLabel ++ FailureCode ++ SuccLabelCode. + +%---------------------------------------------------------------------------% + +:- pred maybe_save_region_commit_frame(add_region_ops::in, set_of_progvar::in, + hlds_goal_info::in, maybe(region_commit_stack_frame)::out, llds_code::out, + code_info::in, code_info::out) is det. + +maybe_save_region_commit_frame(AddRegionOps, _ForwardLiveVarsBeforeGoal, + CommitGoalInfo, MaybeRegionCommitFrameInfo, Code, !CI) :- + ( + AddRegionOps = do_not_add_region_ops, + MaybeRegionCommitFrameInfo = no, + Code = empty + ; + AddRegionOps = add_region_ops, + MaybeRbmmInfo = goal_info_get_maybe_rbmm(CommitGoalInfo), + ( + MaybeRbmmInfo = no, + MaybeRegionCommitFrameInfo = no, + Code = empty + ; + MaybeRbmmInfo = yes(RbmmInfo), + RbmmInfo = rbmm_goal_info(_, CommitRemovedRegionVars, _, _, _), + + RemovedRegionVarList = set.to_sorted_list(CommitRemovedRegionVars), + + NumRemovedRegionVars = list.length(RemovedRegionVarList), + + code_info.get_globals(!.CI, Globals), + globals.lookup_int_option(Globals, size_region_commit_fixed, + FixedSize), + globals.lookup_int_option(Globals, size_region_commit_entry, + EntrySize), + FrameSize = FixedSize + EntrySize * NumRemovedRegionVars, + Items = list.duplicate(FrameSize, slot_region_commit), + acquire_several_temp_slots(Items, non_persistent_temp_slot, + StackVars, MainStackId, FirstSlotNum, LastSlotNum, !CI), + EmbeddedStackFrame = embedded_stack_frame_id(MainStackId, + FirstSlotNum, LastSlotNum), + FirstSavedRegionAddr = first_nonfixed_embedded_slot_addr( + EmbeddedStackFrame, FixedSize), + acquire_reg(reg_r, NumRegLval, !CI), + acquire_reg(reg_r, AddrRegLval, !CI), + PushInitCode = from_list([ + llds_instr( + push_region_frame(region_stack_commit, EmbeddedStackFrame), + "Save stack pointer of embedded region commit stack"), + llds_instr( + assign(NumRegLval, const(llconst_int(0))), + "Initialize number of unprotected live regions"), + llds_instr( + assign(AddrRegLval, FirstSavedRegionAddr), + "Initialize pointer to the next unprotected live" ++ + " region slot") + ]), + save_unprotected_live_regions(NumRegLval, AddrRegLval, + EmbeddedStackFrame, RemovedRegionVarList, FillCode, !CI), + SetCode = singleton( + llds_instr( + region_set_fixed_slot(region_set_commit_num_entries, + EmbeddedStackFrame, lval(NumRegLval)), + "Store the number of unprotected live regions") + ), + release_reg(NumRegLval, !CI), + release_reg(AddrRegLval, !CI), + + RegionCommitFrameInfo = + region_commit_stack_frame(EmbeddedStackFrame, StackVars), + MaybeRegionCommitFrameInfo = yes(RegionCommitFrameInfo), + + Code = PushInitCode ++ FillCode ++ SetCode + ) + ). + +:- pred save_unprotected_live_regions(lval::in, lval::in, + embedded_stack_frame_id::in, list(prog_var)::in, llds_code::out, + code_info::in, code_info::out) is det. + +save_unprotected_live_regions(_, _, _, [], empty, !CI). +save_unprotected_live_regions(NumLval, AddrLval, EmbeddedStackFrame, + [RegionVar | RegionVars], Code ++ Codes, !CI) :- + produce_variable(RegionVar, ProduceVarCode, RegionVarRval, !CI), + SaveCode = singleton( + llds_instr( + region_fill_frame(region_fill_commit, EmbeddedStackFrame, + RegionVarRval, NumLval, AddrLval), + "Save the region in the commit stack frame if it is unprotected") + ), + Code = ProduceVarCode ++ SaveCode, + save_unprotected_live_regions(NumLval, AddrLval, EmbeddedStackFrame, + RegionVars, Codes, !CI). + +:- pred maybe_restore_region_commit_frame(maybe(region_commit_stack_frame)::in, + llds_code::out, llds_code::out, code_info::in, code_info::out) is det. + +maybe_restore_region_commit_frame(MaybeRegionCommitFrameInfo, + SuccessCode, FailureCode, !CI) :- + ( + MaybeRegionCommitFrameInfo = no, + SuccessCode = empty, + FailureCode = empty + ; + MaybeRegionCommitFrameInfo = yes(RegionCommitFrameInfo), + RegionCommitFrameInfo = region_commit_stack_frame(EmbeddedStackFrame, + StackVars), + SuccessCode = singleton( + llds_instr( + use_and_maybe_pop_region_frame(region_commit_success, + EmbeddedStackFrame), + "Destroy removed regions protected by cut away disjunctions") + ), + FailureCode = singleton( + llds_instr( + use_and_maybe_pop_region_frame(region_commit_failure, + EmbeddedStackFrame), + "Undo the creation of the commit frame") + ), + release_several_temp_slots(StackVars, non_persistent_temp_slot, !CI) + ). + +%---------------------------------------------------------------------------% + +:- pred inside_non_condition(code_info::in, code_info::out) is det. + +inside_non_condition(!CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, _, Allow), + FailInfo = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, + inside_non_condition, Allow), + set_fail_info(FailInfo, !CI). + +:- pred create_temp_frame(code_addr::in, string::in, llds_code::out, + code_info::in, code_info::out) is det. + +create_temp_frame(Redoip, Comment, Code, !CI) :- + ( get_proc_model(!.CI) = model_non -> + Kind = nondet_stack_proc + ; + Kind = det_stack_proc + ), + Code = singleton( + llds_instr(mkframe(temp_frame(Kind), yes(Redoip)), Comment) + ), + set_created_temp_frame(yes, !CI), + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints, ResumeKnown, _, CondEnv, Allow), + FailInfo = fail_info(ResumePoints, ResumeKnown, may_be_different, + CondEnv, Allow), + set_fail_info(FailInfo, !CI). + +%---------------------------------------------------------------------------% + +effect_resume_point(ResumePoint, CodeModel, Code, !CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints0, _ResumeKnown, CurfrMaxfr, + CondEnv, Allow), + ( stack.top(ResumePoints0, OldResumePoint) -> + pick_first_resume_point(OldResumePoint, OldMap, _), + pick_first_resume_point(ResumePoint, NewMap, _), + map.keys(OldMap, OldKeys), + map.keys(NewMap, NewKeys), + set.list_to_set(OldKeys, OldKeySet), + set.list_to_set(NewKeys, NewKeySet), + expect(set.subset(OldKeySet, NewKeySet), $module, $pred, + "non-nested resume point variable sets") + ; + true + ), + stack.push(ResumePoint, ResumePoints0, ResumePoints), + ( + CodeModel = model_non, + pick_stack_resume_point(ResumePoint, _, StackLabel), + LabelConst = const(llconst_code_addr(StackLabel)), + Code = singleton( + llds_instr(assign(redoip_slot(lval(maxfr)), LabelConst), + "hijack redoip to effect resume point") + ), + RedoipUpdate = has_been_done + ; + ( CodeModel = model_det + ; CodeModel = model_semi + ), + Code = empty, + RedoipUpdate = wont_be_done + ), + FailInfo = fail_info(ResumePoints, resume_point_known(RedoipUpdate), + CurfrMaxfr, CondEnv, Allow), + set_fail_info(FailInfo, !CI). + +pop_resume_point(!CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints0, ResumeKnown, CurfrMaxfr, + CondEnv, Allow), + stack.det_pop(_, ResumePoints0, ResumePoints), + FailInfo = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr, + CondEnv, Allow), + set_fail_info(FailInfo, !CI). + +%---------------------------------------------------------------------------% + +top_resume_point(CI, ResumePoint) :- + get_fail_info(CI, FailInfo), + FailInfo = fail_info(ResumePoints, _, _, _, _), + stack.det_top(ResumePoints, ResumePoint). + +set_resume_point_to_unknown(!CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints, _, CurfrMaxfr, CondEnv, Allow), + FailInfo = fail_info(ResumePoints, resume_point_unknown, + CurfrMaxfr, CondEnv, Allow), + set_fail_info(FailInfo, !CI). + +set_resume_point_and_frame_to_unknown(!CI) :- + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(ResumePoints, _, _, CondEnv, Allow), + FailInfo = fail_info(ResumePoints, resume_point_unknown, may_be_different, + CondEnv, Allow), + set_fail_info(FailInfo, !CI). + +%---------------------------------------------------------------------------% + +generate_failure(Code, !CI) :- + get_fail_info(!.CI, FailInfo), + FailInfo = fail_info(ResumePoints, ResumeKnown, _, _, _), + ( + ResumeKnown = resume_point_known(_), + stack.det_top(ResumePoints, TopResumePoint), + ( pick_matching_resume_addr(!.CI, TopResumePoint, FailureAddress0) -> + FailureAddress = FailureAddress0, + PlaceCode = empty + ; + pick_first_resume_point(TopResumePoint, Map, FailureAddress), + map.to_assoc_list(Map, AssocList), + remember_position(!.CI, CurPos), + pick_and_place_vars(AssocList, _, PlaceCode, !CI), + reset_to_position(CurPos, !CI) + ), + BranchCode = singleton(llds_instr(goto(FailureAddress), "fail")), + Code = PlaceCode ++ BranchCode + ; + ResumeKnown = resume_point_unknown, + Code = singleton(llds_instr(goto(do_redo), "fail")) + ). + +fail_if_rval_is_false(Rval0, Code, !CI) :- + get_fail_info(!.CI, FailInfo), + FailInfo = fail_info(ResumePoints, ResumeKnown, _, _, _), + ( + ResumeKnown = resume_point_known(_), + stack.det_top(ResumePoints, TopResumePoint), + ( pick_matching_resume_addr(!.CI, TopResumePoint, FailureAddress0) -> + % We branch away if the test *fails* + code_util.neg_rval(Rval0, Rval), + Code = singleton( + llds_instr(if_val(Rval, FailureAddress0), "Test for failure") + ) + ; + pick_first_resume_point(TopResumePoint, Map, FailureAddress), + map.to_assoc_list(Map, AssocList), + get_next_label(SuccessLabel, !CI), + remember_position(!.CI, CurPos), + pick_and_place_vars(AssocList, _, PlaceCode, !CI), + reset_to_position(CurPos, !CI), + SuccessAddress = code_label(SuccessLabel), + % We branch away if the test *fails*, therefore if the test + % succeeds, we branch around the code that moves variables to + % their failure locations and branches away to the failure + % continuation. + TestCode = singleton( + llds_instr(if_val(Rval0, SuccessAddress), "Test for failure") + ), + TailCode = from_list([ + llds_instr(goto(FailureAddress), "Goto failure"), + llds_instr(label(SuccessLabel), "Success continuation") + ]), + Code = TestCode ++ PlaceCode ++ TailCode + ) + ; + ResumeKnown = resume_point_unknown, + % We branch away if the test *fails* + code_util.neg_rval(Rval0, Rval), + Code = singleton( + llds_instr(if_val(Rval, do_redo), "Test for failure") + ) + ). + +%---------------------------------------------------------------------------% + +failure_is_direct_branch(CI, CodeAddr) :- + get_fail_info(CI, FailInfo), + FailInfo = fail_info(ResumePoints, resume_point_known(_), _, _, _), + stack.top(ResumePoints, TopResumePoint), + pick_matching_resume_addr(CI, TopResumePoint, CodeAddr). + +may_use_nondet_tailcall(CI, TailCallStatus) :- + get_fail_info(CI, FailInfo), + FailInfo = fail_info(ResumePoints0, ResumeKnown, _, _, _), + ( + stack.pop(ResumePoint1, ResumePoints0, ResumePoints1), + stack.is_empty(ResumePoints1), + ResumePoint1 = stack_only(_, do_fail) + -> + ( + ResumeKnown = resume_point_known(_), + TailCallStatus = unchecked_tail_call + ; + ResumeKnown = resume_point_unknown, + TailCallStatus = checked_tail_call + ) + ; + TailCallStatus = no_tail_call + ). + +%---------------------------------------------------------------------------% + + % See whether the current locations of variables match the locations + % associated with any of the options in the given failure map. + % If yes, return the code_addr of that option. + % +:- pred pick_matching_resume_addr(code_info::in, + resume_point_info::in, code_addr::out) is semidet. + +pick_matching_resume_addr(CI, ResumeMaps, Addr) :- + variable_locations(CI, CurLocs), + ( + ResumeMaps = orig_only(Map1, Addr1), + ( match_resume_loc(Map1, CurLocs) -> + Addr = Addr1 + ; + fail + ) + ; + ResumeMaps = stack_only(Map1, Addr1), + ( match_resume_loc(Map1, CurLocs) -> + Addr = Addr1 + ; + fail + ) + ; + ResumeMaps = orig_and_stack(Map1, Addr1, Map2, Addr2), + ( match_resume_loc(Map1, CurLocs) -> + Addr = Addr1 + ; match_resume_loc(Map2, CurLocs) -> + Addr = Addr2 + ; + fail + ) + ; + ResumeMaps = stack_and_orig(Map1, Addr1, Map2, Addr2), + ( match_resume_loc(Map1, CurLocs) -> + Addr = Addr1 + ; match_resume_loc(Map2, CurLocs) -> + Addr = Addr2 + ; + fail + ) + ). + +:- pred match_resume_loc(resume_map::in, resume_map::in) is semidet. + +match_resume_loc(Map, Locations0) :- + map.keys(Map, KeyList), + set.list_to_set(KeyList, Keys), + map.select(Locations0, Keys, Locations), + map.to_assoc_list(Locations, List), + all_vars_match_resume_map(Map, List). + +:- pred all_vars_match_resume_map(resume_map::in, + assoc_list(prog_var, set(lval))::in) is semidet. + +all_vars_match_resume_map(_Map, []). +all_vars_match_resume_map(Map, [Var - Actual | VarsActuals]) :- + map.search(Map, Var, Lvals), + set.subset(Lvals, Actual), + all_vars_match_resume_map(Map, VarsActuals). + +:- pred pick_first_resume_point(resume_point_info::in, + resume_map::out, code_addr::out) is det. + +pick_first_resume_point(orig_only(Map, Addr), Map, Addr). +pick_first_resume_point(stack_only(Map, Addr), Map, Addr). +pick_first_resume_point(orig_and_stack(Map, Addr, _, _), Map, Addr). +pick_first_resume_point(stack_and_orig(Map, Addr, _, _), Map, Addr). + +:- pred pick_stack_resume_point(resume_point_info::in, + resume_map::out, code_addr::out) is det. + +pick_stack_resume_point(ResumePoint, Map, Addr) :- + ( maybe_pick_stack_resume_point(ResumePoint, Map1, Addr1) -> + Map = Map1, + Addr = Addr1 + ; + unexpected($module, $pred, "no stack resume point") + ). + +:- pred maybe_pick_stack_resume_point(resume_point_info::in, + resume_map::out, code_addr::out) is semidet. + +maybe_pick_stack_resume_point(stack_only(Map, Addr), Map, Addr). +maybe_pick_stack_resume_point(orig_and_stack(_, _, Map, Addr), + Map, Addr). +maybe_pick_stack_resume_point(stack_and_orig(Map, Addr, _, _), + Map, Addr). + +%---------------------------------------------------------------------------% + +produce_vars([], Map, empty, !CI) :- + map.init(Map). +produce_vars([Var | Vars], Map, Code, !CI) :- + produce_vars(Vars, Map0, CodeVars, !CI), + produce_variable_in_reg_or_stack(Var, CodeVar, Lval, !CI), + Lvals = set.make_singleton_set(Lval), + map.set(Var, Lvals, Map0, Map), + Code = CodeVars ++ CodeVar. + +flush_resume_vars_to_stack(Code, !CI) :- + compute_resume_var_stack_locs(!.CI, VarLocs), + place_vars(VarLocs, Code, !CI). + +:- pred compute_resume_var_stack_locs(code_info::in, + assoc_list(prog_var, lval)::out) is det. + +compute_resume_var_stack_locs(CI, VarLocs) :- + get_fail_info(CI, FailInfo), + FailInfo = fail_info(ResumePointStack, _, _, _, _), + stack.det_top(ResumePointStack, ResumePoint), + pick_stack_resume_point(ResumePoint, StackMap, _), + map.to_assoc_list(StackMap, VarLocSets), + pick_var_places(VarLocSets, VarLocs). + +%---------------------------------------------------------------------------% + +:- pred init_fail_info(code_model::in, maybe(set_of_progvar)::in, + resume_point_info::out, code_info::in, code_info::out) is det. + +init_fail_info(CodeModel, MaybeFailVars, ResumePoint, !CI) :- + ( + CodeModel = model_det, + get_next_label(ResumeLabel, !CI), + ResumeAddress = code_label(ResumeLabel), + ResumeKnown = resume_point_unknown, + CurfrMaxfr = may_be_different + ; + CodeModel = model_semi, + % The resume point for this label will be part of the procedure epilog. + get_next_label(ResumeLabel, !CI), + ResumeAddress = code_label(ResumeLabel), + ResumeKnown = resume_point_known(wont_be_done), + CurfrMaxfr = may_be_different + ; + CodeModel = model_non, + ( + MaybeFailVars = yes(_), + get_next_label(ResumeLabel, !CI), + ResumeAddress = code_label(ResumeLabel) + ; + MaybeFailVars = no, + ResumeAddress = do_fail + ), + ResumeKnown = resume_point_known(has_been_done), + CurfrMaxfr = must_be_equal + ), + ( + MaybeFailVars = yes(FailVars), + get_stack_slots(!.CI, StackSlots), + map.select_sorted_list(StackSlots, set_of_var.to_sorted_list(FailVars), + AbsStackMap), + map.to_assoc_list(AbsStackMap, AbsStackList), + StackList0 = assoc_list.map_values_only(stack_slot_to_lval, + AbsStackList), + make_singleton_sets(StackList0, StackList), + map.from_sorted_assoc_list(StackList, StackMap) + ; + MaybeFailVars = no, + map.init(StackMap) + ), + ResumePoint = stack_only(StackMap, ResumeAddress), + stack.init(ResumeStack0), + stack.push(ResumePoint, ResumeStack0, ResumeStack), + get_fail_info(!.CI, FailInfo0), + FailInfo0 = fail_info(_, _, _, _, Allow), + FailInfo = fail_info(ResumeStack, ResumeKnown, CurfrMaxfr, + not_inside_non_condition, Allow), + set_fail_info(FailInfo, !CI). + +%---------------------------------------------------------------------------% + +make_resume_point(ResumeVars, ResumeLocs, FullMap, ResumePoint, !CI) :- + get_stack_slots(!.CI, StackSlots), + map.select_sorted_list(FullMap, ResumeVars, OrigMap), + ( + ResumeLocs = resume_locs_orig_only, + get_next_label(OrigLabel, !CI), + OrigAddr = code_label(OrigLabel), + ResumePoint = orig_only(OrigMap, OrigAddr), + trace [compiletime(flag("codegen_goal")), io(!IO)] ( + ( should_trace_code_gen(!.CI) -> + code_info.get_varset(!.CI, VarSet), + io.write_string("orig_only\n", !IO), + output_resume_map(VarSet, OrigMap, !IO), + io.flush_output(!IO) + ; + true + ) + ) + ; + ResumeLocs = resume_locs_stack_only, + make_stack_resume_map(ResumeVars, StackSlots, StackMap), + get_next_label(StackLabel, !CI), + StackAddr = code_label(StackLabel), + ResumePoint = stack_only(StackMap, StackAddr), + trace [compiletime(flag("codegen_goal")), io(!IO)] ( + ( should_trace_code_gen(!.CI) -> + code_info.get_varset(!.CI, VarSet), + io.write_string("stack_only\n", !IO), + output_resume_map(VarSet, StackMap, !IO), + io.flush_output(!IO) + ; + true + ) + ) + ; + ResumeLocs = resume_locs_orig_and_stack, + make_stack_resume_map(ResumeVars, StackSlots, StackMap), + get_next_label(OrigLabel, !CI), + OrigAddr = code_label(OrigLabel), + get_next_label(StackLabel, !CI), + StackAddr = code_label(StackLabel), + ResumePoint = orig_and_stack(OrigMap, OrigAddr, StackMap, StackAddr), + trace [compiletime(flag("codegen_goal")), io(!IO)] ( + ( should_trace_code_gen(!.CI) -> + code_info.get_varset(!.CI, VarSet), + io.write_string("stack_and_orig\n", !IO), + io.write_string("orig:\n", !IO), + output_resume_map(VarSet, OrigMap, !IO), + io.write_string("stack:\n", !IO), + output_resume_map(VarSet, StackMap, !IO), + io.flush_output(!IO) + ; + true + ) + ) + ; + ResumeLocs = resume_locs_stack_and_orig, + make_stack_resume_map(ResumeVars, StackSlots, StackMap), + get_next_label(StackLabel, !CI), + StackAddr = code_label(StackLabel), + get_next_label(OrigLabel, !CI), + OrigAddr = code_label(OrigLabel), + ResumePoint = stack_and_orig(StackMap, StackAddr, OrigMap, OrigAddr), + trace [compiletime(flag("codegen_goal")), io(!IO)] ( + ( should_trace_code_gen(!.CI) -> + code_info.get_varset(!.CI, VarSet), + io.write_string("stack_and_orig\n", !IO), + io.write_string("stack:\n", !IO), + output_resume_map(VarSet, StackMap, !IO), + io.write_string("orig:\n", !IO), + output_resume_map(VarSet, OrigMap, !IO), + io.flush_output(!IO) + ; + true + ) + ) + ). + +:- pred make_stack_resume_map(list(prog_var)::in, stack_slots::in, + map(prog_var, set(lval))::out) is det. + +make_stack_resume_map(ResumeVars, StackSlots, StackMap) :- + map.select_sorted_list(StackSlots, ResumeVars, StackMap0), + map.to_assoc_list(StackMap0, AbsStackList), + StackList0 = assoc_list.map_values_only(stack_slot_to_lval, AbsStackList), + make_singleton_sets(StackList0, StackList), + map.from_sorted_assoc_list(StackList, StackMap). + +:- pred make_singleton_sets(assoc_list(prog_var, lval)::in, + assoc_list(prog_var, set(lval))::out) is det. + +make_singleton_sets([], []). +make_singleton_sets([Var - Lval | Tail], [Var - Lvals | SetTail]) :- + Lvals = set.make_singleton_set(Lval), + make_singleton_sets(Tail, SetTail). + +%---------------------------------------------------------------------------% + + % The code we generate for a resumption point looks like this: + % + % label(StackLabel) + % + % + % label(OrigLabel) + % + % + % Failures at different points may cause control to arrive at + % the resumption point via either label, which is why the last + % line is necessary. + % + % The idea is that failures from other procedures will go to + % StackLabel, and that failures from this procedure while + % everything is in its original place will go to OrigLabel. + % Failures from this procedure where not everything is in its + % original place can go to either, after moving the resume variables + % to the places where the label expects them. + % + % The above layout (stack, then orig) is the most common. However, + % liveness.m may decide that one or other of the two labels will + % never be referred to (e.g. because there are no calls inside + % the range of effect of the resumption point or because a call + % follows immediately after the establishment of the resumption + % point), or that it would be more efficient to put the two labels + % in the other order (e.g. because the code after the resumption point + % needs most of the variables in their stack slots). + +generate_resume_point(ResumePoint, Code, !CI) :- + ( + ResumePoint = orig_only(Map1, Addr1), + extract_label_from_code_addr(Addr1, Label1), + Code = singleton( + llds_instr(label(Label1), "orig only failure continuation") + ), + set_var_locations(Map1, !CI) + ; + ResumePoint = stack_only(Map1, Addr1), + extract_label_from_code_addr(Addr1, Label1), + Code = singleton( + llds_instr(label(Label1), "stack only failure continuation") + ), + set_var_locations(Map1, !CI), + generate_resume_layout(Label1, Map1, !CI) + ; + ResumePoint = stack_and_orig(Map1, Addr1, Map2, Addr2), + extract_label_from_code_addr(Addr1, Label1), + extract_label_from_code_addr(Addr2, Label2), + Label1Code = singleton( + llds_instr(label(Label1), "stack failure continuation before orig") + ), + set_var_locations(Map1, !CI), + generate_resume_layout(Label1, Map1, !CI), + map.to_assoc_list(Map2, AssocList2), + place_resume_vars(AssocList2, PlaceCode, !CI), + Label2Code = singleton( + llds_instr(label(Label2), "orig failure continuation after stack") + ), + set_var_locations(Map2, !CI), + Code = Label1Code ++ PlaceCode ++ Label2Code + ; + ResumePoint = orig_and_stack(Map1, Addr1, Map2, Addr2), + extract_label_from_code_addr(Addr1, Label1), + extract_label_from_code_addr(Addr2, Label2), + Label1Code = singleton( + llds_instr(label(Label1), "orig failure continuation before stack") + ), + set_var_locations(Map1, !CI), + map.to_assoc_list(Map2, AssocList2), + place_resume_vars(AssocList2, PlaceCode, !CI), + Label2Code = singleton( + llds_instr(label(Label2), "stack failure continuation after orig") + ), + set_var_locations(Map2, !CI), + generate_resume_layout(Label2, Map2, !CI), + Code = Label1Code ++ PlaceCode ++ Label2Code + ). + +:- pred extract_label_from_code_addr(code_addr::in, label::out) is det. + +extract_label_from_code_addr(CodeAddr, Label) :- + ( CodeAddr = code_label(Label0) -> + Label = Label0 + ; + unexpected($module, $pred, "non-label") + ). + +:- pred place_resume_vars(assoc_list(prog_var, set(lval))::in, + llds_code::out, code_info::in, code_info::out) is det. + +place_resume_vars([], empty, !CI). +place_resume_vars([Var - TargetSet | Rest], Code, !CI) :- + set.to_sorted_list(TargetSet, Targets), + place_resume_var(Var, Targets, FirstCode, !CI), + place_resume_vars(Rest, RestCode, !CI), + Code = FirstCode ++ RestCode. + +:- pred place_resume_var(prog_var::in, list(lval)::in, + llds_code::out, code_info::in, code_info::out) is det. + +place_resume_var(_Var, [], empty, !CI). +place_resume_var(Var, [Target | Targets], Code, !CI) :- + place_var(Var, Target, FirstCode, !CI), + place_resume_var(Var, Targets, RestCode, !CI), + Code = FirstCode ++ RestCode. + + % Reset the code generator's database of what is where. + % Remember that the variables in the map are available in their + % associated rvals; forget about all other variables. + % +:- pred set_var_locations(resume_map::in, + code_info::in, code_info::out) is det. + +set_var_locations(Map, !CI) :- + map.to_assoc_list(Map, LvalList0), + flatten_varlval_list(LvalList0, LvalList), + get_var_locn_info(!.CI, VarLocnInfo0), + reinit_var_locn_state(LvalList, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +:- pred flatten_varlval_list(assoc_list(prog_var, set(lval))::in, + assoc_list(prog_var, lval)::out) is det. + +flatten_varlval_list([], []). +flatten_varlval_list([V - Rvals | Rest0], All) :- + flatten_varlval_list(Rest0, Rest), + set.to_sorted_list(Rvals, RvalList), + flatten_varlval_list_2(RvalList, V, Rest1), + list.append(Rest1, Rest, All). + +:- pred flatten_varlval_list_2(list(lval)::in, prog_var::in, + assoc_list(prog_var, lval)::out) is det. + +flatten_varlval_list_2([], _V, []). +flatten_varlval_list_2([R | Rs], V, [V - R | Rest]) :- + flatten_varlval_list_2(Rs, V, Rest). + +resume_point_vars(ResumePoint, Vars) :- + pick_first_resume_point(ResumePoint, ResumeMap, _), + map.keys(ResumeMap, Vars). + +resume_point_stack_addr(ResumePoint, StackAddr) :- + pick_stack_resume_point(ResumePoint, _, StackAddr). + +%---------------------------------------------------------------------------% + +:- pred maybe_save_trail_info(add_trail_ops::in, maybe(pair(lval))::out, + llds_code::out, code_info::in, code_info::out) is det. + +maybe_save_trail_info(AddTrailOps, MaybeTrailSlots, SaveTrailCode, !CI) :- + ( + AddTrailOps = add_trail_ops, + acquire_temp_slot(slot_ticket_counter, non_persistent_temp_slot, + CounterSlot, !CI), + acquire_temp_slot(slot_ticket, non_persistent_temp_slot, + TrailPtrSlot, !CI), + MaybeTrailSlots = yes(CounterSlot - TrailPtrSlot), + SaveTrailCode = from_list([ + llds_instr(mark_ticket_stack(CounterSlot), + "save the ticket counter"), + llds_instr(store_ticket(TrailPtrSlot), + "save the trail pointer") + ]) + ; + AddTrailOps = do_not_add_trail_ops, + MaybeTrailSlots = no, + SaveTrailCode = empty + ). + +:- pred maybe_restore_trail_info(maybe(pair(lval))::in, + llds_code::out, llds_code::out, code_info::in, code_info::out) is det. + +maybe_restore_trail_info(MaybeTrailSlots, CommitCode, RestoreCode, !CI) :- + ( + MaybeTrailSlots = no, + CommitCode = empty, + RestoreCode = empty + ; + MaybeTrailSlots = yes(CounterSlot - TrailPtrSlot), + CommitCode = from_list([ + llds_instr(reset_ticket(lval(TrailPtrSlot), reset_reason_commit), + "discard trail entries and restore trail ptr"), + llds_instr(prune_tickets_to(lval(CounterSlot)), + "restore ticket counter (but not high water mark)") + ]), + RestoreCode = from_list([ + llds_instr(reset_ticket(lval(TrailPtrSlot), reset_reason_undo), + "apply trail entries and restore trail ptr"), + llds_instr(discard_ticket, + "restore ticket counter and high water mark") + ]), + release_temp_slot(CounterSlot, non_persistent_temp_slot, !CI), + release_temp_slot(TrailPtrSlot, non_persistent_temp_slot, !CI) + ). + +%---------------------------------------------------------------------------% + +:- pred clone_resume_point(resume_point_info::in, + resume_point_info::out, code_info::in, code_info::out) is det. + +clone_resume_point(ResumePoint0, ResumePoint, !CI) :- + ( + ResumePoint0 = orig_only(_, _), + unexpected($module, $pred, "cloning orig_only resume point") + ; + ResumePoint0 = stack_only(Map1, _), + get_next_label(Label1, !CI), + Addr1 = code_label(Label1), + ResumePoint = stack_only(Map1, Addr1) + ; + ResumePoint0 = stack_and_orig(Map1, _, Map2, _), + get_next_label(Label1, !CI), + Addr1 = code_label(Label1), + get_next_label(Label2, !CI), + Addr2 = code_label(Label2), + ResumePoint = stack_and_orig(Map1, Addr1, Map2, Addr2) + ; + ResumePoint0 = orig_and_stack(Map1, _, Map2, _), + get_next_label(Label2, !CI), + Addr2 = code_label(Label2), + get_next_label(Label1, !CI), + Addr1 = code_label(Label1), + ResumePoint = stack_and_orig(Map2, Addr2, Map1, Addr1) + ). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule to deal with liveness issues. + + % The principles underlying this submodule of code_info.m are + % documented in the file compiler/notes/allocation.html. + +:- interface. + +:- pred add_forward_live_vars(set_of_progvar::in, + code_info::in, code_info::out) is det. + +:- pred get_known_variables(code_info::in, list(prog_var)::out) is det. + +:- pred variable_is_forward_live(code_info::in, prog_var::in) is semidet. + +:- pred make_vars_forward_dead(set_of_progvar::in, + code_info::in, code_info::out) is det. + +:- pred maybe_make_vars_forward_dead(set_of_progvar::in, bool::in, + code_info::in, code_info::out) is det. + +:- pred pickup_zombies(set_of_progvar::out, + code_info::in, code_info::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + +:- pred rem_forward_live_vars(set_of_progvar::in, + code_info::in, code_info::out) is det. + + % Make these variables appear magically live. + % We don't care where they are put. + % +:- pred make_vars_forward_live(set_of_progvar::in, + code_info::in, code_info::out) is det. + +get_known_variables(CI, VarList) :- + get_forward_live_vars(CI, ForwardLiveVars), + ResumeVars = current_resume_point_vars(CI), + set_of_var.union(ForwardLiveVars, ResumeVars, Vars), + VarList = set_of_var.to_sorted_list(Vars). + +variable_is_forward_live(CI, Var) :- + get_forward_live_vars(CI, Liveness), + set_of_var.member(Liveness, Var). + +add_forward_live_vars(Births, !CI) :- + get_forward_live_vars(!.CI, Liveness0), + set_of_var.union(Liveness0, Births, Liveness), + set_forward_live_vars(Liveness, !CI). + +rem_forward_live_vars(Deaths, !CI) :- + get_forward_live_vars(!.CI, Liveness0), + set_of_var.difference(Liveness0, Deaths, Liveness), + set_forward_live_vars(Liveness, !CI). + +make_vars_forward_live(Vars, !CI) :- + get_stack_slots(!.CI, StackSlots), + get_var_locn_info(!.CI, VarLocnInfo0), + VarList = set_of_var.to_sorted_list(Vars), + make_vars_forward_live_2(VarList, StackSlots, 1, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +:- pred make_vars_forward_live_2(list(prog_var)::in, + stack_slots::in, int::in, var_locn_info::in, var_locn_info::out) + is det. + +make_vars_forward_live_2([], _, _, !VarLocnInfo). +make_vars_forward_live_2([Var | Vars], StackSlots, N0, !VarLocnInfo) :- + ( map.search(StackSlots, Var, Slot) -> + Lval = stack_slot_to_lval(Slot), + N1 = N0 + ; + % reg_r is fine since we don't care where the variables are put. + RegType = reg_r, + find_unused_reg(!.VarLocnInfo, RegType, N0, N1), + Lval = reg(RegType, N1) + ), + var_locn_set_magic_var_location(Var, Lval, !VarLocnInfo), + make_vars_forward_live_2(Vars, StackSlots, N1, !VarLocnInfo). + +:- pred find_unused_reg(var_locn_info::in, reg_type::in, int::in, int::out) + is det. + +find_unused_reg(VLI, RegType, N0, N) :- + ( var_locn_lval_in_use(VLI, reg(RegType, N0)) -> + find_unused_reg(VLI, RegType, N0 + 1, N) + ; + N = N0 + ). + +make_vars_forward_dead(Vars, !CI) :- + maybe_make_vars_forward_dead(Vars, yes, !CI). + +maybe_make_vars_forward_dead(Vars0, FirstTime, !CI) :- + ResumeVars = current_resume_point_vars(!.CI), + set_of_var.intersect(Vars0, ResumeVars, FlushVars), + get_zombies(!.CI, Zombies0), + set_of_var.union(Zombies0, FlushVars, Zombies), + set_zombies(Zombies, !CI), + set_of_var.difference(Vars0, Zombies, Vars), + VarList = set_of_var.to_sorted_list(Vars), + get_var_locn_info(!.CI, VarLocnInfo0), + maybe_make_vars_forward_dead_2(VarList, FirstTime, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +:- pred maybe_make_vars_forward_dead_2(list(prog_var)::in, bool::in, + var_locn_info::in, var_locn_info::out) is det. + +maybe_make_vars_forward_dead_2([], _, !VLI). +maybe_make_vars_forward_dead_2([Var | Vars], FirstTime, !VLI) :- + var_locn_var_becomes_dead(Var, FirstTime, !VLI), + maybe_make_vars_forward_dead_2(Vars, FirstTime, !VLI). + +pickup_zombies(Zombies, !CI) :- + get_zombies(!.CI, Zombies), + set_zombies(set_of_var.init, !CI). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for handling the saving and restoration + % of trail tickets, heap pointers, stack pointers etc. + +:- interface. + +:- pred save_hp(llds_code::out, lval::out, + code_info::in, code_info::out) is det. + +:- pred restore_hp(lval::in, llds_code::out) is det. + +:- pred release_hp(lval::in, code_info::in, code_info::out) is det. + +:- pred restore_and_release_hp(lval::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred maybe_save_hp(bool::in, llds_code::out, maybe(lval)::out, + code_info::in, code_info::out) is det. + +:- pred maybe_restore_hp(maybe(lval)::in, llds_code::out) is det. + +:- pred maybe_release_hp(maybe(lval)::in, + code_info::in, code_info::out) is det. + +:- pred maybe_restore_and_release_hp(maybe(lval)::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred save_ticket(llds_code::out, lval::out, + code_info::in, code_info::out) is det. + +:- pred reset_ticket(lval::in, reset_trail_reason::in, llds_code::out) is det. + +:- pred release_ticket(lval::in, code_info::in, code_info::out) is det. + +:- pred reset_and_prune_ticket(lval::in, reset_trail_reason::in, + llds_code::out) is det. + +:- pred reset_prune_and_release_ticket(lval::in, reset_trail_reason::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred reset_and_discard_ticket(lval::in, reset_trail_reason::in, + llds_code::out) is det. + +:- pred reset_discard_and_release_ticket(lval::in, reset_trail_reason::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred discard_and_release_ticket(lval::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred maybe_save_ticket(add_trail_ops::in, llds_code::out, + maybe(lval)::out, code_info::in, code_info::out) is det. + +:- pred maybe_reset_ticket(maybe(lval)::in, reset_trail_reason::in, + llds_code::out) is det. + +:- pred maybe_release_ticket(maybe(lval)::in, + code_info::in, code_info::out) is det. + +:- pred maybe_reset_and_prune_ticket(maybe(lval)::in, + reset_trail_reason::in, llds_code::out) is det. + +:- pred maybe_reset_prune_and_release_ticket(maybe(lval)::in, + reset_trail_reason::in, llds_code::out, code_info::in, code_info::out) + is det. + +:- pred maybe_reset_and_discard_ticket(maybe(lval)::in, + reset_trail_reason::in, llds_code::out) is det. + +:- pred maybe_reset_discard_and_release_ticket(maybe(lval)::in, + reset_trail_reason::in, llds_code::out, code_info::in, code_info::out) + is det. + +:- pred maybe_discard_and_release_ticket(maybe(lval)::in, llds_code::out, + code_info::in, code_info::out) is det. + + % Should we add trail ops to the code we generate for the goal with the + % given goal_info. This will be 'no' unless we are in a trailing grade. + % +:- func should_add_trail_ops(code_info, hlds_goal_info) = add_trail_ops. + + % Should we add region ops to the code we generate for the goal with the + % given goal_info. This will be 'no' unless we are in a rbmm grade. + % +:- func should_add_region_ops(code_info, hlds_goal_info) = add_region_ops. + +%---------------------------------------------------------------------------% + +:- implementation. + +save_hp(Code, HpSlot, !CI) :- + acquire_temp_slot(slot_lval(hp), non_persistent_temp_slot, HpSlot, !CI), + Code = singleton( + llds_instr(mark_hp(HpSlot), "Save heap pointer") + ). + +restore_hp(HpSlot, Code) :- + Code = singleton( + llds_instr(restore_hp(lval(HpSlot)), "Restore heap pointer") + ). + +release_hp(HpSlot, !CI) :- + release_temp_slot(HpSlot, non_persistent_temp_slot, !CI). + +restore_and_release_hp(HpSlot, Code, !CI) :- + restore_hp(HpSlot, Code), + release_hp(HpSlot, !CI). + +%---------------------------------------------------------------------------% + +maybe_save_hp(Maybe, Code, MaybeHpSlot, !CI) :- + ( + Maybe = yes, + save_hp(Code, HpSlot, !CI), + MaybeHpSlot = yes(HpSlot) + ; + Maybe = no, + Code = empty, + MaybeHpSlot = no + ). + +maybe_restore_hp(MaybeHpSlot, Code) :- + ( + MaybeHpSlot = yes(HpSlot), + restore_hp(HpSlot, Code) + ; + MaybeHpSlot = no, + Code = empty + ). + +maybe_release_hp(MaybeHpSlot, !CI) :- + ( + MaybeHpSlot = yes(HpSlot), + release_hp(HpSlot, !CI) + ; + MaybeHpSlot = no + ). + +maybe_restore_and_release_hp(MaybeHpSlot, Code, !CI) :- + ( + MaybeHpSlot = yes(HpSlot), + restore_and_release_hp(HpSlot, Code, !CI) + ; + MaybeHpSlot = no, + Code = empty + ). + +%---------------------------------------------------------------------------% + +save_ticket(Code, TicketSlot, !CI) :- + acquire_temp_slot(slot_ticket, non_persistent_temp_slot, TicketSlot, !CI), + Code = singleton( + llds_instr(store_ticket(TicketSlot), "Save trail state") + ). + +reset_ticket(TicketSlot, Reason, Code) :- + Code = singleton( + llds_instr(reset_ticket(lval(TicketSlot), Reason), "Reset trail") + ). + +release_ticket(TicketSlot, !CI) :- + release_temp_slot(TicketSlot, non_persistent_temp_slot, !CI). + +reset_and_prune_ticket(TicketSlot, Reason, Code) :- + Code = from_list([ + llds_instr(reset_ticket(lval(TicketSlot), Reason), "Restore trail"), + llds_instr(prune_ticket, "Prune ticket stack") + ]). + +reset_prune_and_release_ticket(TicketSlot, Reason, Code, !CI) :- + Code = from_list([ + llds_instr(reset_ticket(lval(TicketSlot), Reason), "Release trail"), + llds_instr(prune_ticket, "Prune ticket stack") + ]), + release_temp_slot(TicketSlot, non_persistent_temp_slot, !CI). + +reset_and_discard_ticket(TicketSlot, Reason, Code) :- + Code = from_list([ + llds_instr(reset_ticket(lval(TicketSlot), Reason), "Restore trail"), + llds_instr(discard_ticket, "Pop ticket stack") + ]). + +reset_discard_and_release_ticket(TicketSlot, Reason, Code, !CI) :- + Code = from_list([ + llds_instr(reset_ticket(lval(TicketSlot), Reason), "Release trail"), + llds_instr(discard_ticket, "Pop ticket stack") + ]), + release_temp_slot(TicketSlot, non_persistent_temp_slot, !CI). + +discard_and_release_ticket(TicketSlot, Code, !CI) :- + Code = singleton( + llds_instr(discard_ticket, "Pop ticket stack") + ), + release_temp_slot(TicketSlot, non_persistent_temp_slot, !CI). + +%---------------------------------------------------------------------------% + +maybe_save_ticket(AddTrailOps, Code, MaybeTicketSlot, !CI) :- + ( + AddTrailOps = add_trail_ops, + save_ticket(Code, TicketSlot, !CI), + MaybeTicketSlot = yes(TicketSlot) + ; + AddTrailOps = do_not_add_trail_ops, + Code = empty, + MaybeTicketSlot = no + ). + +maybe_reset_ticket(MaybeTicketSlot, Reason, Code) :- + ( + MaybeTicketSlot = yes(TicketSlot), + reset_ticket(TicketSlot, Reason, Code) + ; + MaybeTicketSlot = no, + Code = empty + ). + +maybe_release_ticket(MaybeTicketSlot, !CI) :- + ( + MaybeTicketSlot = yes(TicketSlot), + release_ticket(TicketSlot, !CI) + ; + MaybeTicketSlot = no + ). + +maybe_reset_and_prune_ticket(MaybeTicketSlot, Reason, Code) :- + ( + MaybeTicketSlot = yes(TicketSlot), + reset_and_prune_ticket(TicketSlot, Reason, Code) + ; + MaybeTicketSlot = no, + Code = empty + ). + +maybe_reset_prune_and_release_ticket(MaybeTicketSlot, Reason, + Code, !CI) :- + ( + MaybeTicketSlot = yes(TicketSlot), + reset_prune_and_release_ticket(TicketSlot, Reason, + Code, !CI) + ; + MaybeTicketSlot = no, + Code = empty + ). + +maybe_reset_and_discard_ticket(MaybeTicketSlot, Reason, Code) :- + ( + MaybeTicketSlot = yes(TicketSlot), + reset_and_discard_ticket(TicketSlot, Reason, Code) + ; + MaybeTicketSlot = no, + Code = empty + ). + +maybe_reset_discard_and_release_ticket(MaybeTicketSlot, Reason, + Code, !CI) :- + ( + MaybeTicketSlot = yes(TicketSlot), + reset_discard_and_release_ticket(TicketSlot, Reason, + Code, !CI) + ; + MaybeTicketSlot = no, + Code = empty + ). + +maybe_discard_and_release_ticket(MaybeTicketSlot, Code, !CI) :- + ( + MaybeTicketSlot = yes(TicketSlot), + discard_and_release_ticket(TicketSlot, Code, !CI) + ; + MaybeTicketSlot = no, + Code = empty + ). + + % XXX We will eventually need to make use of GoalInfo here. + % +should_add_trail_ops(CodeInfo, _GoalInfo) = AddTrailOps :- + get_emit_trail_ops(CodeInfo, AddTrailOps). + + % XXX We will eventually need to make use of GoalInfo here. + % +should_add_region_ops(CodeInfo, _GoalInfo) = AddRegionOps :- + get_emit_region_ops(CodeInfo, AddRegionOps). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule to deal with var_locn. + + % Most of these procedures just forward to the var_locn module. + % See var_locn for documentation. + +:- interface. + +:- pred variable_locations(code_info::in, + map(prog_var, set(lval))::out) is det. + +:- pred set_var_location(prog_var::in, lval::in, + code_info::in, code_info::out) is det. + +:- pred assign_var_to_var(prog_var::in, prog_var::in, + code_info::in, code_info::out) is det. + +:- pred assign_lval_to_var(prog_var::in, lval::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred assign_const_to_var(prog_var::in, rval::in, + code_info::in, code_info::out) is det. + +:- pred assign_expr_to_var(prog_var::in, rval::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred reassign_mkword_hole_var(prog_var::in, tag::in, rval::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred assign_field_lval_expr_to_var(prog_var::in, list(lval)::in, rval::in, + llds_code::out, code_info::in, code_info::out) is det. + + % assign_cell_to_var(Var, ReserveWordAtStart, Ptag, MaybeRvals, + % AllFilled, MaybeSize, FieldAddrs, TypeMsg, MayUseAtomic, Where, + % Code, !CI). + % +:- pred assign_cell_to_var(prog_var::in, bool::in, tag::in, + list(cell_arg)::in, how_to_construct::in, maybe(term_size_value)::in, + maybe(alloc_site_id)::in, may_use_atomic_alloc::in, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred save_reused_cell_fields(prog_var::in, lval::in, llds_code::out, + list(lval)::out, code_info::in, code_info::out) is det. + +:- pred place_var(prog_var::in, lval::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred produce_variable(prog_var::in, llds_code::out, rval::out, + code_info::in, code_info::out) is det. + +:- pred produce_variable_in_reg(prog_var::in, llds_code::out, + lval::out, code_info::in, code_info::out) is det. + +:- pred produce_variable_in_reg_or_stack(prog_var::in, + llds_code::out, lval::out, code_info::in, code_info::out) is det. + +:- pred materialize_vars_in_lval(lval::in, lval::out, + llds_code::out, code_info::in, code_info::out) is det. + +:- pred acquire_reg_for_var(prog_var::in, reg_type::in, lval::out, + code_info::in, code_info::out) is det. + +:- pred acquire_reg_not_in_storemap(abs_store_map::in, reg_type::in, lval::out, + code_info::in, code_info::out) is det. + +:- pred acquire_reg(reg_type::in, lval::out, + code_info::in, code_info::out) is det. + +:- pred release_reg(lval::in, code_info::in, code_info::out) is det. + +:- pred reserve_r1(llds_code::out, code_info::in, code_info::out) is det. + +:- pred clear_r1(llds_code::out, code_info::in, code_info::out) is det. + +:- type call_direction + ---> caller + ; callee. + + % Move variables to where they need to be at the time of the call: + % + % - The variables that need to be saved across the call (either because + % they are forward live after the call or because they are protected + % by an enclosing resumption point) will be saved on the stack. + % Note that if the call cannot succeed and the trace level is none, + % then no variables need to be saved across the call. (If the call + % cannot succeed but the trace level is not none, then we still + % save the usual variables on the stack to make them available + % for up-level printing in the debugger.) + % + % - The input arguments will be moved to their registers. + % +:- pred setup_call(hlds_goal_info::in, assoc_list(prog_var, arg_info)::in, + set(lval)::out, llds_code::out, code_info::in, code_info::out) is det. + + % Move the output arguments of the current procedure to where + % they need to be at return. + % +:- pred setup_return(assoc_list(prog_var, arg_info)::in, + set(lval)::out, llds_code::out, code_info::in, code_info::out) is det. + +:- pred lock_regs(int::in, int::in, assoc_list(prog_var, lval)::in, + code_info::in, code_info::out) is det. + +:- pred unlock_regs(code_info::in, code_info::out) is det. + + % Record the fact that all the registers have been clobbered (as by a + % call). If the bool argument is true, then the call cannot return, and + % thus it is OK for this action to delete the last record of the state + % of a variable. + % +:- pred clear_all_registers(bool::in, code_info::in, code_info::out) is det. + +:- pred clobber_regs(list(lval)::in, code_info::in, code_info::out) is det. + +:- pred save_variables(set_of_progvar::in, set(lval)::out, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred save_variables_on_stack(list(prog_var)::in, llds_code::out, + code_info::in, code_info::out) is det. + +:- pred max_reg_in_use(code_info::in, int::out, int::out) is det. + +:- pred magically_put_var_in_unused_reg(prog_var::in, + code_info::in, code_info::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + +variable_locations(CI, Lvals) :- + get_var_locn_info(CI, VarLocnInfo), + var_locn_get_var_locations(VarLocnInfo, Lvals). + +:- func rval_map_to_lval_map(prog_var, set(rval)) = set(lval). + +rval_map_to_lval_map(_Var, Rvals) = + set.filter_map(rval_is_lval, Rvals). + +:- func rval_is_lval(rval) = lval is semidet. + +rval_is_lval(lval(Lval)) = Lval. + +set_var_location(Var, Lval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_check_and_set_magic_var_location(Var, Lval, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +assign_var_to_var(Var, AssignedVar, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_assign_var_to_var(Var, AssignedVar, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +assign_lval_to_var(Var, Lval, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_static_cell_info(!.CI, StaticCellInfo), + get_module_info(!.CI, ModuleInfo), + var_locn_assign_lval_to_var(ModuleInfo, Var, Lval, + StaticCellInfo, Code, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +assign_const_to_var(Var, ConstRval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_exprn_opts(!.CI, ExprnOpts), + var_locn_assign_const_to_var(ExprnOpts, Var, ConstRval, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +assign_expr_to_var(Var, Rval, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + Lvals = lvals_in_rval(Rval), + ( + Lvals = [], + var_locn_assign_expr_to_var(Var, Rval, Code, + VarLocnInfo0, VarLocnInfo) + ; + Lvals = [_ | _], + unexpected($module, $pred, "non-var lvals") + ), + set_var_locn_info(VarLocnInfo, !CI). + +reassign_mkword_hole_var(Var, Ptag, Rval, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + Lvals = lvals_in_rval(Rval), + ( + Lvals = [], + var_locn_reassign_mkword_hole_var(Var, Ptag, Rval, Code, + VarLocnInfo0, VarLocnInfo) + ; + Lvals = [_ | _], + unexpected($module, $pred, "non-var lvals") + ), + set_var_locn_info(VarLocnInfo, !CI). + +assign_field_lval_expr_to_var(Var, FieldLvals, Rval, Code, !CI) :- + ( + FieldLvals = [field(MaybeTag, var(BaseVar), _) | RestFieldLvals], + list.all_true(is_var_field(MaybeTag, BaseVar), RestFieldLvals) + -> + ( + Lvals = lvals_in_rval(Rval), + all [Lval] ( + list.member(Lval, Lvals) + => + list.member(Lval, FieldLvals) + ) + -> + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_assign_field_lval_expr_to_var(Var, BaseVar, Rval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI) + ; + unexpected($module, $pred, "rval contains unexpected lval") + ) + ; + unexpected($module, $pred, + "FieldLvals not all fields of the same base variable") + ). + +:- pred is_var_field(maybe(tag)::in, prog_var::in, lval::in) is semidet. + +is_var_field(MaybeTag, Var, field(MaybeTag, var(Var), _)). + +assign_cell_to_var(Var, ReserveWordAtStart, Ptag, CellArgs, HowToConstruct, + MaybeSize, MaybeAllocId, MayUseAtomic, Code, !CI) :- + get_next_label(Label, !CI), + get_var_locn_info(!.CI, VarLocnInfo0), + get_static_cell_info(!.CI, StaticCellInfo0), + get_module_info(!.CI, ModuleInfo), + get_exprn_opts(!.CI, ExprnOpts), + var_locn_assign_cell_to_var(ModuleInfo, ExprnOpts, Var, ReserveWordAtStart, + Ptag, CellArgs, HowToConstruct, MaybeSize, MaybeAllocId, MayUseAtomic, + Label, Code, StaticCellInfo0, StaticCellInfo, + VarLocnInfo0, VarLocnInfo), + set_static_cell_info(StaticCellInfo, !CI), + set_var_locn_info(VarLocnInfo, !CI). + +save_reused_cell_fields(Var, Lval, Code, Regs, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_save_cell_fields(ModuleInfo, Var, Lval, Code, Regs, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +place_var(Var, Lval, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_place_var(ModuleInfo, Var, Lval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +:- pred pick_and_place_vars(assoc_list(prog_var, set(lval))::in, + set(lval)::out, llds_code::out, code_info::in, code_info::out) is det. + +pick_and_place_vars(VarLocSets, LiveLocs, Code, !CI) :- + pick_var_places(VarLocSets, VarLocs), + assoc_list.values(VarLocs, Locs), + set.list_to_set(Locs, LiveLocs), + place_vars(VarLocs, Code, !CI). + +:- pred pick_var_places(assoc_list(prog_var, set(lval))::in, + assoc_list(prog_var, lval)::out) is det. + +pick_var_places([], []). +pick_var_places([Var - LvalSet | VarLvalSets], VarLvals) :- + pick_var_places(VarLvalSets, VarLvals0), + ( + set.to_sorted_list(LvalSet, LvalList), + LvalList = [Lval | _] + -> + VarLvals = [Var - Lval | VarLvals0] + ; + VarLvals = VarLvals0 + ). + +:- pred place_vars(assoc_list(prog_var, lval)::in, + llds_code::out, code_info::in, code_info::out) is det. + +place_vars(VarLocs, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_place_vars(ModuleInfo, VarLocs, Code, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +produce_variable(Var, Code, Rval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_produce_var(ModuleInfo, Var, Rval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +produce_variable_in_reg(Var, Code, Lval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_produce_var_in_reg(ModuleInfo, Var, Lval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +produce_variable_in_reg_or_stack(Var, Code, Lval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_produce_var_in_reg_or_stack(ModuleInfo, Var, Lval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +materialize_vars_in_lval(Lval0, Lval, Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_materialize_vars_in_lval(ModuleInfo, Lval0, Lval, Code, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +acquire_reg_for_var(Var, RegType, Lval, !CI) :- + get_follow_var_map(!.CI, FollowVarsMap), + get_next_non_reserved(!.CI, RegType, NextNonReserved), + get_var_locn_info(!.CI, VarLocnInfo0), + ( + map.search(FollowVarsMap, Var, PrefLocn), + PrefLocn = abs_reg(RegType, PrefRegNum), + PrefRegNum >= 1 + -> + var_locn_acquire_reg_prefer_given(RegType, PrefRegNum, Lval, + VarLocnInfo0, VarLocnInfo) + ; + % XXX We should only get a register if the map.search succeeded; + % otherwise we should put the var in its stack slot. + var_locn_acquire_reg_start_at_given(RegType, NextNonReserved, Lval, + VarLocnInfo0, VarLocnInfo) + ), + set_var_locn_info(VarLocnInfo, !CI). + +acquire_reg_not_in_storemap(StoreMap, RegType, Lval, !CI) :- + map.foldl2(record_highest_used_reg, StoreMap, 0, HighestUsedRegR, + 0, HighestUsedRegF), + get_var_locn_info(!.CI, VarLocnInfo0), + ( + RegType = reg_r, + NextRegNum = HighestUsedRegR + 1 + ; + RegType = reg_f, + NextRegNum = HighestUsedRegF + 1 + ), + var_locn_acquire_reg_start_at_given(RegType, NextRegNum, Lval, + VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +:- pred record_highest_used_reg(prog_var::in, abs_locn::in, int::in, int::out, + int::in, int::out) is det. + +record_highest_used_reg(_, AbsLocn, !HighestUsedRegR, !HighestUsedRegF) :- + ( + AbsLocn = any_reg + ; + AbsLocn = abs_reg(reg_r, N), + int.max(N, !HighestUsedRegR) + ; + AbsLocn = abs_reg(reg_f, N), + int.max(N, !HighestUsedRegF) + ; + AbsLocn = abs_stackvar(_, _) + ; + AbsLocn = abs_parent_stackvar(_, _) + ; + AbsLocn = abs_framevar(_, _) + ). + +acquire_reg(Type, Lval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_acquire_reg(Type, Lval, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +release_reg(Lval, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_release_reg(Lval, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +reserve_r1(Code, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + get_module_info(!.CI, ModuleInfo), + var_locn_clear_r1(ModuleInfo, Code, VarLocnInfo0, VarLocnInfo1), + var_locn_acquire_reg_require_given(reg(reg_r, 1), + VarLocnInfo1, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +clear_r1(empty, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_release_reg(reg(reg_r, 1), VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +%---------------------------------------------------------------------------% + +setup_return(VarArgInfos, OutLocs, Code, !CI) :- + setup_call_args(VarArgInfos, callee, OutLocs, Code, !CI). + +setup_call(GoalInfo, ArgInfos, LiveLocs, Code, !CI) :- + partition_args(ArgInfos, InArgInfos, OutArgInfos, _UnusedArgInfos), + assoc_list.keys(OutArgInfos, OutVars), + set.list_to_set(OutVars, OutVarSet), + Detism = goal_info_get_determinism(GoalInfo), + get_opt_no_return_calls(!.CI, OptNoReturnCalls), + get_module_info(!.CI, ModuleInfo), + VarTypes = get_var_types(!.CI), + ( + Detism = detism_erroneous, + OptNoReturnCalls = yes + -> + RealStackVarLocs = [], + DummyStackVarLocs = [] + ; + compute_forward_live_var_saves(!.CI, set_to_bitset(OutVarSet), + ForwardVarLocs), + CodeModel = goal_info_get_code_model(GoalInfo), + ( + CodeModel = model_non, + % Save variables protected by the nearest resumption point on the + % stack. + % XXX This should be unnecessary; with the current setup, the code + % that established the resume point should have saved those + % variables on the stack already. However, later we should arrange + % things so that this saving of the resume vars on the stack + % is delayed until the first call after the setup of the + % resume point. + compute_resume_var_stack_locs(!.CI, ResumeVarLocs), + list.append(ResumeVarLocs, ForwardVarLocs, StackVarLocs) + ; + ( CodeModel = model_det + ; CodeModel = model_semi + ), + StackVarLocs = ForwardVarLocs + ), + list.filter(valid_stack_slot(ModuleInfo, VarTypes), StackVarLocs, + RealStackVarLocs, DummyStackVarLocs) + ), + get_var_locn_info(!.CI, VarLocnInfo0), + list.filter(key_var_is_of_non_dummy_type(ModuleInfo, VarTypes), + InArgInfos, RealInArgInfos), + var_arg_info_to_lval(RealInArgInfos, RealInArgLocs), + AllRealLocs = RealStackVarLocs ++ RealInArgLocs, + AllLocs = DummyStackVarLocs ++ AllRealLocs, + var_locn_place_vars(ModuleInfo, AllLocs, Code, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI), + assoc_list.values(AllRealLocs, LiveLocList), + set.list_to_set(LiveLocList, LiveLocs). + +:- pred key_var_is_of_non_dummy_type(module_info::in, vartypes::in, + pair(prog_var, arg_info)::in) is semidet. + +key_var_is_of_non_dummy_type(ModuleInfo, VarTypes, Var - _ArgInfo) :- + var_is_of_non_dummy_type(ModuleInfo, VarTypes, Var). + +:- pred valid_stack_slot(module_info::in, vartypes::in, + pair(prog_var, lval)::in) is semidet. + +valid_stack_slot(ModuleInfo, VarTypes, Var - Lval) :- + lookup_var_type(VarTypes, Var, Type), + check_dummy_type(ModuleInfo, Type) = is_not_dummy_type, + ( + ( Lval = stackvar(N) + ; Lval = parent_stackvar(N) + ; Lval = framevar(N) + ), + N < 0 + -> + unexpected($module, $pred, "nondummy var in dummy stack slot") + ; + true + ). + +:- pred setup_call_args(assoc_list(prog_var, arg_info)::in, + call_direction::in, set(lval)::out, llds_code::out, + code_info::in, code_info::out) is det. + +setup_call_args(AllArgsInfos, Direction, LiveLocs, Code, !CI) :- + list.filter(call_arg_in_selected_dir(Direction), AllArgsInfos, ArgsInfos), + var_arg_info_to_lval(ArgsInfos, ArgsLocns), + get_module_info(!.CI, ModuleInfo), + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_place_vars(ModuleInfo, ArgsLocns, Code, + VarLocnInfo0, VarLocnInfo1), + set_var_locn_info(VarLocnInfo1, !CI), + assoc_list.values(ArgsLocns, LiveLocList), + set.list_to_set(LiveLocList, LiveLocs), + assoc_list.keys(ArgsLocns, ArgVars), + which_variables_are_forward_live(!.CI, ArgVars, set_of_var.init, DeadVars), + make_vars_forward_dead(DeadVars, !CI). + +:- pred var_arg_info_to_lval(assoc_list(prog_var, arg_info)::in, + assoc_list(prog_var, lval)::out) is det. + +var_arg_info_to_lval([], []). +var_arg_info_to_lval([Var - ArgInfo | RestInfos], [Var - Lval | RestLvals]) :- + ArgInfo = arg_info(Loc, _Mode), + code_util.arg_loc_to_register(Loc, Lval), + var_arg_info_to_lval(RestInfos, RestLvals). + +:- pred which_variables_are_forward_live(code_info::in, + list(prog_var)::in, set_of_progvar::in, set_of_progvar::out) is det. + +which_variables_are_forward_live(_, [], !DeadVars). +which_variables_are_forward_live(CI, [Var | Vars], !DeadVars) :- + ( variable_is_forward_live(CI, Var) -> + true + ; + set_of_var.insert(Var, !DeadVars) + ), + which_variables_are_forward_live(CI, Vars, !DeadVars). + +:- pred call_arg_in_selected_dir(call_direction::in, + pair(prog_var, arg_info)::in) is semidet. + +call_arg_in_selected_dir(Direction, _ - arg_info(_, Mode)) :- + ( + Mode = top_in, + Direction = caller + ; + Mode = top_out, + Direction = callee + ). + +lock_regs(R, F, Exceptions, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_lock_regs(R, F, Exceptions, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +unlock_regs(!CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_unlock_regs(VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +clear_all_registers(OkToDeleteAny, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_clobber_all_regs(OkToDeleteAny, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +clobber_regs(Regs, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + var_locn_clobber_regs(Regs, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +save_variables(OutArgs, SavedLocs, Code, !CI) :- + compute_forward_live_var_saves(!.CI, OutArgs, VarLocs), + assoc_list.values(VarLocs, SavedLocList), + set.list_to_set(SavedLocList, SavedLocs), + place_vars(VarLocs, Code, !CI). + +save_variables_on_stack(Vars, Code, !CI) :- + list.map(associate_stack_slot(!.CI), Vars, VarLocs), + place_vars(VarLocs, Code, !CI). + +:- pred compute_forward_live_var_saves(code_info::in, + set_of_progvar::in, assoc_list(prog_var, lval)::out) is det. + +compute_forward_live_var_saves(CI, OutArgs, VarLocs) :- + get_known_variables(CI, Variables0), + Vars0 = set_of_var.list_to_set(Variables0), + TypeInfoLiveness = body_typeinfo_liveness(CI), + get_proc_info(CI, ProcInfo), + proc_info_get_vartypes(ProcInfo, VarTypes), + proc_info_get_rtti_varmaps(ProcInfo, RttiVarMaps), + maybe_complete_with_typeinfo_vars(Vars0, TypeInfoLiveness, VarTypes, + RttiVarMaps, Vars1), + set_of_var.difference(Vars1, OutArgs, Vars), + Variables = set_of_var.to_sorted_list(Vars), + list.map(associate_stack_slot(CI), Variables, VarLocs). + +:- pred associate_stack_slot(code_info::in, prog_var::in, + pair(prog_var, lval)::out) is det. + +associate_stack_slot(CI, Var, Var - Slot) :- + get_variable_slot(CI, Var, Slot). + +max_reg_in_use(CI, MaxR, MaxF) :- + get_var_locn_info(CI, VarLocnInfo), + var_locn_max_reg_in_use(VarLocnInfo, MaxR, MaxF). + +magically_put_var_in_unused_reg(Var, !CI) :- + get_var_locn_info(!.CI, VarLocnInfo0), + make_vars_forward_live_2([Var], map.init, 1, VarLocnInfo0, VarLocnInfo), + set_var_locn_info(VarLocnInfo, !CI). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for dealing with the recording of variable liveness + % information around calls. + % + % Value numbering needs to know what locations are live before calls; + % the garbage collector and the debugger need to know what locations + % are live containing what types of values after calls. + +:- interface. + +:- pred generate_call_vn_livevals(code_info::in, list(arg_loc)::in, + set_of_progvar::in, set(lval)::out) is det. + +:- pred generate_return_live_lvalues(code_info::in, + assoc_list(prog_var, arg_loc)::in, instmap::in, bool::in, + list(liveinfo)::out) is det. + +%---------------------------------------------------------------------------% + +:- implementation. + +generate_call_vn_livevals(CI, InputArgLocs, OutputArgs, LiveVals) :- + generate_call_stack_vn_livevals(CI, OutputArgs, StackLiveVals), + generate_input_var_vn(InputArgLocs, StackLiveVals, LiveVals). + +:- pred generate_call_stack_vn_livevals(code_info::in, + set_of_progvar::in, set(lval)::out) is det. + +generate_call_stack_vn_livevals(CI, OutputArgs, LiveVals) :- + get_known_variables(CI, KnownVarList0), + get_module_info(CI, ModuleInfo), + VarTypes = get_var_types(CI), + list.filter(var_is_of_non_dummy_type(ModuleInfo, VarTypes), + KnownVarList0, KnownVarList), + set_of_var.list_to_set(KnownVarList, KnownVars), + set_of_var.difference(KnownVars, OutputArgs, LiveVars), + set_of_var.to_sorted_list(LiveVars, LiveVarList), + generate_stack_var_vn(CI, LiveVarList, set.init, LiveVals1), + get_active_temps_data(CI, Temps), + generate_call_temp_vn(Temps, LiveVals1, LiveVals). + +:- pred generate_stack_var_vn(code_info::in, list(prog_var)::in, + set(lval)::in, set(lval)::out) is det. + +generate_stack_var_vn(_, [], !Vals). +generate_stack_var_vn(CI, [V | Vs], !Vals) :- + get_variable_slot(CI, V, Lval), + set.insert(Lval, !Vals), + generate_stack_var_vn(CI, Vs, !Vals). + +:- pred generate_call_temp_vn(assoc_list(lval, slot_contents)::in, + set(lval)::in, set(lval)::out) is det. + +generate_call_temp_vn([], !Vals). +generate_call_temp_vn([Lval - _ | Temps], !Vals) :- + set.insert(Lval, !Vals), + generate_call_temp_vn(Temps, !Vals). + +:- pred generate_input_var_vn(list(arg_loc)::in, + set(lval)::in, set(lval)::out) is det. + +generate_input_var_vn([], !Vals). +generate_input_var_vn([InputArgLoc | InputArgLocs], !Vals) :- + code_util.arg_loc_to_register(InputArgLoc, Lval), + set.insert(Lval, !Vals), + generate_input_var_vn(InputArgLocs, !Vals). + +%---------------------------------------------------------------------------% + +generate_return_live_lvalues(CI, OutputArgLocs, ReturnInstMap, + OkToDeleteAny, LiveLvalues) :- + variable_locations(CI, VarLocs), + get_known_variables(CI, Vars0), + get_module_info(CI, ModuleInfo), + VarTypes = get_var_types(CI), + list.filter(var_is_of_non_dummy_type(ModuleInfo, VarTypes), Vars0, Vars), + get_active_temps_data(CI, Temps), + get_proc_info(CI, ProcInfo), + get_globals(CI, Globals), + continuation_info.generate_return_live_lvalues(OutputArgLocs, + ReturnInstMap, Vars, VarLocs, Temps, ProcInfo, ModuleInfo, + Globals, OkToDeleteAny, LiveLvalues). + +:- pred generate_resume_layout(label::in, resume_map::in, + code_info::in, code_info::out) is det. + +generate_resume_layout(Label, ResumeMap, !CI) :- + get_globals(!.CI, Globals), + globals.lookup_bool_option(Globals, agc_stack_layout, AgcStackLayout), + ( + AgcStackLayout = yes, + get_active_temps_data(!.CI, Temps), + get_instmap(!.CI, InstMap), + get_proc_info(!.CI, ProcInfo), + get_module_info(!.CI, ModuleInfo), + continuation_info.generate_resume_layout(ResumeMap, Temps, InstMap, + ProcInfo, ModuleInfo, Layout), + add_resume_layout_for_label(Label, Layout, !CI) + ; + AgcStackLayout = no + ). + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + + % Submodule for managing stack slots. + + % Det stack frames are organized as follows. + % + % ... unused ... + % sp ---> + % + % ... local vars ... + % + % + % ... temporaries ... + % + % + % + % The stack pointer points to the first free location at the + % top of the stack. + % + % `succip_is_used' determines whether we need a slot to + % hold the succip. + % + % Nondet stack frames also have the local variables above the + % temporaries, but contain several fixed slots on top, and the + % saved succip is stored in one of these. + % + % For both kinds of stack frames, the slots holding variables + % are allocated during the live_vars pass, while the slots holding + % temporaries are acquired (and if possible, released) on demand + % during code generation. + +:- interface. + + % Returns the total stackslot count, but not including space for + % succip. This total can change in the future if this call is + % followed by further allocations of temp slots. + % +:- pred get_total_stackslot_count(code_info::in, int::out) is det. + + % If a stack slot is persistent, then the stack slot is not implicitly + % released when the code generator resets its location-dependent state, + % usually when entering the next arm of a disjunction, switch, etc. + +:- type temp_slot_persistence + ---> persistent_temp_slot + ; non_persistent_temp_slot. + + % Acquire a stack slot for storing a temporary. The slot_contents + % description is for accurate gc. + % +:- pred acquire_temp_slot(slot_contents::in, temp_slot_persistence::in, + lval::out, code_info::in, code_info::out) is det. + + % Release a stack slot acquired earlier for a temporary value. + % The persistence argument should match the acquire operation. + % +:- pred release_temp_slot(lval::in, temp_slot_persistence::in, + code_info::in, code_info::out) is det. + + % acquire_several_temp_slots(Items, Persistence, StackVars, + % StackId, N, M, !Info): + % + % Perform an acquire_temp_slot operation for each element of the + % input list, all with the same persistence. + % + % The slots will be the ones from stack_slot_num_to_lval(StackId, N) + % consecutively to stack_slot_num_to_lval(StackId, M), with N < M. + % These will also be returned as StackVars. + % +:- pred acquire_several_temp_slots(list(slot_contents)::in, + temp_slot_persistence::in, list(lval)::out, + main_stack::out, int::out, int::out, code_info::in, code_info::out) is det. + + % Release the stack slots acquired by an earlier acquire_several_temp_slots + % operation. The persistence argument should match the acquire operation. + % +:- pred release_several_temp_slots(list(lval)::in, temp_slot_persistence::in, + code_info::in, code_info::out) is det. + + % Return the lval of the stack slot in which the given variable is stored. + % Aborts if the variable does not have a stack slot an assigned to it. + % +:- pred get_variable_slot(code_info::in, prog_var::in, lval::out) is det. + +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + +:- implementation. + +acquire_temp_slot(Item, Persistence, StackVar, !CI) :- + get_temp_content_map(!.CI, TempContentMap0), + map.to_assoc_list(TempContentMap0, TempContentList), + get_temps_in_use(!.CI, TempsInUse0), + ( + find_unused_slot_for_item(TempContentList, Item, TempsInUse0, + ChosenStackVar, _) + -> + StackVar = ChosenStackVar + ; + new_temp_slot(Item, StackVar, !CI) + ), + set.insert(StackVar, TempsInUse0, TempsInUse), + set_temps_in_use(TempsInUse, !CI), + ( + Persistence = persistent_temp_slot, + get_persistent_temps(!.CI, PersistentTemps0), + set.insert(StackVar, PersistentTemps0, PersistentTemps), + set_persistent_temps(PersistentTemps, !CI) + ; + Persistence = non_persistent_temp_slot + ). + +acquire_several_temp_slots([], _, _, _, _, _, !CI) :- + % We could return an empty list of stack vars for StackVars, but there is + % nothing meaningful we can return for the other outputs. + unexpected($module, $pred, "[]"). +acquire_several_temp_slots([HeadItem | TailItems], Persistence, StackVars, + StackId, FirstSlotNum, LastSlotNum, !CI) :- + get_temp_content_map(!.CI, TempContentMap0), + map.to_assoc_list(TempContentMap0, TempContentList), + get_temps_in_use(!.CI, TempsInUse0), + ( + find_unused_slots_for_items(TempContentList, HeadItem, TailItems, + TempsInUse0, StackVarsPrime, + StackIdPrime, FirstSlotNumPrime, LastSlotNumPrime) + -> + StackVars = StackVarsPrime, + StackId = StackIdPrime, + FirstSlotNum = FirstSlotNumPrime, + LastSlotNum = LastSlotNumPrime + ; + new_temp_slots([HeadItem | TailItems], StackVars, + StackId, FirstSlotNum, LastSlotNum, !CI) + ), + set.insert_list(StackVars, TempsInUse0, TempsInUse), + set_temps_in_use(TempsInUse, !CI), + ( + Persistence = persistent_temp_slot, + get_persistent_temps(!.CI, PersistentTemps0), + set.insert_list(StackVars, PersistentTemps0, PersistentTemps), + set_persistent_temps(PersistentTemps, !CI) + ; + Persistence = non_persistent_temp_slot + ). + +:- pred new_temp_slot(slot_contents::in, lval::out, + code_info::in, code_info::out) is det. + +new_temp_slot(Item, StackVar, !CI) :- + get_var_slot_count(!.CI, VarSlotCount), + get_max_temp_slot_count(!.CI, TempSlotCount0), + TempSlotCount = TempSlotCount0 + 1, + SlotNum = VarSlotCount + TempSlotCount, + CodeModel = get_proc_model(!.CI), + StackId = code_model_to_main_stack(CodeModel), + StackVar = stack_slot_num_to_lval(StackId, SlotNum), + set_max_temp_slot_count(TempSlotCount, !CI), + + get_temp_content_map(!.CI, TempContentMap0), + map.det_insert(StackVar, Item, TempContentMap0, TempContentMap), + set_temp_content_map(TempContentMap, !CI). + +:- pred new_temp_slots(list(slot_contents)::in, list(lval)::out, + main_stack::out, int::out, int::out, code_info::in, code_info::out) is det. + +new_temp_slots(Items, StackVars, StackId, FirstSlotNum, LastSlotNum, !CI) :- + get_var_slot_count(!.CI, VarSlotCount), + get_max_temp_slot_count(!.CI, TempSlotCount0), + FirstSlotNum = VarSlotCount + TempSlotCount0 + 1, + CodeModel = get_proc_model(!.CI), + StackId = code_model_to_main_stack(CodeModel), + get_temp_content_map(!.CI, TempContentMap0), + record_new_temp_slots(Items, StackId, FirstSlotNum, FirstUnusedSlotNum, + TempSlotCount0, TempSlotCount, TempContentMap0, TempContentMap, + StackVars), + LastSlotNum = FirstUnusedSlotNum - 1, + set_max_temp_slot_count(TempSlotCount, !CI), + set_temp_content_map(TempContentMap, !CI). + +:- pred record_new_temp_slots(list(slot_contents)::in, + main_stack::in, int::in, int::out, int::in, int::out, + map(lval, slot_contents)::in, map(lval, slot_contents)::out, + list(lval)::out) is det. + +record_new_temp_slots([], _, !CurSlotNum, !TempSlotCount, !TempContentMap, []). +record_new_temp_slots([Item | Items], StackId, !CurSlotNum, + !TempSlotCount, !TempContentMap, [StackVar | StackVars]) :- + StackVar = stack_slot_num_to_lval(StackId, !.CurSlotNum), + map.det_insert(StackVar, Item, !TempContentMap), + !:CurSlotNum = !.CurSlotNum + 1, + !:TempSlotCount = !.TempSlotCount + 1, + record_new_temp_slots(Items, StackId, !CurSlotNum, + !TempSlotCount, !TempContentMap, StackVars). + +:- pred find_unused_slot_for_item(assoc_list(lval, slot_contents)::in, + slot_contents::in, set(lval)::in, lval::out, + assoc_list(lval, slot_contents)::out) is semidet. + +find_unused_slot_for_item([Head | Tail], Item, TempsInUse, + ChosenStackVar, Remainder) :- + Head = HeadStackVar - HeadSlotType, + ( + HeadSlotType = Item, + \+ set.member(HeadStackVar, TempsInUse) + -> + ChosenStackVar = HeadStackVar, + Remainder = Tail + ; + find_unused_slot_for_item(Tail, Item, TempsInUse, + ChosenStackVar, Remainder) + ). + +:- pred find_unused_slots_for_items(assoc_list(lval, slot_contents)::in, + slot_contents::in, list(slot_contents)::in, set(lval)::in, list(lval)::out, + main_stack::out, int::out, int::out) is semidet. + +find_unused_slots_for_items([Head | Tail], HeadItem, TailItems, TempsInUse, + ChosenStackVars, StackId, FirstSlotNum, LastSlotNum) :- + ( + find_unused_slot_for_item([Head | Tail], HeadItem, TempsInUse, + ChosenHeadStackVar, Remainder), + ( ChosenHeadStackVar = stackvar(N) -> + StackId0 = det_stack, + FirstSlotNum0 = N + ; ChosenHeadStackVar = framevar(N) -> + StackId0 = nondet_stack, + FirstSlotNum0 = N + ; + unexpected($module, $pred, "not stackvar or framevar") + ), + StackId1 = StackId0, + FirstSlotNum1 = FirstSlotNum0, + find_next_slots_for_items(Remainder, TailItems, TempsInUse, + ChosenTailStackVars, StackId1, FirstSlotNum1, LastSlotNum1) + -> + ChosenStackVars = [ChosenHeadStackVar | ChosenTailStackVars], + StackId = StackId1, + FirstSlotNum = FirstSlotNum1, + LastSlotNum = LastSlotNum1 + ; + find_unused_slots_for_items(Tail, HeadItem, TailItems, TempsInUse, + ChosenStackVars, StackId, FirstSlotNum, LastSlotNum) + ). + +:- pred find_next_slots_for_items(assoc_list(lval, slot_contents)::in, + list(slot_contents)::in, set(lval)::in, list(lval)::out, + main_stack::in, int::in, int::out) is semidet. + +find_next_slots_for_items([], [], _, [], _, !SlotNum). +find_next_slots_for_items([Head | Tail], [HeadItem | TailItems], TempsInUse, + [HeadStackVar | TailStackVars], StackId, !SlotNum) :- + Head = HeadStackVar - HeadSlotType, + !:SlotNum = !.SlotNum + 1, + HeadStackVar = stack_slot_num_to_lval(StackId, !.SlotNum), + HeadSlotType = HeadItem, + \+ set.member(HeadStackVar, TempsInUse), + find_next_slots_for_items(Tail, TailItems, TempsInUse, + TailStackVars, StackId, !SlotNum). + +release_temp_slot(StackVar, Persistence, !CI) :- + get_temps_in_use(!.CI, TempsInUse0), + set.delete(StackVar, TempsInUse0, TempsInUse), + set_temps_in_use(TempsInUse, !CI), + + get_persistent_temps(!.CI, PersistentTemps0), + set.is_member(StackVar, PersistentTemps0, IsInPersistentTemps0), + ( + Persistence = persistent_temp_slot, + expect(unify(IsInPersistentTemps0, yes), + $module, $pred, "released stack slot should be persistent"), + set.delete(StackVar, PersistentTemps0, PersistentTemps), + set_persistent_temps(PersistentTemps, !CI) + ; + Persistence = non_persistent_temp_slot, + expect(unify(IsInPersistentTemps0, no), + $module, $pred, "released stack slot should not be persistent") + ). + +release_several_temp_slots([], _Persistence, !CI). +release_several_temp_slots([StackVar | StackVars], Persistence, !CI) :- + release_temp_slot(StackVar, Persistence, !CI), + release_several_temp_slots(StackVars, Persistence, !CI). + +%---------------------------------------------------------------------------% + +get_variable_slot(CI, Var, Slot) :- + get_stack_slots(CI, StackSlots), + ( map.search(StackSlots, Var, SlotLocn) -> + Slot = stack_slot_to_lval(SlotLocn) + ; + Name = variable_name(CI, Var), + term.var_to_int(Var, Num), + string.int_to_string(Num, NumStr), + Str = "variable `" ++ Name ++ "' " ++ "(" ++ NumStr ++ ") not found", + unexpected($module, $pred, Str) + ). + +get_total_stackslot_count(CI, NumSlots) :- + get_var_slot_count(CI, SlotsForVars), + get_max_temp_slot_count(CI, SlotsForTemps), + NumSlots = SlotsForVars + SlotsForTemps. + +:- pred max_var_slot(stack_slots::in, int::out) is det. + +max_var_slot(StackSlots, SlotCount) :- + map.values(StackSlots, StackSlotList), + max_var_slot_2(StackSlotList, 0, SlotCount). + +:- pred max_var_slot_2(list(stack_slot)::in, int::in, int::out) is det. + +max_var_slot_2([], !Max). +max_var_slot_2([L | Ls], !Max) :- + ( + L = det_slot(N, Width) + ; + L = parent_det_slot(N, Width) + ; + L = nondet_slot(N, Width) + ), + ( + Width = single_width, + int.max(N, !Max) + ; + Width = double_width, + int.max(N + 1, !Max) + ), + max_var_slot_2(Ls, !Max). + +%---------------------------------------------------------------------------% + + % Submodule for debugging the code generator itself. + +:- interface. + + % Should we trace the operation of the code generator. + % +:- pred should_trace_code_gen(code_info::in) is semidet. + +:- type code_info_component + ---> cic_forward_live_vars + ; cic_zombies + ; cic_temps_in_use + ; cic_par_conj_depth. + + % Print the selected parts of the code_info. + % + % If you need to print a part that is not currently selectable, make it + % selectable. + % +:- pred output_code_info(list(code_info_component)::in, code_info::in, + io::di, io::uo) is det. + +:- implementation. + +should_trace_code_gen(CI) :- + code_info.get_pred_id(CI, PredId), + pred_id_to_int(PredId, PredIdInt), + code_info.get_module_info(CI, ModuleInfo), + module_info_get_globals(ModuleInfo, Globals), + globals.lookup_int_option(Globals, debug_code_gen_pred_id, DebugPredIdInt), + PredIdInt = DebugPredIdInt. + +output_code_info(Components, CI, !IO) :- + CI = code_info(Static, LocDep, _Persistent), + VarSet = Static ^ cis_varset, + LocDep = code_info_loc_dep(ForwardLiveVars, _InstMap, Zombies, + _VarLocnInfo, TempsInUse, _FailInfo, ParConjDepth), + ( list.member(cic_forward_live_vars, Components) -> + io.write_string("forward live vars: ", !IO), + mercury_output_vars(VarSet, yes, + set_of_var.to_sorted_list(ForwardLiveVars), !IO), + io.nl(!IO) + ; + true + ), + ( list.member(cic_zombies, Components) -> + io.write_string("zombies: ", !IO), + mercury_output_vars(VarSet, yes, + set_of_var.to_sorted_list(Zombies), !IO), + io.nl(!IO) + ; + true + ), + ( list.member(cic_temps_in_use, Components) -> + io.write_string("temps_in_use: ", !IO), + io.write_string(dump_lvals(no, set.to_sorted_list(TempsInUse)), !IO), + io.nl(!IO) + ; + true + ), + ( list.member(cic_par_conj_depth, Components) -> + io.format("par_conj_depth: %d\n", [i(ParConjDepth)], !IO) + ; + true + ). + +:- pred output_resume_map(prog_varset::in, map(prog_var, set(lval))::in, + io::di, io::uo) is det. + +output_resume_map(VarSet, ResumeMap, !IO) :- + map.to_assoc_list(ResumeMap, ResumeAssocList), + list.foldl(output_resume_map_element(VarSet), ResumeAssocList, !IO). + +:- pred output_resume_map_element(prog_varset::in, + pair(prog_var, set(lval))::in, io::di, io::uo) is det. + +output_resume_map_element(VarSet, Var - LvalSet, !IO) :- + io.write_string(describe_var(VarSet, Var), !IO), + io.write_string(": ", !IO), + Lvals = set.to_sorted_list(LvalSet), + LvalDescs = list.map(dump_lval(no), Lvals), + SpaceLvalDescs = list.map(string.append(" "), LvalDescs), + io.write_string(string.append_list(SpaceLvalDescs), !IO), + io.nl(!IO). + +%---------------------------------------------------------------------------% +:- end_module ll_backend.code_info. +%---------------------------------------------------------------------------% diff --git a/samples/Mercury/expr.moo b/samples/Mercury/expr.moo new file mode 100644 index 00000000..30a140ab --- /dev/null +++ b/samples/Mercury/expr.moo @@ -0,0 +1,72 @@ +:- module expr. + +:- interface. + +:- import_module char, int, list. + +:- type token + ---> ('+') + ; ('-') + ; ('*') + ; ('/') + ; num(int) + ; ('(') + ; (')') + ; eof + . + +:- parse(exprn/1, token, eof, xx, in, out). + +:- pred scan(list(char), list(token)). +:- mode scan(in, out) is det. + +:- implementation. + +:- import_module string, require. + +:- rule exprn(int). +exprn(Num) ---> exprn(A), [+], term(B), { Num = A + B }. +exprn(Num) ---> exprn(A), [-], term(B), { Num = A - B }. +exprn(Num) ---> term(Num). + +:- rule term(int). +term(Num) ---> term(A), [*], factor(B), { Num = A * B }. +term(Num) ---> term(A), [/], factor(B), { Num = A // B }. +term(Num) ---> factor(Num). + +:- rule factor(int). +factor(Num) ---> ['('], exprn(Num), [')']. +factor(Num) ---> [num(Num)]. + +scan(Chars, Toks) :- + scan(Chars, [], Toks0), + list__reverse(Toks0, Toks). + +:- pred scan(list(char), list(token), list(token)). +:- mode scan(in, in, out) is det. + +scan([], Toks, [eof|Toks]). +scan([C|Cs], Toks0, Toks) :- + ( char__is_whitespace(C) -> + scan(Cs, Toks0, Toks) + ; char__is_digit(C) -> + takewhile(char__is_digit, [C|Cs], Digits, Rest), + string__from_char_list(Digits, NumStr), + Num = string__det_to_int(NumStr), + scan(Rest, [num(Num)|Toks0], Toks) + ; C = ('+') -> + scan(Cs, ['+'|Toks0], Toks) + ; C = ('-') -> + scan(Cs, ['-'|Toks0], Toks) + ; C = ('*') -> + scan(Cs, ['*'|Toks0], Toks) + ; C = ('/') -> + scan(Cs, ['/'|Toks0], Toks) + ; C = ('(') -> + scan(Cs, ['('|Toks0], Toks) + ; C = (')') -> + scan(Cs, [')'|Toks0], Toks) + ; + error("expr: syntax error in input") + ). + diff --git a/samples/Mercury/hello.m b/samples/Mercury/hello.m new file mode 100644 index 00000000..c73f65ca --- /dev/null +++ b/samples/Mercury/hello.m @@ -0,0 +1,14 @@ +% "Hello World" in Mercury. + +% This source file is hereby placed in the public domain. -fjh (the author). + +:- module hello. +:- interface. +:- import_module io. + +:- pred main(io::di, io::uo) is det. + +:- implementation. + +main(!IO) :- + io.write_string("Hello, world\n", !IO). diff --git a/samples/Mercury/options.m b/samples/Mercury/options.m new file mode 100644 index 00000000..ceee077c --- /dev/null +++ b/samples/Mercury/options.m @@ -0,0 +1,5884 @@ +%-----------------------------------------------------------------------------% +% vim: ft=mercury ts=4 sw=4 et +%-----------------------------------------------------------------------------% +% Copyright (C) 1994-2012 The University of Melbourne. +% This file may only be copied under the terms of the GNU General +% Public License - see the file COPYING in the Mercury distribution. +%-----------------------------------------------------------------------------% +% +% File: options.m. +% Main author: fjh. +% +% This defines the stuff necessary so that getopt_io.m can parse the +% command-line options. +% +% IMPORTANT NOTE: any changes to the options should be reflected in both the +% help message produced below, and in the Mercury User's Guide +% (../doc/user_guide.texi). +% +%-----------------------------------------------------------------------------% + +:- module libs.options. +:- interface. + +:- import_module char. +:- import_module getopt_io. +:- import_module io. +:- import_module set. + +%-----------------------------------------------------------------------------% + +:- pred short_option(char::in, option::out) is semidet. +:- pred long_option(string::in, option::out) is semidet. +:- pred option_defaults(option::out, option_data::out) is nondet. + + % special_handler(Option, ValueForThatOption, OptionTableIn, + % MaybeOptionTableOut): + % + % This predicate is invoked whenever getopt finds an option + % (long or short) designated as special, with special_data holding + % the argument of the option (if any). The predicate can change the + % option table in arbitrary ways in the course of handling the option, + % or it can return an error message. + % The canonical examples of special options are -O options in + % compilers, which set many other options at once. + % The MaybeOptionTableOut may either be ok(OptionTableOut), or it may + % be error(ErrorString). + % +:- pred special_handler(option::in, special_data::in, option_table::in, + maybe_option_table::out) is semidet. + + % Return the set of options which are inconsequential as far as the + % `--track-flags' option is concerned. That is, adding or removing such + % an option to a module should not force the module to be recompiled. + % +:- pred inconsequential_options(set(option)::out) is det. + +:- pred options_help(io::di, io::uo) is det. + +:- type option_table == option_table(option). +:- type maybe_option_table == maybe_option_table(option). + + % Add a directory to search for Mercury libraries. This + % adds `--search-directory', `--c-include-directory', + % `--erlang-include-directory', + % `--library-directory' and `--init-file-directory' options. + % +:- func option_table_add_mercury_library_directory(option_table, string) + = option_table. + + % Add a directory using all of the + % `--search-directory', `--intermod-directory', + % `--library-directory', `--init-file-directory' and + % `--c-include-directory', `--erlang-include-directory' + % options. + % +:- func option_table_add_search_library_files_directory(option_table, + string) = option_table. + + % Quote an argument to a shell command. + % +:- func quote_arg(string) = string. + + % NOTE: ALL OPTIONS SHOULD BE DOCUMENTED! + % + % Officially supported options should be documented both in the + % help message output by options_help/2, and also in the + % "invocation" chapter of doc/user_guide.texi. + % + % Options which are not officially supported (e.g. those used + % internally by the Mercury implementation, those which are not + % sufficiently useful to be worth mentioning in the User Guide, + % or options for experimental features that are not yet stable + % enough to be officially supported should still be documented. + % The documentation can go either next to the option definition + % here, or as commented-out code in the appropriate subroutine + % of options_help/2. +:- type option + + % Warning options + ---> inhibit_warnings + ; inhibit_accumulator_warnings + ; halt_at_warn + ; halt_at_syntax_errors + ; halt_at_auto_parallel_failure + ; warn_singleton_vars + ; warn_overlapping_scopes + ; warn_det_decls_too_lax + ; warn_inferred_erroneous + ; warn_nothing_exported + ; warn_unused_args + ; warn_interface_imports + ; warn_missing_opt_files + ; warn_missing_trans_opt_files + ; warn_missing_trans_opt_deps + ; warn_non_contiguous_clauses + ; warn_non_contiguous_foreign_procs + ; warn_non_stratification + ; warn_unification_cannot_succeed + ; warn_simple_code + ; warn_duplicate_calls + ; warn_missing_module_name + ; warn_wrong_module_name + ; warn_smart_recompilation + ; warn_undefined_options_variables + ; warn_non_tail_recursion + ; warn_target_code + ; warn_up_to_date + ; warn_stubs + ; warn_dead_procs + ; warn_table_with_inline + ; warn_non_term_special_preds + ; warn_known_bad_format_calls + ; warn_unknown_format_calls + ; warn_obsolete + ; warn_insts_without_matching_type + ; warn_unused_imports + ; inform_ite_instead_of_switch + ; warn_unresolved_polymorphism + ; warn_suspicious_foreign_procs + ; warn_state_var_shadowing + ; inform_inferred + ; inform_inferred_types + ; inform_inferred_modes + + % Verbosity options + ; verbose + ; very_verbose + ; verbose_errors + ; verbose_recompilation + ; find_all_recompilation_reasons + ; verbose_make + ; verbose_commands + ; output_compile_error_lines + ; report_cmd_line_args + ; report_cmd_line_args_in_doterr + ; statistics + ; detailed_statistics + ; proc_size_statistics + ; debug_types + ; debug_modes + ; debug_modes_statistics + ; debug_modes_minimal + ; debug_modes_verbose + ; debug_modes_pred_id + ; debug_dep_par_conj + ; debug_det + ; debug_code_gen_pred_id + ; debug_opt + ; debug_term % term = constraint termination analysis + ; debug_opt_pred_id + ; debug_opt_pred_name + ; debug_pd % pd = partial deduction/deforestation + ; debug_il_asm % il_asm = IL generation via asm + ; debug_liveness + ; debug_stack_opt + ; debug_make + ; debug_closure + ; debug_trail_usage + ; debug_mode_constraints + ; debug_intermodule_analysis + ; debug_mm_tabling_analysis + ; debug_indirect_reuse + ; debug_type_rep + + % Output options + ; make_short_interface + ; make_interface + ; make_private_interface + ; make_optimization_interface + ; make_transitive_opt_interface + ; make_analysis_registry + ; make_xml_documentation + ; generate_source_file_mapping + ; generate_dependency_file + ; generate_dependencies + ; generate_module_order + ; generate_standalone_interface + ; convert_to_mercury + ; typecheck_only + ; errorcheck_only + ; target_code_only + ; compile_only + ; compile_to_shared_lib + ; output_grade_string + ; output_link_command + ; output_shared_lib_link_command + ; output_libgrades + ; output_cc + ; output_c_compiler_type + ; output_csharp_compiler_type + ; output_cflags + ; output_library_link_flags + ; output_grade_defines + ; output_c_include_directory_flags + + % Auxiliary output options + ; smart_recompilation + % Even if this option is set to `yes', smart recompilation may + % have been disabled with io_set_disable_smart_recompilation. + % Before using the value of this option, call + % io_get_disable_smart_recompilation to see whether this + % has been done. + + ; generate_item_version_numbers + % This option is used to control output of version numbers + % in interface files. It is implied by --smart-recompilation, + % and cannot be set explicitly by the user. + + % Even if this option is set to `yes', version numbers may have + % been disabled with io_set_disable_generate_item_version_numbers. + % Before using the value of this option, call + % io_get_disable_generate_item_version_numbers to see whether this + % has been done. + + ; generate_mmc_make_module_dependencies + ; assume_gmake + ; trace_level + ; trace_optimized + ; trace_prof + ; trace_table_io + ; trace_table_io_only_retry + ; trace_table_io_states + ; trace_table_io_require + ; trace_table_io_all + ; trace_goal_flags + ; prof_optimized + ; exec_trace_tail_rec + ; suppress_trace + ; force_disable_tracing + % Force no tracing, even in .debug grades. This is used to turn off + % tracing in the browser directory while still allowing the browser + % library to be linked in with an executable compiled in a .debug + % grade. + ; delay_death + ; delay_death_max_vars + + ; stack_trace_higher_order + ; force_disable_ssdebug + ; generate_bytecode + ; line_numbers + ; auto_comments + ; frameopt_comments + ; max_error_line_width + ; show_dependency_graph + ; imports_graph + ; dump_trace_counts + ; dump_hlds + ; dump_hlds_pred_id + ; dump_hlds_pred_name + ; dump_hlds_alias + ; dump_hlds_options + ; dump_hlds_inst_limit + ; dump_hlds_file_suffix + ; dump_same_hlds + ; dump_mlds + ; verbose_dump_mlds + ; mode_constraints + ; simple_mode_constraints + ; prop_mode_constraints + ; benchmark_modes + ; benchmark_modes_repeat + ; sign_assembly + ; separate_assemblies + + % Language semantics options + ; reorder_conj + ; reorder_disj + ; fully_strict + ; strict_sequential + ; allow_stubs + ; infer_types + ; infer_modes + ; infer_det + ; infer_all + ; type_inference_iteration_limit + ; mode_inference_iteration_limit + ; event_set_file_name + + % Compilation Model options + ; grade + + % Target selection options + ; target + ; il % target il + ; il_only % target il + target_code_only + ; compile_to_c % target c + target_code_only + ; java % target java + ; java_only % target java + target_code_only + ; csharp % target csharp + ; csharp_only % target csharp + target_code_only + % XXX The following options need to be documented. + ; x86_64 % target x86_64 + ; x86_64_only % target x86_64 + target_code_only + ; erlang % target erlang + ; erlang_only % target erlang + target_code_only + + % Compilation model options for optional features: + + % (a) Debugging + % For documentation of the exec_trace and decl_debug options, see the + % documentation for MR_EXEC_TRACE and MR_DECL_DEBUG in + % runtime/mercury_conf_param.h. + ; exec_trace + ; decl_debug + + % (b) Profiling + ; profiling % profile_time + profile_calls + ; time_profiling % profile_time + profile_calls + ; memory_profiling % profile_mem + profile_calls + ; deep_profiling % profile_deep + ; profile_calls + ; profile_time + ; profile_memory + ; profile_deep + ; use_activation_counts + % Use_activation_counts is used to determine which mechanism for + % cycle detection should be used for deep profiling. Actually, + % we only want to use the `yes' value, but we keep support for + % the `no' value for benchmarks for the paper. + + ; pre_prof_transforms_simplify + % Run the simplification pass at before profiling (stage 215) this + % is implied by some of the profiling settings. Specifying this + % option causes this simplification pass to run even when profiling + % is not enabled. + + ; pre_implicit_parallelism_simplify + % Run the simplification pass before the implicit parallelism pass + % to ensure that the HLDS more closely matches the feedback data. + + % Perform coverage profiling, this affects only deep profiling + % grades. + ; coverage_profiling + ; coverage_profiling_via_calls + ; coverage_profiling_static + + % What types of coverage points to instrument the code with. + ; profile_deep_coverage_after_goal + ; profile_deep_coverage_branch_ite + ; profile_deep_coverage_branch_switch + ; profile_deep_coverage_branch_disj + + % Tunables for the coverage profiling pass. + % XXX: Currently both these options are unsupported. + ; profile_deep_coverage_use_portcounts + ; profile_deep_coverage_use_trivial + + % Turn on flags relevant for profiler directed feedback analysis. + % Currently the only feedback analysis is automatic parallelism. + ; profile_for_feedback + + ; use_zeroing_for_ho_cycles + ; use_lots_of_ho_specialization + + % We should always handle tail recursion specially in deep + % profiling; the option is only for benchmarks for the paper, + % except that this is currently broken, and not supported with + % coverage profiling. + ; deep_profile_tail_recursion + ; record_term_sizes_as_words + ; record_term_sizes_as_cells + ; experimental_complexity + + % (c) Miscellaneous + ; gc + ; parallel + ; threadscope + ; use_trail + ; trail_segments + ; use_minimal_model_stack_copy + ; use_minimal_model_own_stacks + ; minimal_model_debug + ; single_prec_float + ; type_layout + ; maybe_thread_safe_opt + ; extend_stacks_when_needed + ; stack_segments + ; use_regions + ; use_alloc_regions + ; use_regions_debug + ; use_regions_profiling + ; source_to_source_debug + ; ssdb_trace_level + ; link_ssdb_libs + + % Data representation compilation model options + ; tags + ; num_tag_bits + ; num_reserved_addresses + ; num_reserved_objects + ; bits_per_word + ; bytes_per_word + % The undocumented conf_low_tag_bits option is used by the `mmc' + % script to pass the default value for num_tag_bits assuming + % --tags low. The reason that `mmc' doesn't just pass a default + % value for --num-tag-bits is that we want to be able to give an + % error message if the user specifies `--tags high' and doesn't + % specify `--num-tag-bits'. + + ; conf_low_tag_bits + ; unboxed_float + ; unboxed_enums + ; unboxed_no_tag_types + ; sync_term_size % in words + + % LLDS back-end compilation model options + ; gcc_non_local_gotos + ; gcc_global_registers + ; asm_labels + ; pic_reg + ; use_float_registers + + % MLDS back-end compilation model options + ; highlevel_code + ; highlevel_data + ; gcc_nested_functions + ; det_copy_out + ; nondet_copy_out + ; put_commit_in_own_func + ; put_nondet_env_on_heap + + % IL back-end compilation model options + ; verifiable_code + ; il_refany_fields + ; il_funcptr_types + ; il_byref_tailcalls + % Currently this is not really a compilation model option, i.e. + % it doesn't affect the ABI. In future it might become one, though + % -- we should return multiple values in value types, rather than + % using byrefs. Also it's nicer to keep it with the other IL + % back-end options here. + + % Options for internal use only (the values of these options are implied + % by the settings of other options) + + ; backend_foreign_languages + % The foreign programming languages that this backend can + % interface to. + + ; stack_trace + % Stack layout information required to do a stack trace. + + ; basic_stack_layout + % Stack layout information required to do accurate GC. + + ; agc_stack_layout + % Stack layout information required to do procedure identification. + + ; procid_stack_layout + % Stack layout information required to do execution tracing. + + ; trace_stack_layout + + ; body_typeinfo_liveness + % Use an alternate calculation of liveness where the typeinfo + % for a type variable must live at any point in the body of the + % procedure at which a live variable's type includes that type + % variable. + % + % Although this option governs whether the body of a procedure + % uses this liveness calculation, it is not the only consideration + % we have to take into account when deciding on the interface + % of any procedure whose address may be taken. We must include + % typeinfos describing the types of all arguments in the interface + % of a procedure if either this option is set *or* the procedure's + % address may be taken, otherwise, the layout structure we include + % in closures using that procedure may not have all the information + % required to reconstruct the types of all the values inside the + % closure. + % + % The only place in the compiler that should look at this option + % is the predicate body_should_use_typeinfo_liveness in + % hlds_pred.m; everything else, including the predicates deciding + % interface typeinfo liveness, should go through there. + + ; can_compare_constants_as_ints + % Should be set to yes if the target back end guarantees that + % comparing two values for equality, at least one of which is a + % constant, can be done by casting them both to integers and + % comparing the integers for equality. + + ; pretest_equality_cast_pointers + % Should be set to yes if the test of whether two input arguments + % are object identical should be done by casting the arguments to a + % generic pointer type. Otherwise they will be cast to integers. + + ; can_compare_compound_values + % Should be set to yes if the target back end supports comparison + % of non-atomic values with builtin operators. + + ; lexically_order_constructors + % Should be set to yes if we need to order functors + % lexically when generating comparison predicates, + % e.g. to match the natural order that functors will be compared + % on the backend. + + ; mutable_always_boxed + + ; delay_partial_instantiations + + % Options for internal use only (setting these options to non-default + % values can result in programs that do not link, or programs that dump + % core) + ; allow_defn_of_builtins + % Do not generate errors for definitions of builtin predicates. + % When a new builtin is introduced, the installed compiler won't + % know about it, and thus when it sees its declaration, it wants a + % definition, but when the modified compiler is bootstrapped, + % it would normally generate an error when it sees that very same + % definition in the library (usually in builtin.m or + % private_builtin.m). When this option is set, it allows such + % definitions. Once the modified compiler is installed on all + % relevant machines, the option can be turned off again. + + ; special_preds + % Generate unify and compare preds. For measurement only. + % Code generated with this set to `no' is unlikely to actually + % work. + + ; type_ctor_info + % Generate type_ctor_info structures. For measurement only -- + % if you turn this off, then you're unlikely to be able to link. + + ; type_ctor_layout + % Generate type_ctor_layout structures. For measurement only -- + % if you turn this off, then you're unlikely to be able to link. + + ; type_ctor_functors + % Generate type_ctor_functors structures. For measurement only -- + % if you turn this off, then you're unlikely to be able to link. + + ; new_type_class_rtti + % XXX temporary option: enables the generation of new style static + % data structures for runtime information about type classes. + % These are not yet used. When we add code to generate the matching + % dynamic data structures and switch over to use them, we won't + % need this option anymore. + + ; rtti_line_numbers + % Generate line number information in the RTTI when debugging is + % enabled. For measurement only -- if you turn this off, then the + % debugger may dereference garbage pointers. + + ; disable_minimal_model_stack_copy_pneg + ; disable_minimal_model_stack_copy_cut + ; use_minimal_model_stack_copy_pneg + ; use_minimal_model_stack_copy_cut + % These four are used to analyze the performance effects + % of minimal model tabling. + + ; disable_trail_ops + % This is used to analyze the performance effects of trailing. + + ; size_region_ite_fixed + ; size_region_disj_fixed + ; size_region_semi_disj_fixed + ; size_region_commit_fixed + + ; size_region_ite_protect + ; size_region_ite_snapshot + ; size_region_semi_disj_protect + ; size_region_disj_snapshot + ; size_region_commit_entry + + ; solver_type_auto_init + % Insert calls to solver type initialisation predicates when + % the inst of solver type variables changes from free to any. + + ; allow_multi_arm_switches + + ; type_check_constraints + + ; allow_argument_packing + + % Code generation options + ; low_level_debug + ; table_debug + ; trad_passes + ; parallel_liveness + ; parallel_code_gen + ; polymorphism + ; reclaim_heap_on_failure + ; reclaim_heap_on_semidet_failure + ; reclaim_heap_on_nondet_failure + ; have_delay_slot + ; num_real_r_regs + ; num_real_f_regs + ; num_real_r_temps + ; num_real_f_temps + ; max_jump_table_size + ; max_specialized_do_call_closure + ; max_specialized_do_call_class_method + ; compare_specialization + ; should_pretest_equality + ; fact_table_max_array_size + % Maximum number of elements in a single fact table data array. + + ; fact_table_hash_percent_full + % How full the fact table hash tables should be allowed to get, + % given as an integer percentage. + + ; gcc_local_labels + ; prefer_switch + ; opt_no_return_calls + + % Optimization Options + ; opt_level + ; opt_level_number + ; opt_space % Default is to optimize time. + ; intermodule_optimization + ; read_opt_files_transitively + ; use_opt_files + ; use_trans_opt_files + ; transitive_optimization + ; intermodule_analysis + ; analysis_repeat + ; analysis_file_cache + + % - HLDS + ; allow_inlining + ; inlining + ; inline_simple + ; inline_builtins + ; inline_single_use + ; inline_call_cost + ; inline_compound_threshold + ; inline_simple_threshold + ; inline_vars_threshold + ; intermod_inline_simple_threshold + ; from_ground_term_threshold + ; enable_const_struct + ; common_struct + ; common_struct_preds + ; common_goal + ; constraint_propagation + ; local_constraint_propagation + ; optimize_unused_args + ; intermod_unused_args + ; optimize_higher_order + ; higher_order_size_limit + ; higher_order_arg_limit + ; unneeded_code + ; unneeded_code_copy_limit + ; unneeded_code_debug + ; unneeded_code_debug_pred_name + ; type_specialization + ; user_guided_type_specialization + ; introduce_accumulators + ; optimize_constructor_last_call_accumulator + ; optimize_constructor_last_call_null + ; optimize_constructor_last_call + ; optimize_duplicate_calls + ; constant_propagation + ; excess_assign + ; optimize_format_calls + ; optimize_saved_vars_const + ; optimize_saved_vars_cell + ; optimize_saved_vars_cell_loop + ; optimize_saved_vars_cell_full_path + ; optimize_saved_vars_cell_on_stack + ; optimize_saved_vars_cell_candidate_headvars + ; optimize_saved_vars_cell_cv_store_cost + ; optimize_saved_vars_cell_cv_load_cost + ; optimize_saved_vars_cell_fv_store_cost + ; optimize_saved_vars_cell_fv_load_cost + ; optimize_saved_vars_cell_op_ratio + ; optimize_saved_vars_cell_node_ratio + ; optimize_saved_vars_cell_all_path_node_ratio + ; optimize_saved_vars_cell_include_all_candidates + ; optimize_saved_vars + ; loop_invariants + ; delay_construct + ; follow_code + ; optimize_dead_procs + ; deforestation + ; deforestation_depth_limit + ; deforestation_cost_factor + ; deforestation_vars_threshold + ; deforestation_size_threshold + ; analyse_trail_usage + ; optimize_trail_usage + ; optimize_region_ops + ; analyse_mm_tabling + ; untuple + ; tuple + ; tuple_trace_counts_file + ; tuple_costs_ratio + ; tuple_min_args + ; inline_par_builtins + ; always_specialize_in_dep_par_conjs + ; allow_some_paths_only_waits + ; region_analysis + + % Stuff for the CTGC system (structure sharing / structure reuse). + ; structure_sharing_analysis + ; structure_sharing_widening + ; structure_reuse_analysis + ; structure_reuse_constraint + ; structure_reuse_constraint_arg + ; structure_reuse_max_conditions + ; structure_reuse_repeat + ; structure_reuse_free_cells + + % Stuff for the old termination analyser. + ; termination + ; termination_check + ; verbose_check_termination + ; termination_single_args + ; termination_norm + ; termination_error_limit + ; termination_path_limit + + % Stuff for the new termination analyser. + ; termination2 + ; check_termination2 + ; verbose_check_termination2 + ; termination2_norm + ; widening_limit + ; arg_size_analysis_only + ; propagate_failure_constrs + ; term2_maximum_matrix_size + ; analyse_exceptions + ; analyse_closures + + % - HLDS->LLDS + ; smart_indexing + ; dense_switch_req_density + ; lookup_switch_req_density + ; dense_switch_size + ; lookup_switch_size + ; string_hash_switch_size + ; string_binary_switch_size + ; tag_switch_size + ; try_switch_size + ; binary_switch_size + ; switch_single_rec_base_first + ; switch_multi_rec_base_first + + ; static_ground_cells + ; static_ground_floats + ; static_code_addresses + + ; use_atomic_cells + ; middle_rec + ; simple_neg + ; allow_hijacks + + % - MLDS + ; optimize_tailcalls + ; optimize_initializations + ; eliminate_local_vars + ; generate_trail_ops_inline + + % - LLDS + ; common_data + ; common_layout_data + ; optimize % Also used for MLDS->MLDS optimizations. + ; optimize_peep + ; optimize_peep_mkword + ; optimize_jumps + ; optimize_fulljumps + ; pessimize_tailcalls + ; checked_nondet_tailcalls + ; use_local_vars + ; local_var_access_threshold + ; standardize_labels + ; optimize_labels + ; optimize_dups + ; optimize_proc_dups + ; optimize_frames + ; optimize_delay_slot + ; optimize_reassign + ; optimize_repeat + ; layout_compression_limit + + % - C + ; use_macro_for_redo_fail + ; emit_c_loops + ; procs_per_c_function + ; everything_in_one_c_function + ; local_thread_engine_base + + % - IL + % (none yet) + + % - Erlang + ; erlang_switch_on_strings_as_atoms + + % Target code compilation options + ; target_debug + + % C + ; cc + ; cflags + ; quoted_cflag + ; c_include_directory + ; c_optimize + ; ansi_c + ; inline_alloc + + % Flags for specific C compilers. + ; gcc_flags + ; quoted_gcc_flag + ; clang_flags + ; quoted_clang_flag + ; msvc_flags + ; quoted_msvc_flag + + % Auto-configured C compilation options. + ; cflags_for_warnings + ; cflags_for_optimization + ; cflags_for_ansi + ; cflags_for_regs + ; cflags_for_gotos + ; cflags_for_threads + ; cflags_for_debug + ; cflags_for_pic + ; c_flag_to_name_object_file + ; object_file_extension + ; pic_object_file_extension + ; link_with_pic_object_file_extension + ; c_compiler_type + ; csharp_compiler_type + + % Java + ; java_compiler + ; java_interpreter + ; java_flags + ; quoted_java_flag + ; java_classpath + ; java_object_file_extension + + % IL + ; il_assembler + ; ilasm_flags + ; quoted_ilasm_flag + ; dotnet_library_version + ; support_ms_clr + ; support_rotor_clr + + % C# + ; csharp_compiler + ; csharp_flags + ; quoted_csharp_flag + ; cli_interpreter + + % Erlang + ; erlang_compiler + ; erlang_interpreter + ; erlang_flags + ; quoted_erlang_flag + ; erlang_include_directory + ; erlang_object_file_extension + ; erlang_native_code + ; erlang_inhibit_trivial_warnings + + % Link options + ; output_file_name + ; ld_flags + ; quoted_ld_flag + ; ld_libflags + ; quoted_ld_libflag + ; link_library_directories + ; runtime_link_library_directories + ; link_libraries + ; link_objects + ; mercury_library_directories + ; mercury_library_directory_special + ; search_library_files_directories + ; search_library_files_directory_special + ; mercury_libraries + ; mercury_library_special + ; mercury_standard_library_directory + ; mercury_standard_library_directory_special + ; init_file_directories + ; init_files + ; trace_init_files + ; linkage + ; linkage_special + ; mercury_linkage + ; mercury_linkage_special + ; strip + ; demangle + ; main + ; allow_undefined + ; use_readline + ; runtime_flags + ; extra_initialization_functions + ; frameworks + ; framework_directories + + % Auto-configured options. + ; shared_library_extension + ; library_extension + ; executable_file_extension + ; link_executable_command + ; link_shared_lib_command + ; create_archive_command + ; create_archive_command_output_flag + ; create_archive_command_flags + ; ranlib_command + ; ranlib_flags + ; mkinit_command + ; mkinit_erl_command + ; demangle_command + ; filtercc_command + ; trace_libs + ; thread_libs + ; hwloc_libs + ; hwloc_static_libs + ; shared_libs + ; math_lib + ; readline_libs + ; linker_opt_separator + ; linker_thread_flags + ; shlib_linker_thread_flags + ; linker_static_flags + ; linker_strip_flag + ; linker_link_lib_flag + ; linker_link_lib_suffix + ; shlib_linker_link_lib_flag + ; shlib_linker_link_lib_suffix + ; linker_debug_flags + ; shlib_linker_debug_flags + ; linker_trace_flags + ; shlib_linker_trace_flags + ; linker_path_flag + ; linker_rpath_flag + ; linker_rpath_separator + ; shlib_linker_rpath_flag + ; shlib_linker_rpath_separator + ; linker_allow_undefined_flag + ; linker_error_undefined_flag + ; shlib_linker_use_install_name + ; shlib_linker_install_name_flag + ; shlib_linker_install_name_path + ; java_archive_command + + % Build system options + ; make + ; keep_going + ; rebuild + ; jobs + ; track_flags + ; invoked_by_mmc_make + ; extra_init_command + ; pre_link_command + ; install_prefix + ; use_symlinks + ; mercury_configuration_directory + ; mercury_configuration_directory_special + ; install_command + ; install_command_dir_option + ; libgrades + ; libgrades_include_components + ; libgrades_exclude_components + ; lib_linkages + ; flags_file + ; options_files + ; config_file + ; options_search_directories + ; use_subdirs + ; use_grade_subdirs + ; search_directories + ; intermod_directories + ; use_search_directories_for_intermod + ; libgrade_install_check + ; order_make_by_timestamp + ; show_make_times + ; extra_library_header + ; restricted_command_line + ; env_type + ; host_env_type + ; target_env_type + + % Miscellaneous Options + ; filenames_from_stdin + ; typecheck_ambiguity_warn_limit + ; typecheck_ambiguity_error_limit + ; help + ; version + ; fullarch + ; cross_compiling + ; local_module_id + ; analysis_file_cache_dir + ; compiler_sufficiently_recent + % This option is used to test that the compiler is sufficiently + % recent when no other test can easily be constructed in + % configure.in. + + ; experiment + % This option is provided for use by implementors who want to + % compare a new way of doing something with the old way. The idea + % is that the code that switches between the two ways should + % consult this option and make its decision accordingly. + % + % The intention is that all use of this option is within developer + % workspaces; no code using this option should be committed. + % + % Of course, a developer could always create a purpose-specific + % option to control their code, but adding an option requires + % recompiling most of the modules in the compiler. Having this + % option permanently here should reduce the need for that. + + ; ignore_par_conjunctions + ; control_granularity + ; distance_granularity + ; implicit_parallelism + ; feedback_file + ; par_loop_control + ; par_loop_control_preserve_tail_recursion. + +%----------------------------------------------------------------------------% +%----------------------------------------------------------------------------% + +:- implementation. + +:- import_module libs.handle_options. + +:- import_module assoc_list. +:- import_module bool. +:- import_module dir. +:- import_module int. +:- import_module list. +:- import_module map. +:- import_module maybe. +:- import_module pair. +:- import_module require. +:- import_module string. + +%----------------------------------------------------------------------------% + +:- type option_category + ---> warning_option + ; verbosity_option + ; output_option + ; aux_output_option + ; language_semantics_option + ; compilation_model_option + ; internal_use_option + ; code_gen_option + ; special_optimization_option + ; optimization_option + ; target_code_compilation_option + ; link_option + ; build_system_option + ; miscellaneous_option. + +option_defaults(Option, Default) :- + option_defaults_2(_Category, OptionsList), + list.member(Option - Default, OptionsList). + +:- pred option_defaults_2(option_category, list(pair(option, option_data))). +:- mode option_defaults_2(in, out) is det. +:- mode option_defaults_2(out, out) is multi. + +option_defaults_2(warning_option, [ + % Warning Options + inhibit_warnings - bool_special, + inhibit_accumulator_warnings - bool(no), + halt_at_warn - bool(no), + halt_at_syntax_errors - bool(no), + halt_at_auto_parallel_failure - bool(no), + + % IMPORTANT NOTE: + % if you add any new warning options, or if you change the default + % for an existing warning option to `yes', then you will need to modify + % the handling of inhibit_warnings. + + warn_singleton_vars - bool(yes), + warn_overlapping_scopes - bool(yes), + warn_det_decls_too_lax - bool(yes), + warn_inferred_erroneous - bool(yes), + warn_nothing_exported - bool(yes), + warn_unused_args - bool(no), + warn_interface_imports - bool(yes), + warn_non_contiguous_clauses - bool(no), % XXX should be yes + warn_non_contiguous_foreign_procs - bool(no), + warn_non_stratification - bool(no), + warn_missing_opt_files - bool(yes), + warn_missing_trans_opt_files - bool(no), + warn_missing_trans_opt_deps - bool(yes), + warn_unification_cannot_succeed - bool(yes), + warn_simple_code - bool(yes), + warn_duplicate_calls - bool(no), + warn_missing_module_name - bool(yes), + warn_wrong_module_name - bool(yes), + warn_smart_recompilation - bool(yes), + warn_undefined_options_variables - bool(yes), + warn_non_tail_recursion - bool(no), + warn_target_code - bool(yes), + warn_up_to_date - bool(yes), + warn_stubs - bool(yes), + warn_dead_procs - bool(no), + warn_table_with_inline - bool(yes), + warn_non_term_special_preds - bool(yes), + warn_known_bad_format_calls - bool(yes), + warn_unknown_format_calls - bool(no), + warn_obsolete - bool(yes), + warn_insts_without_matching_type - bool(yes), + % XXX disabled by default until someone + % removes all the unused imports from + % the compiler itself which is compiled + % with --halt-at-warn by default. + warn_unused_imports - bool(no), + inform_ite_instead_of_switch - bool(no), + warn_unresolved_polymorphism - bool(yes), + warn_suspicious_foreign_procs - bool(no), + warn_state_var_shadowing - bool(yes), + inform_inferred - bool_special, + inform_inferred_types - bool(yes), + inform_inferred_modes - bool(yes) +]). +option_defaults_2(verbosity_option, [ + % Verbosity Options + verbose - bool(no), + very_verbose - bool(no), + verbose_errors - bool(no), + verbose_recompilation - bool(no), + find_all_recompilation_reasons - bool(no), + verbose_make - bool(yes), + verbose_commands - bool(no), + output_compile_error_lines - int(15), + report_cmd_line_args - bool(no), + report_cmd_line_args_in_doterr - bool(no), + statistics - bool(no), + detailed_statistics - bool(no), + proc_size_statistics - string(""), + debug_types - bool(no), + debug_modes - bool(no), + debug_modes_statistics - bool(no), + debug_modes_minimal - bool(no), + debug_modes_verbose - bool(no), + debug_modes_pred_id - int(-1), + debug_dep_par_conj - accumulating([]), + debug_det - bool(no), + debug_code_gen_pred_id - int(-1), + debug_term - bool(no), + debug_opt - bool(no), + debug_opt_pred_id - accumulating([]), + debug_opt_pred_name - accumulating([]), + debug_pd - bool(no), + debug_il_asm - bool(no), + debug_liveness - int(-1), + debug_stack_opt - int(-1), + debug_make - bool(no), + debug_closure - bool(no), + debug_trail_usage - bool(no), + debug_mode_constraints - bool(no), + debug_intermodule_analysis - bool(no), + debug_mm_tabling_analysis - bool(no), + debug_indirect_reuse - bool(no), + debug_type_rep - bool(no) +]). +option_defaults_2(output_option, [ + % Output Options (mutually exclusive) + generate_source_file_mapping - bool(no), + generate_dependency_file - bool(no), + generate_dependencies - bool(no), + generate_module_order - bool(no), + generate_standalone_interface - maybe_string(no), + make_short_interface - bool(no), + make_interface - bool(no), + make_private_interface - bool(no), + make_optimization_interface - bool(no), + make_transitive_opt_interface - bool(no), + make_analysis_registry - bool(no), + make_xml_documentation - bool(no), + convert_to_mercury - bool(no), + typecheck_only - bool(no), + errorcheck_only - bool(no), + target_code_only - bool(no), + compile_only - bool(no), + compile_to_shared_lib - bool(no), + output_grade_string - bool(no), + output_link_command - bool(no), + output_shared_lib_link_command - bool(no), + output_libgrades - bool(no), + output_cc - bool(no), + output_c_compiler_type - bool(no), + output_csharp_compiler_type - bool(no), + output_cflags - bool(no), + output_library_link_flags - bool(no), + output_grade_defines - bool(no), + output_c_include_directory_flags - bool(no) +]). +option_defaults_2(aux_output_option, [ + % Auxiliary Output Options + smart_recompilation - bool(no), + generate_item_version_numbers - bool(no), + generate_mmc_make_module_dependencies - bool(no), + assume_gmake - bool(yes), + trace_level - string("default"), + trace_optimized - bool(no), + trace_prof - bool(no), + trace_table_io - bool(no), + trace_table_io_only_retry - bool(no), + trace_table_io_states - bool(no), + trace_table_io_require - bool(no), + trace_table_io_all - bool(no), + trace_goal_flags - accumulating([]), + prof_optimized - bool(no), + exec_trace_tail_rec - bool(no), + suppress_trace - string(""), + force_disable_tracing - bool(no), + delay_death - bool(yes), + delay_death_max_vars - int(1000), + stack_trace_higher_order - bool(no), + force_disable_ssdebug - bool(no), + generate_bytecode - bool(no), + line_numbers - bool(yes), + auto_comments - bool(no), + frameopt_comments - bool(no), + max_error_line_width - int(79), + show_dependency_graph - bool(no), + imports_graph - bool(no), + dump_trace_counts - accumulating([]), + dump_hlds - accumulating([]), + dump_hlds_pred_id - accumulating([]), + dump_hlds_pred_name - accumulating([]), + dump_hlds_alias - string(""), + dump_hlds_options - string(""), + dump_hlds_inst_limit - int(100), + dump_hlds_file_suffix - string(""), + dump_same_hlds - bool(no), + dump_mlds - accumulating([]), + verbose_dump_mlds - accumulating([]), + mode_constraints - bool(no), + simple_mode_constraints - bool(no), + prop_mode_constraints - bool(no), + benchmark_modes - bool(no), + benchmark_modes_repeat - int(1), + sign_assembly - bool(no), + % XXX should default to no but currently broken + separate_assemblies - bool(yes) +]). +option_defaults_2(language_semantics_option, [ + strict_sequential - special, + reorder_conj - bool(yes), + reorder_disj - bool(yes), + fully_strict - bool(yes), + allow_stubs - bool(no), + infer_types - bool(no), + infer_modes - bool(no), + infer_det - bool(yes), + infer_all - bool_special, + type_inference_iteration_limit - int(60), + mode_inference_iteration_limit - int(30), + event_set_file_name - string("") +]). +option_defaults_2(compilation_model_option, [ + % Compilation model options (ones that affect binary compatibility). + grade - string_special, + % The `mmc' script will pass the default grade determined + % at configuration time. + + % Target selection compilation model options + target - string("c"), + il - special, + il_only - special, + compile_to_c - special, + csharp - special, + csharp_only - special, + java - special, + java_only - special, + x86_64 - special, + x86_64_only - special, + erlang - special, + erlang_only - special, + + % Optional feature compilation model options: + % (a) Debuggging + exec_trace - bool(no), + decl_debug - bool(no), + % (b) Profiling + profiling - bool_special, + time_profiling - special, + memory_profiling - special, + deep_profiling - special, + profile_calls - bool(no), + profile_time - bool(no), + profile_memory - bool(no), + profile_deep - bool(no), + use_activation_counts - bool(no), + pre_prof_transforms_simplify - bool(no), + pre_implicit_parallelism_simplify - bool(no), + coverage_profiling - bool(yes), + coverage_profiling_via_calls - bool(no), + coverage_profiling_static - bool(no), + profile_deep_coverage_after_goal - bool(yes), + profile_deep_coverage_branch_ite - bool(yes), + profile_deep_coverage_branch_switch - bool(yes), + profile_deep_coverage_branch_disj - bool(yes), + profile_deep_coverage_use_portcounts - bool(no), + profile_deep_coverage_use_trivial - bool(no), + profile_for_feedback - bool(no), + use_zeroing_for_ho_cycles - bool(yes), + use_lots_of_ho_specialization - bool(no), + deep_profile_tail_recursion - bool(no), + record_term_sizes_as_words - bool(no), + record_term_sizes_as_cells - bool(no), + experimental_complexity - string(""), + % (c) Miscellaneous optional features + gc - string("boehm"), + parallel - bool(no), + threadscope - bool(no), + use_trail - bool(no), + trail_segments - bool(no), + maybe_thread_safe_opt - string("no"), + extend_stacks_when_needed - bool(no), + stack_segments - bool(no), + use_regions - bool(no), + use_alloc_regions - bool(yes), + use_regions_debug - bool(no), + use_regions_profiling - bool(no), + use_minimal_model_stack_copy - bool(no), + use_minimal_model_own_stacks - bool(no), + minimal_model_debug - bool(no), + single_prec_float - bool(no), + type_layout - bool(yes), + source_to_source_debug - bool(no), + ssdb_trace_level - string("default"), + link_ssdb_libs - bool(no), + + % Data representation compilation model options + pic_reg - bool(no), + tags - string("low"), + num_tag_bits - int(-1), + % -1 is a special value which means + % use the value of conf_low_tag_bits + % instead + num_reserved_addresses - int(0), + num_reserved_objects - int(0), + bits_per_word - int(32), + % A good default for the current + % generation of architectures. + bytes_per_word - int(4), + % A good default for the current + % generation of architectures. + conf_low_tag_bits - int(2), + % The `mmc' script will override the + % above default with a value determined + % at configuration time. + sync_term_size - int(8), + % 8 is the size on linux (at the time + % of writing) - will usually be + % overridden by a value from configure. + unboxed_float - bool(no), + unboxed_enums - bool(yes), + unboxed_no_tag_types - bool(yes), + + % LLDS back-end compilation model options + gcc_non_local_gotos - bool(yes), + gcc_global_registers - bool(yes), + asm_labels - bool(yes), + use_float_registers - bool(yes), + + % MLDS back-end compilation model options + highlevel_code - bool(no), + highlevel_data - bool(no), + gcc_nested_functions - bool(no), + det_copy_out - bool(no), + nondet_copy_out - bool(no), + put_commit_in_own_func - bool(no), + put_nondet_env_on_heap - bool(no), + + % IL back-end compilation model options + verifiable_code - bool(no), + il_funcptr_types - bool(no), + il_refany_fields - bool(no), + il_byref_tailcalls - bool(no) +]). +option_defaults_2(internal_use_option, [ + % Options for internal use only + backend_foreign_languages - accumulating([]), + % The backend_foreign_languages option + % depends on the target and is set in + % handle_options. + stack_trace - bool(no), + basic_stack_layout - bool(no), + agc_stack_layout - bool(no), + procid_stack_layout - bool(no), + trace_stack_layout - bool(no), + body_typeinfo_liveness - bool(no), + can_compare_constants_as_ints - bool(no), + pretest_equality_cast_pointers - bool(no), + can_compare_compound_values - bool(no), + lexically_order_constructors - bool(no), + mutable_always_boxed - bool(yes), + delay_partial_instantiations - bool(no), + allow_defn_of_builtins - bool(no), + special_preds - bool(yes), + type_ctor_info - bool(yes), + type_ctor_layout - bool(yes), + type_ctor_functors - bool(yes), + rtti_line_numbers - bool(yes), + new_type_class_rtti - bool(no), + disable_minimal_model_stack_copy_pneg - bool(no), + disable_minimal_model_stack_copy_cut - bool(no), + use_minimal_model_stack_copy_pneg - bool(no), + use_minimal_model_stack_copy_cut - bool(no), + disable_trail_ops - bool(no), + % The size_* values below *must* be consistent with the corresponding + % values or data structures in mercury_region.h. + size_region_ite_fixed - int(4), + size_region_disj_fixed - int(4), + size_region_commit_fixed - int(5), + size_region_ite_protect - int(1), + size_region_ite_snapshot - int(3), + size_region_semi_disj_protect - int(1), + size_region_disj_snapshot - int(3), + size_region_commit_entry - int(1), + solver_type_auto_init - bool(no), + allow_multi_arm_switches - bool(yes), + type_check_constraints - bool(no), + allow_argument_packing - bool(yes) +]). +option_defaults_2(code_gen_option, [ + % Code Generation Options + low_level_debug - bool(no), + table_debug - bool(no), + trad_passes - bool(yes), + parallel_liveness - bool(no), + parallel_code_gen - bool(no), + polymorphism - bool(yes), + reclaim_heap_on_failure - bool_special, + reclaim_heap_on_semidet_failure - bool(yes), + reclaim_heap_on_nondet_failure - bool(yes), + have_delay_slot - bool(no), + % The `mmc' script may override the + % above default if configure says + % the machine has branch delay slots. + num_real_r_regs - int(5), + num_real_f_regs - int(0), + num_real_r_temps - int(5), + num_real_f_temps - int(0), + % The `mmc' script will override the + % above defaults with values determined + % at configuration time. + max_jump_table_size - int(0), + % 0 indicates any size. + max_specialized_do_call_closure - int(5), + % mercury.do_call_closure_N + % exists for N <= option_value; + % set to -1 to disable. + % Should be less than or equal to + % max_spec_explicit_arg + % in tools/make_spec_ho_call. + max_specialized_do_call_class_method - int(6), + % mercury.do_call_class_method_N + % exists for N <= option_value; + % set to -1 to disable. + % Should be less than or equal to + % max_spec_explicit_arg + % in tools/make_spec_method_call. + compare_specialization - int(-1), + % -1 asks handle_options.m to give + % the value, which may be grade + % dependent. + should_pretest_equality - bool(yes), + fact_table_max_array_size - int(1024), + fact_table_hash_percent_full - int(90), + gcc_local_labels - bool(no), + prefer_switch - bool(yes), + opt_no_return_calls - bool(yes) +]). +option_defaults_2(special_optimization_option, [ + % Special optimization options. + % These ones are not affected by `-O'. + opt_level - int_special, + opt_level_number - int(-2), + opt_space - special, + intermodule_optimization - bool(no), + read_opt_files_transitively - bool(yes), + use_opt_files - bool(no), + use_trans_opt_files - bool(no), + transitive_optimization - bool(no), + intermodule_analysis - bool(no), + analysis_repeat - int(0), + analysis_file_cache - bool(no), + termination_check - bool(no), + verbose_check_termination - bool(no), + structure_sharing_analysis - bool(no), + structure_sharing_widening - int(0), + structure_reuse_analysis - bool(no), + structure_reuse_constraint - string("within_n_cells_difference"), + structure_reuse_constraint_arg - int(0), + structure_reuse_max_conditions - int(10), + structure_reuse_repeat - int(0), + structure_reuse_free_cells - bool(no), + termination - bool(no), + termination_single_args - int(0), + termination_norm - string("total"), + termination_error_limit - int(3), + termination_path_limit - int(256), + termination2 - bool(no), + termination2_norm - string("total"), + check_termination2 - bool(no), + verbose_check_termination2 - bool(no), + widening_limit - int(4), + arg_size_analysis_only - bool(no), + propagate_failure_constrs - bool(yes), + % XXX This is just a guess - I'm not sure what sensible + % value for this is. + term2_maximum_matrix_size - int(70), + analyse_exceptions - bool(no), + analyse_closures - bool(no), + analyse_trail_usage - bool(no), + optimize_trail_usage - bool(no), + optimize_region_ops - bool(no), + analyse_mm_tabling - bool(no) +]). +option_defaults_2(optimization_option, [ + % Optimization options + % + % IMPORTANT: the default here should be all optimizations OFF. + % Optimizations should be enabled by the appropriate + % optimization level in the opt_level table. + + % HLDS + allow_inlining - bool(yes), + inlining - bool_special, + inline_simple - bool(no), + inline_builtins - bool(yes), + inline_single_use - bool(no), + inline_call_cost - int(0), + inline_compound_threshold - int(0), + inline_simple_threshold - int(5), + % Has no effect until + % --inline-simple is enabled. + inline_vars_threshold - int(100), + intermod_inline_simple_threshold - int(5), + % Has no effect until + % --intermodule-optimization. + from_ground_term_threshold - int(5), + enable_const_struct - bool(yes), + common_struct - bool(no), + common_struct_preds - string(""), + common_goal - bool(yes), + % common_goal is not really an + % optimization, since it affects + % the semantics. + + constraint_propagation - bool(no), + local_constraint_propagation - bool(no), + optimize_duplicate_calls - bool(no), + constant_propagation - bool(no), + excess_assign - bool(no), + optimize_format_calls - bool(yes), + loop_invariants - bool(no), + optimize_saved_vars_const - bool(no), + optimize_saved_vars_cell - bool(no), + optimize_saved_vars_cell_loop - bool(yes), + optimize_saved_vars_cell_full_path - bool(yes), + optimize_saved_vars_cell_on_stack - bool(yes), + optimize_saved_vars_cell_candidate_headvars - bool(yes), + optimize_saved_vars_cell_cv_store_cost - int(3), + optimize_saved_vars_cell_cv_load_cost - int(1), + optimize_saved_vars_cell_fv_store_cost - int(1), + optimize_saved_vars_cell_fv_load_cost - int(1), + optimize_saved_vars_cell_op_ratio - int(100), + optimize_saved_vars_cell_node_ratio - int(100), + optimize_saved_vars_cell_all_path_node_ratio - int(100), + optimize_saved_vars_cell_include_all_candidates - bool(yes), + optimize_saved_vars - bool_special, + delay_construct - bool(no), + follow_code - bool(no), + optimize_unused_args - bool(no), + intermod_unused_args - bool(no), + optimize_higher_order - bool(no), + higher_order_size_limit - int(20), + higher_order_arg_limit - int(10), + unneeded_code - bool(no), + unneeded_code_copy_limit - int(10), + unneeded_code_debug - bool(no), + unneeded_code_debug_pred_name - accumulating([]), + type_specialization - bool(no), + user_guided_type_specialization - bool(no), + introduce_accumulators - bool(no), + optimize_constructor_last_call_accumulator - bool(no), + optimize_constructor_last_call_null - bool(no), + optimize_constructor_last_call - bool(no), + optimize_dead_procs - bool(no), + deforestation - bool(no), + deforestation_depth_limit - int(4), + deforestation_cost_factor - int(1000), + deforestation_vars_threshold - int(200), + deforestation_size_threshold - int(15), + untuple - bool(no), + tuple - bool(no), + tuple_trace_counts_file - string(""), + tuple_costs_ratio - int(100), + tuple_min_args - int(4), + inline_par_builtins - bool(no), + always_specialize_in_dep_par_conjs - bool(no), + allow_some_paths_only_waits - bool(yes), + region_analysis - bool(no), + + % HLDS -> LLDS + smart_indexing - bool(no), + dense_switch_req_density - int(25), + % Minimum density before using + % a dense switch. + lookup_switch_req_density - int(25), + % Minimum density before using + % a lookup switch. + dense_switch_size - int(4), + lookup_switch_size - int(4), + string_hash_switch_size - int(8), + string_binary_switch_size - int(4), + tag_switch_size - int(3), + try_switch_size - int(3), + binary_switch_size - int(4), + switch_single_rec_base_first - bool(no), + switch_multi_rec_base_first - bool(yes), + static_ground_cells - bool(no), + static_ground_floats - bool(no), + static_code_addresses - bool(no), + use_atomic_cells - bool(no), + middle_rec - bool(no), + simple_neg - bool(no), + allow_hijacks - bool(yes), + + % MLDS + optimize_tailcalls - bool(no), + optimize_initializations - bool(no), + eliminate_local_vars - bool(no), + generate_trail_ops_inline - bool(yes), + + % LLDS + common_data - bool(no), + common_layout_data - bool(yes), + optimize - bool(no), + optimize_peep - bool(no), + optimize_peep_mkword - bool(no), + optimize_jumps - bool(no), + optimize_fulljumps - bool(no), + pessimize_tailcalls - bool(no), + checked_nondet_tailcalls - bool(no), + use_local_vars - bool(no), + local_var_access_threshold - int(2), + standardize_labels - bool(no), + optimize_labels - bool(no), + optimize_dups - bool(no), + optimize_proc_dups - bool(no), + optimize_frames - bool(no), + optimize_delay_slot - bool(no), + optimize_reassign - bool(no), + optimize_repeat - int(0), + layout_compression_limit - int(4000), + + % LLDS -> C + use_macro_for_redo_fail - bool(no), + emit_c_loops - bool(no), + procs_per_c_function - int(1), + everything_in_one_c_function - special, + local_thread_engine_base - bool(yes), + + % Erlang + erlang_switch_on_strings_as_atoms - bool(no) +]). +option_defaults_2(target_code_compilation_option, [ + % Target code compilation options + target_debug - bool(no), + + % C + cc - string("gcc"), + % The `mmc' script will override the + % default with a value determined at + % configuration time. + c_include_directory - accumulating([]), + % The `mmc' script will override the + % default with a value determined at + % configuration time. + c_optimize - bool(no), + ansi_c - bool(yes), + inline_alloc - bool(no), + cflags - accumulating([]), + quoted_cflag - string_special, + + gcc_flags - accumulating([]), + quoted_gcc_flag - string_special, + clang_flags - accumulating([]), + quoted_clang_flag - string_special, + msvc_flags - accumulating([]), + quoted_msvc_flag - string_special, + + cflags_for_warnings - string(""), + % The `mmc' script will override the + % default with values determined at + % configuration time. + cflags_for_optimization - string("-O"), + cflags_for_ansi - string(""), + cflags_for_regs - string(""), + cflags_for_gotos - string(""), + cflags_for_threads - string(""), + cflags_for_debug - string("-g"), + cflags_for_pic - string(""), + c_flag_to_name_object_file - string("-o "), + object_file_extension - string(".o"), + pic_object_file_extension - string(".o"), + link_with_pic_object_file_extension - string(".o"), + c_compiler_type - string("gcc"), + csharp_compiler_type - string("mono"), + % The `mmc' script will override the + % default with a value determined at + % configuration time for the above + % two options + % Java + java_compiler - string("javac"), + java_interpreter - string("java"), + java_flags - accumulating([]), + quoted_java_flag - string_special, + java_classpath - accumulating([]), + java_object_file_extension - string(".class"), + + % IL + il_assembler - string("ilasm"), + ilasm_flags - accumulating([]), + quoted_ilasm_flag - string_special, + dotnet_library_version - string("1.0.3300.0"), + % We default to the version of the + % library that came with Beta2. + support_ms_clr - bool(yes), + support_rotor_clr - bool(no), + + % C# + csharp_compiler - string("csc"), + csharp_flags - accumulating([]), + quoted_csharp_flag - string_special, + cli_interpreter - string(""), + + % Erlang + erlang_compiler - string("erlc"), + erlang_interpreter - string("erl"), + erlang_flags - accumulating([]), + quoted_erlang_flag - string_special, + erlang_include_directory - accumulating([]), + erlang_object_file_extension - string(".beam"), + erlang_native_code - bool(no), + erlang_inhibit_trivial_warnings - bool(yes) +]). +option_defaults_2(link_option, [ + % Link Options + output_file_name - string(""), + % If the output_file_name is an empty + % string, we use the name of the first + % module on the command line. + ld_flags - accumulating([]), + quoted_ld_flag - string_special, + ld_libflags - accumulating([]), + quoted_ld_libflag - string_special, + link_library_directories - accumulating([]), + runtime_link_library_directories - accumulating([]), + link_libraries - accumulating([]), + link_objects - accumulating([]), + mercury_library_directory_special - string_special, + mercury_library_directories - accumulating([]), + search_library_files_directory_special - string_special, + search_library_files_directories - accumulating([]), + mercury_library_special - string_special, + mercury_libraries - accumulating([]), + mercury_standard_library_directory - maybe_string(no), + % The Mercury.config file will set the + % default standard library directory. + mercury_standard_library_directory_special - maybe_string_special, + init_file_directories - accumulating([]), + init_files - accumulating([]), + trace_init_files - accumulating([]), + linkage - string("shared"), + linkage_special - string_special, + mercury_linkage - string("shared"), + mercury_linkage_special - string_special, + demangle - bool(yes), + strip - bool(yes), + main - bool(yes), + allow_undefined - bool(yes), + use_readline - bool(yes), + runtime_flags - accumulating([]), + extra_initialization_functions - bool(no), + frameworks - accumulating([]), + framework_directories - accumulating([]), + + shared_library_extension - string(".so"), + % The `mmc' script will override the + % default with a value determined at + % configuration time. + library_extension - string(".a"), + executable_file_extension - string(""), + link_executable_command - string("gcc"), + link_shared_lib_command - string("gcc -shared"), + create_archive_command - string("ar"), + create_archive_command_output_flag - string(""), + create_archive_command_flags - accumulating([]), % "cr" + ranlib_command - string(""), + ranlib_flags - string(""), + mkinit_command - string("mkinit"), + mkinit_erl_command - string("mkinit_erl"), + demangle_command - string("mdemangle"), + filtercc_command - string("mfiltercc"), + trace_libs - string(""), + thread_libs - string(""), + hwloc_libs - string(""), + hwloc_static_libs - string(""), + shared_libs - string(""), + math_lib - string(""), + readline_libs - string(""), + linker_opt_separator - string(""), + linker_debug_flags - string("-g"), + shlib_linker_debug_flags - string("-g"), + linker_trace_flags - string("-g"), + shlib_linker_trace_flags - string("-g"), + linker_thread_flags - string(""), + shlib_linker_thread_flags - string(""), + linker_static_flags - string("-static"), + linker_strip_flag - string("-s"), + linker_link_lib_flag - string("-l"), + linker_link_lib_suffix - string(""), + shlib_linker_link_lib_flag - string("-l"), + shlib_linker_link_lib_suffix - string(""), + linker_path_flag - string("-L"), + linker_rpath_flag - string("-Wl,-rpath"), + linker_rpath_separator - string(" -Wl,-rpath"), + shlib_linker_rpath_flag - string("-Wl,-rpath"), + shlib_linker_rpath_separator - string(" -Wl,-rpath"), + linker_allow_undefined_flag - string(""), + linker_error_undefined_flag - string("-Wl,-no-undefined"), + shlib_linker_use_install_name - bool(no), + shlib_linker_install_name_flag - string("-install_name "), + shlib_linker_install_name_path - string(""), + java_archive_command - string("jar") +]). +option_defaults_2(build_system_option, [ + % Build System Options + make - bool(no), + keep_going - bool(no), + rebuild - bool(no), + jobs - int(1), + track_flags - bool(no), + invoked_by_mmc_make - bool(no), + pre_link_command - maybe_string(no), + extra_init_command - maybe_string(no), + install_prefix - string("/usr/local/"), + use_symlinks - bool(yes), + + % If `--mercury-stdlib-dir' is set, `--mercury-config-dir' + % must also be set. This invariant is maintained by the + % `special' variants of the options. + mercury_configuration_directory_special - string_special, + mercury_configuration_directory - maybe_string(no), + install_command - string("cp"), + install_command_dir_option - string("-r"), + libgrades - accumulating([]), + libgrades_include_components - accumulating([]), + libgrades_exclude_components - accumulating([]), + lib_linkages - accumulating([]), + flags_file - file_special, + options_files - accumulating(["Mercury.options"]), + + config_file - maybe_string(yes("")), + % yes("") means unset. + options_search_directories - accumulating(["."]), + use_subdirs - bool(no), + use_grade_subdirs - bool(no), + search_directories - accumulating(["."]), + intermod_directories - accumulating([]), + use_search_directories_for_intermod - bool(yes), + libgrade_install_check - bool(yes), + order_make_by_timestamp - bool(no), + show_make_times - bool(no), + extra_library_header - accumulating([]), + restricted_command_line - bool(no), + env_type - string_special, + host_env_type - string("posix"), + target_env_type - string("posix") +]). +option_defaults_2(miscellaneous_option, [ + % Miscellaneous Options + filenames_from_stdin - bool(no), + typecheck_ambiguity_warn_limit - int(50), + typecheck_ambiguity_error_limit - int(3000), + help - bool(no), + version - bool(no), + fullarch - string(""), + cross_compiling - bool(no), + local_module_id - accumulating([]), + analysis_file_cache_dir - string(""), + compiler_sufficiently_recent - bool(no), + experiment - string(""), + ignore_par_conjunctions - bool(no), + control_granularity - bool(no), + distance_granularity - int(0), + implicit_parallelism - bool(no), + feedback_file - string(""), + par_loop_control - bool(no), + par_loop_control_preserve_tail_recursion - bool(no) +]). + + % please keep this in alphabetic order +short_option('c', compile_only). +short_option('C', target_code_only). +short_option('d', dump_hlds). +short_option('D', dump_hlds_alias). +short_option('e', errorcheck_only). +short_option('E', verbose_errors). +short_option('f', generate_source_file_mapping). +short_option('F', framework_directories). +short_option('h', help). +short_option('H', highlevel_code). +short_option('i', make_interface). +short_option('j', jobs). +short_option('I', search_directories). +short_option('k', keep_going). +short_option('l', link_libraries). +short_option('L', link_library_directories). +short_option('m', make). +short_option('M', generate_dependencies). +short_option('n', line_numbers). +short_option('N', debug_modes). +short_option('o', output_file_name). +short_option('O', opt_level). +short_option('p', profiling). +short_option('P', convert_to_mercury). +short_option('r', rebuild). +short_option('R', runtime_link_library_directories). +short_option('s', grade). +short_option('S', statistics). +short_option('T', debug_types). +short_option('t', typecheck_only). +short_option('v', verbose). +short_option('V', very_verbose). +short_option('w', inhibit_warnings). +short_option('x', make_xml_documentation). +short_option('?', help). + +% warning options +long_option("inhibit-warnings", inhibit_warnings). +long_option("inhibit-accumulator-warnings", inhibit_accumulator_warnings). +long_option("halt-at-warn", halt_at_warn). +long_option("halt-at-syntax-errors", halt_at_syntax_errors). +long_option("halt-at-auto-parallel-failure", halt_at_auto_parallel_failure). +long_option("warn-singleton-variables", warn_singleton_vars). +long_option("warn-overlapping-scopes", warn_overlapping_scopes). +long_option("warn-det-decls-too-lax", warn_det_decls_too_lax). +long_option("warn-inferred-erroneous", warn_inferred_erroneous). +long_option("warn-nothing-exported", warn_nothing_exported). +long_option("warn-unused-args", warn_unused_args). +long_option("warn-interface-imports", warn_interface_imports). +long_option("warn-non-contiguous-clauses", warn_non_contiguous_clauses). +long_option("warn-non-contiguous-foreign-procs", + warn_non_contiguous_foreign_procs). +long_option("warn-non-stratification", warn_non_stratification). +long_option("warn-missing-opt-files", warn_missing_opt_files). +long_option("warn-missing-trans-opt-files", warn_missing_trans_opt_files). +long_option("warn-missing-trans-opt-deps", warn_missing_trans_opt_deps). +long_option("warn-unification-cannot-succeed", + warn_unification_cannot_succeed). +long_option("warn-simple-code", warn_simple_code). +long_option("warn-duplicate-calls", warn_duplicate_calls). +long_option("warn-missing-module-name", warn_missing_module_name). +long_option("warn-wrong-module-name", warn_wrong_module_name). +long_option("warn-smart-recompilation", warn_smart_recompilation). +long_option("warn-undefined-options-variables", + warn_undefined_options_variables). +long_option("warn-non-tail-recursion", warn_non_tail_recursion). +long_option("warn-target-code", warn_target_code). +long_option("warn-up-to-date", warn_up_to_date). +long_option("warn-stubs", warn_stubs). +long_option("warn-dead-procs", warn_dead_procs). +long_option("warn-table-with-inline", warn_table_with_inline). +long_option("warn-non-term-special-preds", warn_non_term_special_preds). +long_option("warn-known-bad-format-calls", warn_known_bad_format_calls). +long_option("warn-unknown-format-calls", warn_unknown_format_calls). +long_option("warn-obsolete", warn_obsolete). +long_option("warn-insts-without-matching-type", + warn_insts_without_matching_type). +long_option("warn-unused-imports", warn_unused_imports). +long_option("inform-ite-instead-of-switch", inform_ite_instead_of_switch). +long_option("warn-unresolved-polymorphism", warn_unresolved_polymorphism). +long_option("warn-suspicious-foreign-procs", warn_suspicious_foreign_procs). +long_option("warn-state-var-shadowing", warn_state_var_shadowing). +long_option("inform-inferred", inform_inferred). +long_option("inform-inferred-types", inform_inferred_types). +long_option("inform-inferred-modes", inform_inferred_modes). + +% verbosity options +long_option("verbose", verbose). +long_option("very-verbose", very_verbose). +long_option("verbose-error-messages", verbose_errors). +long_option("verbose-recompilation", verbose_recompilation). +long_option("find-all-recompilation-reasons", + find_all_recompilation_reasons). +long_option("verbose-make", verbose_make). +long_option("verbose-commands", verbose_commands). +long_option("output-compile-error-lines", output_compile_error_lines). +long_option("report-cmd-line-args", report_cmd_line_args). +long_option("report-cmd-line-args-in-doterr", + report_cmd_line_args_in_doterr). +long_option("statistics", statistics). +long_option("detailed-statistics", detailed_statistics). +long_option("proc-size-statistics", proc_size_statistics). +long_option("debug-types", debug_types). +long_option("debug-modes", debug_modes). +long_option("debug-modes-statistics", debug_modes_statistics). +long_option("debug-modes-minimal", debug_modes_minimal). +long_option("debug-modes-verbose", debug_modes_verbose). +long_option("debug-modes-pred-id", debug_modes_pred_id). +long_option("debug-dep-par-conj", debug_dep_par_conj). +long_option("debug-determinism", debug_det). +long_option("debug-det", debug_det). +long_option("debug-code-gen-pred-id", debug_code_gen_pred_id). +long_option("debug-termination", debug_term). +long_option("debug-term", debug_term). +long_option("debug-opt", debug_opt). +long_option("debug-opt-pred-id", debug_opt_pred_id). +long_option("debug-opt-pred-name", debug_opt_pred_name). +long_option("debug-pd", debug_pd). + % debug-il-asm does very low-level printf style debugging of + % IL assembler. Each instruction is written on stdout before it + % is executed. It is a temporary measure until the IL debugging + % system built into .NET improves. +long_option("debug-il-asm", debug_il_asm). +long_option("debug-liveness", debug_liveness). +long_option("debug-stack-opt", debug_stack_opt). +long_option("debug-make", debug_make). +long_option("debug-closure", debug_closure). +long_option("debug-trail-usage", debug_trail_usage). +long_option("debug-mode-constraints", debug_mode_constraints). +long_option("debug-intermodule-analysis", debug_intermodule_analysis). +long_option("debug-mm-tabling-analysis", debug_mm_tabling_analysis). +long_option("debug-indirect-reuse", debug_indirect_reuse). +long_option("debug-type-rep", debug_type_rep). + +% output options (mutually exclusive) +long_option("generate-source-file-mapping", generate_source_file_mapping). +long_option("generate-dependency-file", generate_dependency_file). +long_option("generate-dependencies", generate_dependencies). +long_option("generate-module-order", generate_module_order). +long_option("generate-standalone-interface", generate_standalone_interface). +long_option("make-short-interface", make_short_interface). +long_option("make-short-int", make_short_interface). +long_option("make-interface", make_interface). +long_option("make-int", make_interface). +long_option("make-private-interface", make_private_interface). +long_option("make-priv-int", make_private_interface). +long_option("make-optimization-interface", make_optimization_interface). +long_option("make-optimisation-interface", make_optimization_interface). +long_option("make-opt-int", make_optimization_interface). +long_option("make-transitive-optimization-interface", + make_transitive_opt_interface). +long_option("make-transitive-optimisation-interface", + make_transitive_opt_interface). +long_option("make-trans-opt", make_transitive_opt_interface). +long_option("make-analysis-registry", make_analysis_registry). +long_option("make-xml-doc", make_xml_documentation). +long_option("make-xml-documentation", make_xml_documentation). +long_option("convert-to-mercury", convert_to_mercury). +long_option("convert-to-Mercury", convert_to_mercury). +long_option("pretty-print", convert_to_mercury). +long_option("typecheck-only", typecheck_only). +long_option("errorcheck-only", errorcheck_only). +long_option("target-code-only", target_code_only). +long_option("compile-only", compile_only). +long_option("compile-to-shared-lib", compile_to_shared_lib). +long_option("output-grade-string", output_grade_string). +long_option("output-link-command", output_link_command). +long_option("output-shared-lib-link-command", output_shared_lib_link_command). +long_option("output-libgrades", output_libgrades). +long_option("output-cc", output_cc). +long_option("output-cc-type", output_c_compiler_type). +long_option("output-c-compiler-type", output_c_compiler_type). +long_option("output-csharp-compiler-type", output_csharp_compiler_type). +long_option("output-cflags", output_cflags). +long_option("output-library-link-flags", output_library_link_flags). +long_option("output-grade-defines", output_grade_defines). +long_option("output-c-include-directory-flags", + output_c_include_directory_flags). +long_option("output-c-include-dir-flags", + output_c_include_directory_flags). + +% aux output options +long_option("smart-recompilation", smart_recompilation). +long_option("assume-gmake", assume_gmake). +long_option("generate-mmc-make-module-dependencies", + generate_mmc_make_module_dependencies). +long_option("generate-mmc-deps", generate_mmc_make_module_dependencies). +long_option("ssdb-trace", ssdb_trace_level). +long_option("link-ssdb-libs", link_ssdb_libs). +long_option("link-ssdebug-libs", link_ssdb_libs). +long_option("trace", trace_level). +long_option("trace-optimised", trace_optimized). +long_option("trace-optimized", trace_optimized). +long_option("trace-prof", trace_prof). +long_option("trace-table-io", trace_table_io). +long_option("trace-table-io-only-retry", trace_table_io_only_retry). +long_option("trace-table-io-states", trace_table_io_states). +long_option("trace-table-io-require", trace_table_io_require). +long_option("trace-table-io-all", trace_table_io_all). +long_option("trace-flag", trace_goal_flags). +long_option("profile-optimised", prof_optimized). +long_option("profile-optimized", prof_optimized). +long_option("exec-trace-tail-rec", exec_trace_tail_rec). +long_option("suppress-trace", suppress_trace). +long_option("force-disable-tracing", force_disable_tracing). +long_option("delay-death", delay_death). +long_option("delay-death-max-vars", delay_death_max_vars). +long_option("stack-trace-higher-order", stack_trace_higher_order). +long_option("force-disable-ssdebug", force_disable_ssdebug). +long_option("generate-bytecode", generate_bytecode). +long_option("line-numbers", line_numbers). +long_option("auto-comments", auto_comments). +long_option("frameopt-comments", frameopt_comments). +long_option("max-error-line-width", max_error_line_width). +long_option("show-dependency-graph", show_dependency_graph). +long_option("imports-graph", imports_graph). +long_option("dump-trace-counts", dump_trace_counts). +long_option("dump-hlds", dump_hlds). +long_option("hlds-dump", dump_hlds). +long_option("dump-hlds-pred-id", dump_hlds_pred_id). +long_option("dump-hlds-pred-name", dump_hlds_pred_name). +long_option("dump-hlds-alias", dump_hlds_alias). +long_option("dump-hlds-options", dump_hlds_options). +long_option("dump-hlds-inst-limit", dump_hlds_inst_limit). +long_option("dump-hlds-file-suffix", dump_hlds_file_suffix). +long_option("dump-same-hlds", dump_same_hlds). +long_option("dump-mlds", dump_mlds). +long_option("mlds-dump", dump_mlds). +long_option("verbose-dump-mlds", verbose_dump_mlds). +long_option("verbose-mlds-dump", verbose_dump_mlds). +long_option("sign-assembly", sign_assembly). +long_option("separate-assemblies", separate_assemblies). +long_option("mode-constraints", mode_constraints). +long_option("simple-mode-constraints", simple_mode_constraints). +long_option("prop-mode-constraints", prop_mode_constraints). +long_option("propagate-mode-constraints", prop_mode_constraints). +long_option("benchmark-modes", benchmark_modes). +long_option("benchmark-modes-repeat", benchmark_modes_repeat). + +% language semantics options +long_option("reorder-conj", reorder_conj). +long_option("reorder-disj", reorder_disj). +long_option("fully-strict", fully_strict). +long_option("strict-sequential", strict_sequential). +long_option("allow-stubs", allow_stubs). +long_option("infer-all", infer_all). +long_option("infer-types", infer_types). +long_option("infer-modes", infer_modes). +long_option("infer-determinism", infer_det). +long_option("infer-det", infer_det). +long_option("type-inference-iteration-limit", type_inference_iteration_limit). +long_option("mode-inference-iteration-limit", mode_inference_iteration_limit). +long_option("event-set-file-name", event_set_file_name). + +% compilation model options +long_option("grade", grade). +% target selection options +long_option("target", target). +long_option("il", il). +long_option("il-only", il_only). +long_option("IL-only", il_only). +long_option("compile-to-c", compile_to_c). +long_option("compile-to-C", compile_to_c). +long_option("java", java). +long_option("Java", java). +long_option("java-only", java_only). +long_option("Java-only", java_only). +long_option("csharp", csharp). +long_option("C#", csharp). +long_option("csharp-only", csharp_only). +long_option("C#-only", csharp_only). +long_option("x86_64", x86_64). +long_option("x86-64", x86_64). +long_option("x86_64-only", x86_64_only). +long_option("x86-64-only", x86_64_only). +long_option("erlang", erlang). +long_option("Erlang", erlang). +long_option("erlang-only", erlang_only). +long_option("Erlang-only", erlang_only). +% Optional features compilation model options: +% (a) debugging +long_option("debug", exec_trace). +long_option("decl-debug", decl_debug). +long_option("ssdb", source_to_source_debug). +long_option("ss-debug", source_to_source_debug). +long_option("source-to-source-debug", source_to_source_debug). + % (b) profiling +long_option("profiling", profiling). +long_option("time-profiling", time_profiling). +long_option("memory-profiling", memory_profiling). +long_option("deep-profiling", deep_profiling). +long_option("profile-calls", profile_calls). +long_option("profile-time", profile_time). +long_option("profile-memory", profile_memory). +long_option("profile-deep", profile_deep). +long_option("use-activation-counts", use_activation_counts). +long_option("pre-prof-transforms-simplify", pre_prof_transforms_simplify). +long_option("pre-implicit-parallelism-simplify", + pre_implicit_parallelism_simplify). +long_option("coverage-profiling", + coverage_profiling). +long_option("coverage-profiling-via-calls", + coverage_profiling_via_calls). +long_option("coverage-profiling-static", + coverage_profiling_static). +long_option("profile-deep-coverage-after-goal", + profile_deep_coverage_after_goal). +long_option("profile-deep-coverage-branch-ite", + profile_deep_coverage_branch_ite). +long_option("profile-deep-coverage-branch-switch", + profile_deep_coverage_branch_switch). +long_option("profile-deep-coverage-branch-disj", + profile_deep_coverage_branch_disj). +long_option("profile-deep-coverage-use-portcounts", + profile_deep_coverage_use_portcounts). +long_option("profile-deep-coverage-use-trivial", + profile_deep_coverage_use_trivial). +long_option("profile-for-implicit-parallelism", + profile_for_feedback). +long_option("profile-for-feedback", + profile_for_feedback). +long_option("use-zeroing-for-ho-cycles", + use_zeroing_for_ho_cycles). +long_option("use-lots-of-ho-specialization", + use_lots_of_ho_specialization). +long_option("deep-profile-tail-recursion", + deep_profile_tail_recursion). +long_option("record-term-sizes-as-words", record_term_sizes_as_words). +long_option("record-term-sizes-as-cells", record_term_sizes_as_cells). +long_option("experimental-complexity", experimental_complexity). +long_option("region-analysis", region_analysis). +% (c) miscellaneous optional features +long_option("gc", gc). +long_option("garbage-collection", gc). +long_option("parallel", parallel). +long_option("use-trail", use_trail). +long_option("trail-segments", trail_segments). +long_option("type-layout", type_layout). +long_option("maybe-thread-safe", maybe_thread_safe_opt). +long_option("extend-stacks-when-needed", extend_stacks_when_needed). +long_option("stack-segments", stack_segments). +long_option("use-regions", use_regions). +long_option("use-alloc-regions", use_alloc_regions). +long_option("use-regions-debug", use_regions_debug). +long_option("use-regions-profiling",use_regions_profiling). +% Data representation options +long_option("use-minimal-model-stack-copy", use_minimal_model_stack_copy). +long_option("use-minimal-model-own-stacks", use_minimal_model_own_stacks). +long_option("minimal-model-debug", minimal_model_debug). +long_option("single-prec-float", single_prec_float). +long_option("single-precision-float", single_prec_float). +long_option("pic-reg", pic_reg). +long_option("tags", tags). +long_option("num-tag-bits", num_tag_bits). +long_option("num-reserved-addresses", num_reserved_addresses). +long_option("num-reserved-objects", num_reserved_objects). +long_option("bits-per-word", bits_per_word). +long_option("bytes-per-word", bytes_per_word). +long_option("conf-low-tag-bits", conf_low_tag_bits). +long_option("sync-term-size", sync_term_size). +long_option("unboxed-float", unboxed_float). +long_option("unboxed-enums", unboxed_enums). +long_option("unboxed-no-tag-types", unboxed_no_tag_types). +long_option("highlevel-data", highlevel_data). +long_option("high-level-data", highlevel_data). +% LLDS back-end compilation model options +long_option("gcc-non-local-gotos", gcc_non_local_gotos). +long_option("gcc-global-registers", gcc_global_registers). +long_option("asm-labels", asm_labels). +long_option("use-float-registers", use_float_registers). +% MLDS back-end compilation model options +long_option("highlevel-code", highlevel_code). +long_option("high-level-code", highlevel_code). +long_option("highlevel-C", highlevel_code). +long_option("highlevel-c", highlevel_code). +long_option("high-level-C", highlevel_code). +long_option("high-level-c", highlevel_code). +long_option("gcc-nested-functions", gcc_nested_functions). +long_option("det-copy-out", det_copy_out). +long_option("nondet-copy-out", nondet_copy_out). +long_option("put-commit-in-own-func", put_commit_in_own_func). +long_option("put-nondet-env-on-heap", put_nondet_env_on_heap). +% IL back-end compilation model options +long_option("verifiable-code", verifiable_code). +long_option("verifiable", verifiable_code). +long_option("il-funcptr-types", il_funcptr_types). +long_option("IL-funcptr-types", il_funcptr_types). +long_option("il-refany-fields", il_refany_fields). +long_option("IL-refany-fields", il_refany_fields). +long_option("il-byref-tailcalls", il_byref_tailcalls). +long_option("IL-byref-tailcalls", il_byref_tailcalls). + +% internal use options +long_option("backend-foreign-languages", backend_foreign_languages). +long_option("agc-stack-layout", agc_stack_layout). +long_option("basic-stack-layout", basic_stack_layout). +long_option("procid-stack-layout", procid_stack_layout). +long_option("trace-stack-layout", trace_stack_layout). +long_option("body-typeinfo-liveness", body_typeinfo_liveness). +long_option("can-compare-constants-as-ints", can_compare_constants_as_ints). +long_option("pretest-equality-cast-pointers", pretest_equality_cast_pointers). +long_option("can-compare-compound-values", can_compare_compound_values). +long_option("lexically-order-constructors", + lexically_order_constructors). +long_option("mutable-always-boxed", mutable_always_boxed). +long_option("delay-partial-instantiations", delay_partial_instantiations). +long_option("allow-defn-of-builtins", allow_defn_of_builtins). +long_option("special-preds", special_preds). +long_option("type-ctor-info", type_ctor_info). +long_option("type-ctor-layout", type_ctor_layout). +long_option("type-ctor-functors", type_ctor_functors). +long_option("new-type-class-rtti", new_type_class_rtti). +long_option("rtti-line-numbers", rtti_line_numbers). +long_option("disable-mm-pneg", disable_minimal_model_stack_copy_pneg). +long_option("disable-mm-cut", disable_minimal_model_stack_copy_cut). +long_option("disable-trail-ops", disable_trail_ops). +long_option("size-region-ite-fixed", size_region_ite_fixed). +long_option("size-region-disj-fixed", size_region_disj_fixed). +long_option("size-region-commit-fixed", size_region_commit_fixed). +long_option("size-region-ite-protect", size_region_ite_protect). +long_option("size-region-ite-snapshot", size_region_ite_snapshot). +long_option("size-region-semi-disj-protect", size_region_semi_disj_protect). +long_option("size-region-disj-snapshot", size_region_disj_snapshot). +long_option("size-region-commit-entry", size_region_commit_entry). +long_option("solver-type-auto-init", solver_type_auto_init). +long_option("allow-multi-arm-switches", allow_multi_arm_switches). +long_option("type-check-constraints", type_check_constraints). +long_option("allow-argument-packing", allow_argument_packing). + +% code generation options +long_option("low-level-debug", low_level_debug). +long_option("table-debug", table_debug). +long_option("polymorphism", polymorphism). +long_option("trad-passes", trad_passes). +long_option("parallel-liveness", parallel_liveness). +long_option("parallel-code-gen", parallel_code_gen). +long_option("reclaim-heap-on-failure", reclaim_heap_on_failure). +long_option("reclaim-heap-on-semidet-failure", + reclaim_heap_on_semidet_failure). +long_option("reclaim-heap-on-nondet-failure", + reclaim_heap_on_nondet_failure). +long_option("branch-delay-slot", have_delay_slot). +long_option("have-delay-slot", have_delay_slot). +long_option("num-real-r-regs", num_real_r_regs). +long_option("num-real-f-regs", num_real_f_regs). +long_option("num-real-r-temps", num_real_r_temps). +long_option("num-real-f-temps", num_real_f_temps). +long_option("num-real-temps", num_real_r_temps). % obsolete +long_option("max-jump-table-size", max_jump_table_size). +% long_option("max-spec-do-call-closure", +% max_specialized_do_call_closure). +% long_option("max-spec-do-call-class-method", +% max_specialized_do_call_class_method). +long_option("compare-specialization", compare_specialization). +long_option("should-pretest-equality", should_pretest_equality). +long_option("fact-table-max-array-size",fact_table_max_array_size). +long_option("fact-table-hash-percent-full", + fact_table_hash_percent_full). +long_option("gcc-local-labels", gcc_local_labels). +long_option("prefer-switch", prefer_switch). +long_option("opt-no-return-calls", opt_no_return_calls). + +% optimization options + +long_option("opt-level", opt_level). +long_option("optimization-level", opt_level). +long_option("optimisation-level", opt_level). +long_option("opt-space", opt_space). +long_option("optimize-space", opt_space). +long_option("optimise-space", opt_space). +long_option("intermod-opt", intermodule_optimization). +long_option("intermodule-optimization", intermodule_optimization). +long_option("intermodule-optimisation", intermodule_optimization). +long_option("read-opt-files-transitively", read_opt_files_transitively). +long_option("use-opt-files", use_opt_files). +long_option("use-trans-opt-files", use_trans_opt_files). +long_option("transitive-intermodule-optimization", + transitive_optimization). +long_option("transitive-intermodule-optimisation", + transitive_optimization). +long_option("trans-intermod-opt", transitive_optimization). +long_option("intermodule-analysis", intermodule_analysis). +long_option("analysis-repeat", analysis_repeat). +long_option("analysis-file-cache", analysis_file_cache). + +% HLDS->HLDS optimizations +long_option("inlining", inlining). +long_option("inline-simple", inline_simple). +long_option("inline-builtins", inline_builtins). +long_option("inline-single-use", inline_single_use). +long_option("inline-call-cost", inline_call_cost). +long_option("inline-compound-threshold", inline_compound_threshold). +long_option("inline-simple-threshold", inline_simple_threshold). +long_option("intermod-inline-simple-threshold", + intermod_inline_simple_threshold). +long_option("from-ground-term-threshold", + from_ground_term_threshold). +long_option("inline-vars-threshold", inline_vars_threshold). +long_option("const-struct", enable_const_struct). +long_option("common-struct", common_struct). +long_option("common-struct-preds", common_struct_preds). +long_option("common-goal", common_goal). +long_option("excess-assign", excess_assign). +long_option("optimize-format-calls", optimize_format_calls). +long_option("optimize-duplicate-calls", optimize_duplicate_calls). +long_option("optimise-duplicate-calls", optimize_duplicate_calls). +long_option("optimise-constant-propagation", constant_propagation). +long_option("optimize-constant-propagation", constant_propagation). +long_option("optimize-saved-vars", optimize_saved_vars). +long_option("optimise-saved-vars", optimize_saved_vars). +long_option("loop-invariants", loop_invariants). +long_option("optimize-saved-vars-const", optimize_saved_vars_const). +long_option("optimise-saved-vars-const", optimize_saved_vars_const). +long_option("optimize-saved-vars-cell", optimize_saved_vars_cell). +long_option("optimise-saved-vars-cell", optimize_saved_vars_cell). +long_option("osv-loop", optimize_saved_vars_cell_loop). +long_option("osv-full-path", optimize_saved_vars_cell_full_path). +long_option("osv-on-stack", optimize_saved_vars_cell_on_stack). +long_option("osv-cand-head", + optimize_saved_vars_cell_candidate_headvars). +% The next four options are used by tupling.m as well; changes to them +% may require changes there as well. +long_option("osv-cvstore-cost", optimize_saved_vars_cell_cv_store_cost). +long_option("osv-cvload-cost", optimize_saved_vars_cell_cv_load_cost). +long_option("osv-fvstore-cost", optimize_saved_vars_cell_fv_store_cost). +long_option("osv-fvload-cost", optimize_saved_vars_cell_fv_load_cost). +long_option("osv-op-ratio", optimize_saved_vars_cell_op_ratio). +long_option("osv-node-ratio", optimize_saved_vars_cell_node_ratio). +long_option("osv-allpath-node-ratio", + optimize_saved_vars_cell_all_path_node_ratio). +long_option("osv-all-cand", + optimize_saved_vars_cell_include_all_candidates). +long_option("delay-construct", delay_construct). +long_option("delay-constructs", delay_construct). +long_option("follow-code", follow_code). +long_option("constraint-propagation", constraint_propagation). +long_option("local-constraint-propagation", local_constraint_propagation). +long_option("optimize-unused-args", optimize_unused_args). +long_option("optimise-unused-args", optimize_unused_args). +long_option("intermod-unused-args", intermod_unused_args). +long_option("optimize-higher-order", optimize_higher_order). +long_option("optimise-higher-order", optimize_higher_order). +long_option("higher-order-size-limit", higher_order_size_limit). +long_option("higher-order-arg-limit", higher_order_arg_limit). +long_option("unneeded-code", unneeded_code). +long_option("unneeded-code-copy-limit", unneeded_code_copy_limit). +long_option("unneeded-code-debug", unneeded_code_debug). +long_option("unneeded-code-debug-pred-name", unneeded_code_debug_pred_name). +long_option("type-specialization", type_specialization). +long_option("type-specialisation", type_specialization). +long_option("user-guided-type-specialization", + user_guided_type_specialization). +long_option("user-guided-type-specialisation", + user_guided_type_specialization). +% This option is for use in configure.in to test for some bug-fixes for +% type-specialization which are needed to compile the library. It's not +% documented, and should eventually be removed. +long_option("fixed-user-guided-type-specialization", + user_guided_type_specialization). +long_option("introduce-accumulators", introduce_accumulators). +long_option("optimise-constructor-last-call-accumulator", + optimize_constructor_last_call_accumulator). +long_option("optimize-constructor-last-call-accumulator", + optimize_constructor_last_call_accumulator). +long_option("optimise-constructor-last-call-null", + optimize_constructor_last_call_null). +long_option("optimize-constructor-last-call-null", + optimize_constructor_last_call_null). +long_option("optimise-constructor-last-call", + optimize_constructor_last_call). +long_option("optimize-constructor-last-call", + optimize_constructor_last_call). +long_option("optimize-dead-procs", optimize_dead_procs). +long_option("optimise-dead-procs", optimize_dead_procs). +long_option("deforestation", deforestation). +long_option("deforestation-depth-limit", deforestation_depth_limit). +long_option("deforestation-cost-factor", deforestation_cost_factor). +long_option("deforestation-vars-threshold", deforestation_vars_threshold). +long_option("deforestation-size-threshold", deforestation_size_threshold). +long_option("enable-termination", termination). +long_option("enable-term", termination). +long_option("check-termination", termination_check). +long_option("check-term", termination_check). +long_option("chk-term", termination_check). +long_option("verbose-check-termination",verbose_check_termination). +long_option("verb-check-term", verbose_check_termination). +long_option("verb-chk-term", verbose_check_termination). +long_option("termination-single-argument-analysis", + termination_single_args). +long_option("term-single-arg", termination_single_args). +long_option("termination-norm", termination_norm). +long_option("term-norm", termination_norm). +long_option("termination-error-limit", termination_error_limit). +long_option("term-err-limit", termination_error_limit). +long_option("termination-path-limit", termination_path_limit). +long_option("term-path-limit", termination_path_limit). +long_option("enable-termination2", termination2). +long_option("enable-term2", termination2). +long_option("check-termination2", check_termination2). +long_option("check-term2", check_termination2). +long_option("chk-term2", check_termination2). +long_option("verbose-check-termination2",verbose_check_termination2). +long_option("verb-check-term2", verbose_check_termination2). +long_option("verb-chk-term2", verbose_check_termination2). +long_option("termination2-widening-limit", widening_limit). +long_option("term2-widening-limit", widening_limit). +long_option("arg-size-analysis-only", arg_size_analysis_only). +long_option("termination2-propagate-failure-constraints", + propagate_failure_constrs). +long_option("term2-propagate-failure-constraints", + propagate_failure_constrs). +long_option("term2-propagate-failure-constrs", propagate_failure_constrs). +long_option("termination2-norm", termination2_norm). +long_option("term2-norm", termination2_norm). +long_option("termination2-maximum-matrix-size", term2_maximum_matrix_size). +long_option("term2-max-matrix-size", term2_maximum_matrix_size). +long_option("analyse-exceptions", analyse_exceptions). +long_option("analyse-closures", analyse_closures). +long_option("analyse-local-closures", analyse_closures). +long_option("analyse-trail-usage", analyse_trail_usage). +long_option("optimize-trail-usage", optimize_trail_usage). +long_option("optimize-region-ops", optimize_region_ops). +long_option("analyse-mm-tabling", analyse_mm_tabling). +long_option("untuple", untuple). +long_option("tuple", tuple). +long_option("tuple-trace-counts-file", tuple_trace_counts_file). +long_option("tuple-costs-ratio", tuple_costs_ratio). +long_option("tuple-min-args", tuple_min_args). +long_option("inline-par-builtins", inline_par_builtins). +long_option("always-specialize-in-dep-par-conjs", + always_specialize_in_dep_par_conjs). +long_option("allow-some-paths-only-waits", + allow_some_paths_only_waits). + +% CTGC related options. +long_option("structure-sharing", structure_sharing_analysis). +long_option("structure-sharing-widening", structure_sharing_widening). +long_option("structure-reuse", structure_reuse_analysis). +long_option("ctgc", structure_reuse_analysis). +long_option("structure-reuse-constraint", structure_reuse_constraint). +long_option("ctgc-constraint", structure_reuse_constraint). +long_option("structure-reuse-constraint-arg", structure_reuse_constraint_arg). +long_option("ctgc-constraint-arg", structure_reuse_constraint_arg). +long_option("structure-reuse-max-conditions", structure_reuse_max_conditions). +long_option("structure-reuse-repeat", structure_reuse_repeat). +long_option("structure-reuse-free-cells", structure_reuse_free_cells). + +% HLDS->LLDS optimizations +long_option("smart-indexing", smart_indexing). +long_option("dense-switch-req-density", dense_switch_req_density). +long_option("lookup-switch-req-density",lookup_switch_req_density). +long_option("dense-switch-size", dense_switch_size). +long_option("lookup-switch-size", lookup_switch_size). +long_option("string-switch-size", string_hash_switch_size). +long_option("string-hash-switch-size", string_hash_switch_size). +long_option("string-binary-switch-size", string_binary_switch_size). +long_option("tag-switch-size", tag_switch_size). +long_option("try-switch-size", try_switch_size). +long_option("binary-switch-size", binary_switch_size). +long_option("switch-single-rec-base-first", switch_single_rec_base_first). +long_option("switch-multi-rec-base-first", switch_multi_rec_base_first). +long_option("static-ground-terms", static_ground_cells). +% static_ground_floats should be set only in handle_options.m. +% long_option("static-ground-floats", static_ground_floats). +% static_code_addresses should be set only in handle_options.m. +% long_option("static-code-addresses", static_code_addresses). +long_option("use-atomic-cells", use_atomic_cells). +long_option("middle-rec", middle_rec). +long_option("simple-neg", simple_neg). +long_option("allow-hijacks", allow_hijacks). + +% MLDS optimizations +% Option `optimize' is used for both MLDS and LLDS optimizations, but since +% you can't use both at the same time it doesn't really matter. +long_option("mlds-optimize", optimize). +long_option("mlds-optimise", optimize). +long_option("mlds-peephole", optimize_peep). +long_option("optimize-tailcalls", optimize_tailcalls). +long_option("optimise-tailcalls", optimize_tailcalls). +long_option("optimize-initializations", optimize_initializations). +long_option("optimise-initializations", optimize_initializations). +long_option("eliminate-local-vars", eliminate_local_vars). +long_option("generate-trail-ops-inline", generate_trail_ops_inline). + +% LLDS optimizations +long_option("common-data", common_data). +long_option("common-layout-data", common_layout_data). +long_option("llds-optimize", optimize). +long_option("llds-optimise", optimize). +long_option("optimize-peep", optimize_peep). +long_option("optimise-peep", optimize_peep). +long_option("optimize-peep-mkword", optimize_peep_mkword). +long_option("optimise-peep-mkword", optimize_peep_mkword). +long_option("optimize-jumps", optimize_jumps). +long_option("optimise-jumps", optimize_jumps). +long_option("optimize-fulljumps", optimize_fulljumps). +long_option("optimise-fulljumps", optimize_fulljumps). +long_option("pessimize-tailcalls", pessimize_tailcalls). +long_option("checked-nondet-tailcalls", checked_nondet_tailcalls). +long_option("use-local-vars", use_local_vars). +long_option("local-var-access-threshold", local_var_access_threshold). +long_option("standardise-labels", standardize_labels). +long_option("standardize-labels", standardize_labels). +long_option("optimize-labels", optimize_labels). +long_option("optimise-labels", optimize_labels). +long_option("optimize-dups", optimize_dups). +long_option("optimise-dups", optimize_dups). +long_option("optimize-proc-dups", optimize_proc_dups). +long_option("optimise-proc-dups", optimize_proc_dups). +%%% long_option("optimize-copyprop", optimize_copyprop). +%%% long_option("optimise-copyprop", optimize_copyprop). +long_option("optimize-frames", optimize_frames). +long_option("optimise-frames", optimize_frames). +long_option("optimize-delay-slot", optimize_delay_slot). +long_option("optimise-delay-slot", optimize_delay_slot). +long_option("optimize-reassign", optimize_reassign). +long_option("optimise-reassign", optimize_reassign). +long_option("optimize-repeat", optimize_repeat). +long_option("optimise-repeat", optimize_repeat). +long_option("layout-compression-limit", layout_compression_limit). + +% LLDS->C optimizations +long_option("use-macro-for-redo-fail", use_macro_for_redo_fail). +long_option("emit-c-loops", emit_c_loops). +long_option("procs-per-c-function", procs_per_c_function). +long_option("procs-per-C-function", procs_per_c_function). +long_option("everything-in-one-c-function", everything_in_one_c_function). +long_option("everything-in-one-C-function", everything_in_one_c_function). +long_option("inline-alloc", inline_alloc). +long_option("local-thread-engine-base", local_thread_engine_base). + +% Erlang +long_option("erlang-switch-on-strings-as-atoms", + erlang_switch_on_strings_as_atoms). + +% Target code compilation options +long_option("target-debug", target_debug). + +long_option("cc", cc). +long_option("c-optimise", c_optimize). +long_option("c-optimize", c_optimize). +% XXX we should consider the relationship between c_debug and target_debug +% more carefully. Perhaps target_debug could imply C debug if the target is C. +% However for the moment they are just synonyms. +long_option("c-debug", target_debug). +long_option("c-include-directory", c_include_directory). +long_option("c-include-dir", c_include_directory). +long_option("ansi-c", ansi_c). +long_option("cflags", cflags). +long_option("cflag", quoted_cflag). + +long_option("gcc-flags", gcc_flags). +long_option("gcc-flag", quoted_gcc_flag). +long_option("clang-flags", clang_flags). +long_option("clang-flag", quoted_clang_flag). +long_option("msvc-flags", msvc_flags). +long_option("msvc-flag", quoted_msvc_flag). + +long_option("cflags-for-warnings", cflags_for_warnings). +long_option("cflags-for-optimization", cflags_for_optimization). +long_option("cflags-for-ansi", cflags_for_ansi). +long_option("cflags-for-regs", cflags_for_regs). +long_option("cflags-for-gotos", cflags_for_gotos). +long_option("cflags-for-threads", cflags_for_threads). +long_option("cflags-for-debug", cflags_for_debug). +long_option("cflags-for-pic", cflags_for_pic). +long_option("c-flag-to-name-object-file", c_flag_to_name_object_file). +long_option("object-file-extension", object_file_extension). +long_option("pic-object-file-extension", pic_object_file_extension). +long_option("link-with-pic-object-file-extension", + link_with_pic_object_file_extension). +long_option("c-compiler-type", c_compiler_type). +long_option("csharp-compiler-type", csharp_compiler_type). + + +long_option("java-compiler", java_compiler). +long_option("javac", java_compiler). +long_option("java-interpreter", java_interpreter). +long_option("java-flags", java_flags). +long_option("java-flag", quoted_java_flag). +% XXX we should consider the relationship between java_debug and target_debug +% more carefully. Perhaps target_debug could imply Java debug if the target +% is Java. However for the moment they are just synonyms. +long_option("java-debug", target_debug). +long_option("java-classpath", java_classpath). +long_option("java-object-file-extension", java_object_file_extension). + +long_option("il-assembler", il_assembler). +long_option("ilasm-flags", ilasm_flags). +long_option("ilasm-flag", quoted_ilasm_flag). +long_option("dotnet-library-version", dotnet_library_version). +long_option("support-ms-clr", support_ms_clr). +long_option("support-rotor-clr", support_rotor_clr). + +long_option("csharp-compiler", csharp_compiler). +long_option("csharp-flags", csharp_flags). +long_option("csharp-flag", quoted_csharp_flag). +long_option("cli-interpreter", cli_interpreter). + +long_option("erlang-compiler", erlang_compiler). +long_option("erlang-interpreter", erlang_interpreter). +long_option("erlang-flags", erlang_flags). +long_option("erlang-flag", quoted_erlang_flag). +long_option("erlang-include-directory", erlang_include_directory). +long_option("erlang-include-dir", erlang_include_directory). +long_option("erlang-object-file-extension", erlang_object_file_extension). +long_option("erlang-native-code", erlang_native_code). +long_option("erlang-inhibit-trivial-warnings", + erlang_inhibit_trivial_warnings). + +% link options +long_option("output-file", output_file_name). +long_option("ld-flags", ld_flags). +long_option("ld-flag", quoted_ld_flag). +long_option("ld-libflags", ld_libflags). +long_option("ld-libflag", quoted_ld_libflag). +long_option("library-directory", link_library_directories). +long_option("runtime-library-directory", runtime_link_library_directories). +long_option("library", link_libraries). +long_option("link-object", link_objects). +long_option("mercury-library", mercury_library_special). +long_option("ml", mercury_library_special). +long_option("mercury-library-directory", mercury_library_directory_special). +long_option("mld", mercury_library_directory_special). +long_option("search-library-files-directory", + search_library_files_directory_special). +long_option("search-lib-files-dir", + search_library_files_directory_special). +long_option("mercury-standard-library-directory", + mercury_standard_library_directory_special). +long_option("mercury-stdlib-dir", + mercury_standard_library_directory_special). +long_option("init-file-directory", init_file_directories). +long_option("init-file", init_files). +long_option("trace-init-file", trace_init_files). +long_option("linkage", linkage_special). +long_option("mercury-linkage", mercury_linkage_special). +long_option("demangle", demangle). +long_option("strip", strip). +long_option("main", main). +long_option("allow-undefined", allow_undefined). +long_option("use-readline", use_readline). +long_option("runtime-flags", runtime_flags). +long_option("extra-initialization-functions", + extra_initialization_functions). +long_option("extra-inits", extra_initialization_functions). +long_option("framework", frameworks). +long_option("framework-directory", framework_directories). + +long_option("shared-library-extension", shared_library_extension). +long_option("library-extension", library_extension). +long_option("executable-file-extension", executable_file_extension). +long_option("create-archive-command", create_archive_command). +long_option("create-archive-command-output-flag", + create_archive_command_output_flag). +long_option("create-archive-command-flags", create_archive_command_flags). +long_option("link-executable-command", link_executable_command). +long_option("link-shared-lib-command", link_shared_lib_command). +long_option("ranlib-command", ranlib_command). +long_option("ranlib-flags", ranlib_flags). +long_option("mkinit-command", mkinit_command). +long_option("mkinit-erl-command", mkinit_erl_command). +long_option("demangle-command", demangle_command). +long_option("filtercc-command", filtercc_command). +long_option("trace-libs", trace_libs). +long_option("thread-libs", thread_libs). +long_option("hwloc-libs", hwloc_libs). +long_option("hwloc-static-libs", hwloc_static_libs). +long_option("shared-libs", shared_libs). +long_option("math-lib", math_lib). +long_option("readline-libs", readline_libs). +long_option("linker-opt-separator", linker_opt_separator). +long_option("linker-debug-flags", linker_debug_flags). +long_option("shlib-linker-debug-flags", shlib_linker_debug_flags). +long_option("linker-trace-flags", linker_trace_flags). +long_option("shlib-linker-trace-flags", shlib_linker_trace_flags). +long_option("linker-thread-flags", linker_thread_flags). +long_option("shlib-linker-thread-flags", shlib_linker_thread_flags). +long_option("linker-static-flags", linker_static_flags). +long_option("linker-strip-flag", linker_strip_flag). +long_option("linker-link-lib-flag", linker_link_lib_flag). +long_option("linker-link-lib-suffix", linker_link_lib_suffix). +long_option("shlib-linker-link-lib-flag", shlib_linker_link_lib_flag). +long_option("shlib-linker-link-lib-suffix", shlib_linker_link_lib_suffix). +long_option("linker-path-flag", linker_path_flag). +long_option("linker-rpath-flag", linker_rpath_flag). +long_option("linker-rpath-separator", linker_rpath_separator). +long_option("shlib-linker-rpath-flag", shlib_linker_rpath_flag). +long_option("shlib-linker-rpath-separator", shlib_linker_rpath_separator). +long_option("linker-allow-undefined-flag", linker_allow_undefined_flag). +long_option("linker-error-undefined-flag", linker_error_undefined_flag). +long_option("shlib-linker-use-install-name", shlib_linker_use_install_name). +long_option("shlib-linker-install-name-flag", shlib_linker_install_name_flag). +long_option("shlib-linker-install-name-path", shlib_linker_install_name_path). +long_option("java-archive-command", java_archive_command). + +% build system options +long_option("make", make). +long_option("keep-going", keep_going). +long_option("rebuild", rebuild). +long_option("jobs", jobs). +long_option("track-flags", track_flags). +long_option("track-options", track_flags). +long_option("invoked-by-mmc-make", invoked_by_mmc_make). +long_option("pre-link-command", pre_link_command). +long_option("extra-init-command", extra_init_command). +long_option("mercury-configuration-directory", + mercury_configuration_directory_special). +long_option("mercury-config-dir", + mercury_configuration_directory_special). +long_option("install-prefix", install_prefix). +long_option("install-command", install_command). +long_option("install-command-dir-option", install_command_dir_option). +long_option("use-symlinks", use_symlinks). +long_option("library-grade", libgrades). +long_option("libgrade", libgrades). +long_option("libgrades-include-component", libgrades_include_components). +long_option("libgrades-include", libgrades_include_components). +long_option("libgrades-exclude-component", libgrades_exclude_components). +long_option("libgrades-exclude", libgrades_exclude_components). +long_option("library-linkage", lib_linkages). +long_option("lib-linkage", lib_linkages). +long_option("flags", flags_file). +long_option("flags-file", flags_file). +long_option("options-file", options_files). +long_option("config-file", config_file). +long_option("options-search-directory", options_search_directories). +long_option("use-subdirs", use_subdirs). +long_option("use-grade-subdirs", use_grade_subdirs). +long_option("search-directory", search_directories). +long_option("intermod-directory", intermod_directories). +long_option("use-search-directories-for-intermod", + use_search_directories_for_intermod). +long_option("libgrade-install-check", libgrade_install_check). +long_option("order-make-by-timestamp", order_make_by_timestamp). +long_option("show-make-times", show_make_times). +long_option("extra-lib-header", extra_library_header). +long_option("extra-library-header", extra_library_header). +long_option("restricted-command-line", restricted_command_line). +long_option("env-type", env_type). +long_option("host-env-type", host_env_type). +long_option("target-env-type", target_env_type). + +% misc options +long_option("typecheck-ambiguity-warn-limit", + typecheck_ambiguity_warn_limit). +long_option("typecheck-ambiguity-error-limit", + typecheck_ambiguity_error_limit). +long_option("help", help). +long_option("version", version). +long_option("filenames-from-stdin", filenames_from_stdin). +long_option("fullarch", fullarch). +long_option("cross-compiling", cross_compiling). +long_option("local-module-id", local_module_id). +long_option("analysis-file-cache-dir", analysis_file_cache_dir). +long_option("bug-intermod-2002-06-13", compiler_sufficiently_recent). +long_option("bug-intermod-2006-09-28", compiler_sufficiently_recent). +long_option("bug-foreign_import-2002-08-06", compiler_sufficiently_recent). +long_option("install-opt-files-2002-08-30", compiler_sufficiently_recent). +long_option("read-config-file-2003-03-01", compiler_sufficiently_recent). +% XXX this option won't be recognised because of the "no-" prefix, +% but "no-no-" will be recognised. +long_option("no-noncompact-ho-call-2004-01-15", compiler_sufficiently_recent). +long_option("trace-io-builtins-2006-08-14", compiler_sufficiently_recent). +long_option("compound-compare-builtins-2007-07-09", + compiler_sufficiently_recent). +% XXX this option won't be recognised because of the "no-" prefix, +% but "no-no-" will be recognised. +long_option("no-det-warning-compound-compare-2007-07-17", + compiler_sufficiently_recent). +long_option("foreign-enum-switch-fix", + compiler_sufficiently_recent). +long_option("failing-disjunct-in-switch-dup-fix", + compiler_sufficiently_recent). +long_option("store-at-ref-impure-2008-09-11", + compiler_sufficiently_recent). +long_option("java-export-ref-out", compiler_sufficiently_recent). +long_option("java-generics-2010-04-13", + compiler_sufficiently_recent). +long_option("experiment", experiment). +long_option("ignore-par-conjunctions", + ignore_par_conjunctions). +long_option("control-granularity", control_granularity). +long_option("distance-granularity", distance_granularity). +long_option("implicit-parallelism", implicit_parallelism). +long_option("feedback-file", feedback_file). +long_option("par-loop-control", par_loop_control). +long_option("par-loop-control-preserve-tail-recursion", + par_loop_control_preserve_tail_recursion). + +%-----------------------------------------------------------------------------% + +special_handler(grade, string(Grade), OptionTable0, Result) :- + ( convert_grade_option(Grade, OptionTable0, OptionTable) -> + Result = ok(OptionTable) + ; + Result = error("invalid grade `" ++ Grade ++ "'") + ). +special_handler(il, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("il"), !OptionTable). +special_handler(il_only, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("il"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(compile_to_c, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("c"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(java, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("java"), !OptionTable). +special_handler(java_only, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("java"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(csharp, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("csharp"), !OptionTable). +special_handler(csharp_only, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("csharp"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(x86_64, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("x86_64"), !OptionTable). +special_handler(x86_64_only, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("x86_64"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(erlang, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("erlang"), !OptionTable). +special_handler(erlang_only, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(target, string("erlang"), !OptionTable), + map.set(target_code_only, bool(yes), !OptionTable). +special_handler(profiling, bool(Value), !.OptionTable, ok(!:OptionTable)) :- + map.set(profile_time, bool(Value), !OptionTable), + map.set(profile_calls, bool(Value), !OptionTable), + map.set(profile_memory, bool(no), !OptionTable), + map.set(profile_deep, bool(no), !OptionTable). +special_handler(time_profiling, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(profile_time, bool(yes), !OptionTable), + map.set(profile_calls, bool(yes), !OptionTable), + map.set(profile_memory, bool(no), !OptionTable), + map.set(profile_deep, bool(no), !OptionTable). +special_handler(memory_profiling, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(profile_time, bool(no), !OptionTable), + map.set(profile_calls, bool(yes), !OptionTable), + map.set(profile_memory, bool(yes), !OptionTable), + map.set(profile_deep, bool(no), !OptionTable). +special_handler(deep_profiling, none, !.OptionTable, ok(!:OptionTable)) :- + map.set(profile_time, bool(no), !OptionTable), + map.set(profile_calls, bool(no), !OptionTable), + map.set(profile_memory, bool(no), !OptionTable), + map.set(profile_deep, bool(yes), !OptionTable). +special_handler(inlining, bool(Value), !.OptionTable, ok(!:OptionTable)) :- + map.set(inline_simple, bool(Value), !OptionTable), + map.set(inline_builtins, bool(Value), !OptionTable), + map.set(inline_single_use, bool(Value), !OptionTable), + ( + Value = yes, + map.set(inline_compound_threshold, int(10), !OptionTable) + ; + Value = no, + map.set(inline_compound_threshold, int(0), !OptionTable) + ). +special_handler(everything_in_one_c_function, none, !.OptionTable, + ok(!:OptionTable)) :- + map.set(procs_per_c_function, int(0), !OptionTable). +special_handler(reclaim_heap_on_failure, bool(Value), !.OptionTable, + ok(!:OptionTable)) :- + map.set(reclaim_heap_on_semidet_failure, bool(Value), !OptionTable), + map.set(reclaim_heap_on_nondet_failure, bool(Value), !OptionTable). +special_handler(strict_sequential, none, !.OptionTable, ok(!:OptionTable)) :- + override_options([ + reorder_conj - bool(no), + reorder_disj - bool(no), + fully_strict - bool(yes) + ], !OptionTable). +special_handler(inhibit_warnings, bool(Inhibit), !.OptionTable, + ok(!:OptionTable)) :- + bool.not(Inhibit, Enable), + override_options([ + inhibit_accumulator_warnings - bool(Inhibit), + warn_singleton_vars - bool(Enable), + warn_overlapping_scopes - bool(Enable), + warn_det_decls_too_lax - bool(Enable), + warn_inferred_erroneous - bool(Enable), + warn_nothing_exported - bool(Enable), + warn_interface_imports - bool(Enable), + warn_missing_opt_files - bool(Enable), + warn_missing_trans_opt_files - bool(Enable), + warn_missing_trans_opt_deps - bool(Enable), + warn_unification_cannot_succeed - bool(Enable), + warn_simple_code - bool(Enable), + warn_missing_module_name - bool(Enable), + warn_wrong_module_name - bool(Enable), + warn_smart_recompilation - bool(Enable), + warn_undefined_options_variables - bool(Enable), + warn_target_code - bool(Enable), + warn_up_to_date - bool(Enable), + warn_stubs - bool(Enable), + warn_dead_procs - bool(Enable), + warn_table_with_inline - bool(Enable), + warn_non_term_special_preds - bool(Enable), + warn_insts_without_matching_type - bool(Enable) + ], !OptionTable). +special_handler(infer_all, bool(Infer), !.OptionTable, ok(!:OptionTable)) :- + override_options([ + infer_types - bool(Infer), + infer_modes - bool(Infer), + infer_det - bool(Infer) + ], !OptionTable). +special_handler(opt_space, none, !.OptionTable, ok(!:OptionTable)) :- + opt_space(OptionSettingsList), + override_options(OptionSettingsList, !OptionTable). +special_handler(opt_level, int(N0), !.OptionTable, ok(!:OptionTable)) :- + ( N0 > 6 -> + N = 6 + ; N0 < -1 -> + N = -1 + ; + N = N0 + ), + map.set(opt_level_number, int(N), !OptionTable), + set_opt_level(N, !OptionTable). +special_handler(optimize_saved_vars, bool(Optimize), + !.OptionTable, ok(!:OptionTable)) :- + map.set(optimize_saved_vars_const, bool(Optimize), !OptionTable), + map.set(optimize_saved_vars_cell, bool(Optimize), !OptionTable). +special_handler(mercury_library_directory_special, string(Dir), + !.OptionTable, ok(!:OptionTable)) :- + !:OptionTable = option_table_add_mercury_library_directory( + !.OptionTable, Dir). +special_handler(search_library_files_directory_special, string(Dir), + OptionTable0, ok(OptionTable)) :- + OptionTable = option_table_add_search_library_files_directory( + OptionTable0, Dir). +special_handler(mercury_library_special, string(Lib), + OptionTable0, ok(OptionTable)) :- + OptionTable = + list.foldl(append_to_accumulating_option, [ + link_libraries - Lib, + mercury_libraries - Lib, + init_files - (Lib ++ ".init") + ], OptionTable0). +special_handler(mercury_standard_library_directory_special, + maybe_string(MaybeStdLibDir), OptionTable0, ok(OptionTable)) :- + OptionTable = + map.set(map.set(OptionTable0, + mercury_standard_library_directory, maybe_string(MaybeStdLibDir)), + mercury_configuration_directory, maybe_string(MaybeStdLibDir)). +special_handler(mercury_configuration_directory_special, + string(ConfDir), OptionTable0, ok(OptionTable)) :- + OptionTable = map.set(OptionTable0, mercury_configuration_directory, + maybe_string(yes(ConfDir))). +special_handler(quoted_cflag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(cflags, Flag, OptionTable0, OptionTable). +special_handler(quoted_gcc_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(gcc_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_clang_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(clang_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_msvc_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(msvc_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_java_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(java_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_ilasm_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(ilasm_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_csharp_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(csharp_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_erlang_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(erlang_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_ld_flag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(ld_flags, Flag, OptionTable0, OptionTable). +special_handler(quoted_ld_libflag, string(Flag), + OptionTable0, ok(OptionTable)) :- + handle_quoted_flag(ld_libflags, Flag, OptionTable0, OptionTable). +special_handler(linkage_special, string(Flag), OptionTable0, Result) :- + ( ( Flag = "shared" ; Flag = "static" ) -> + Result = ok( + (OptionTable0 ^ elem(mercury_linkage) := string(Flag)) + ^ elem(linkage) := string(Flag)) + ; + Result = error("argument of `--linkage' should be either " ++ + """shared"" or ""static"".") + ). +special_handler(mercury_linkage_special, string(Flag), + OptionTable0, Result) :- + ( ( Flag = "shared" ; Flag = "static" ) -> + Result = ok(OptionTable0 ^ elem(mercury_linkage) := string(Flag)) + ; + Result = error("argument of `--mercury-linkage' should be either " ++ + """shared"" or ""static"".") + ). + +special_handler(env_type, string(EnvTypeStr), OptionTable0, ok(OptionTable)) :- + OptionTable = + map.set(map.set(OptionTable0, + host_env_type, string(EnvTypeStr)), + target_env_type, string(EnvTypeStr)). + +special_handler(inform_inferred, bool(Inform), !.OptionTable, + ok(!:OptionTable)) :- + override_options([ + inform_inferred_types - bool(Inform), + inform_inferred_modes - bool(Inform) + ], !OptionTable). + +%-----------------------------------------------------------------------------% + +option_table_add_mercury_library_directory(OptionTable0, Dir) = + % The init_file_directories and link_library_directories for Mercury + % libraries are grade dependent, so they need to be handled in + % handle_options.m after we know the grade. + list.foldl(append_to_accumulating_option, [ + search_directories - dir.make_path_name(Dir, "ints"), + c_include_directory - dir.make_path_name(Dir, "inc"), + erlang_include_directory - dir.make_path_name(Dir, "inc"), + mercury_library_directories - Dir + ], OptionTable0). + +option_table_add_search_library_files_directory(OptionTable0, Dir) = + % Grade dependent directories need to be handled in handle_options.m + % after we know the grade. + list.foldl(append_to_accumulating_option, [ + search_directories - Dir, + c_include_directory - Dir, + erlang_include_directory - Dir, + search_library_files_directories - Dir + ], OptionTable0). + +:- func append_to_accumulating_option(pair(option, string), + option_table) = option_table. + +append_to_accumulating_option(Option - Value, OptionTable0) = + OptionTable0 ^ elem(Option) := + accumulating( + getopt_io.lookup_accumulating_option(OptionTable0, Option) + ++ [Value]). + +:- pred set_opt_level(int::in, option_table::in, option_table::out) is det. + +set_opt_level(N, !OptionTable) :- + % First reset all optimizations to their default + % (the default should be all optimizations off). + option_defaults_2(optimization_option, OptimizationDefaults), + override_options(OptimizationDefaults, !OptionTable), + + % Next enable the optimization levels from 0 up to N. + enable_opt_levels(0, N, !OptionTable). + +:- pred enable_opt_levels(int::in, int::in, + option_table::in, option_table::out) is det. + +enable_opt_levels(N0, N, !OptionTable) :- + ( N0 > N -> + true + ; opt_level(N0, !.OptionTable, OptionSettingsList) -> + override_options(OptionSettingsList, !OptionTable), + N1 = N0 + 1, + enable_opt_levels(N1, N, !OptionTable) + ; + unexpected($module, $pred, "unknown optimization level") + ). + +:- pred override_options(list(pair(option, option_data))::in, + option_table::in, option_table::out) is det. + +override_options([], !OptionTable). +override_options([Option - Value | Settings], !OptionTable) :- + map.set(Option, Value, !OptionTable), + override_options(Settings, !OptionTable). + +%-----------------------------------------------------------------------------% + +:- pred opt_space(list(pair(option, option_data))::out) is det. + +opt_space([ + unneeded_code_copy_limit - int(1), + optimize_dead_procs - bool(yes), + optimize_labels - bool(yes), + optimize_dups - bool(yes), + optimize_proc_dups - bool(yes), + optimize_fulljumps - bool(no), + optimize_reassign - bool(yes), + inline_alloc - bool(no), + use_macro_for_redo_fail - bool(no), + loop_invariants - bool(no) +]). + +%-----------------------------------------------------------------------------% + +:- pred opt_level(int::in, option_table::in, + list(pair(option, option_data))::out) is semidet. + +% Optimization level -1: +% Generate totally unoptimized code; turns off ALL optimizations that +% can be turned off, including HLDS->HLDS, HLDS->LLDS, LLDS->LLDS, LLDS->C, +% and C->object optimizations. +% (However, there are some optimizations that can't be disabled.) + +% Optimization level 0: aim to minimize overall compilation time. +% XXX I just guessed. We should run lots of experiments. + +opt_level(0, _, [ + common_data - bool(yes), + optimize - bool(yes), + optimize_repeat - int(1), + optimize_peep - bool(yes), + optimize_peep_mkword - bool(yes), + static_ground_cells - bool(yes), + smart_indexing - bool(yes), + optimize_jumps - bool(yes), + optimize_labels - bool(yes), + optimize_dead_procs - bool(yes), + excess_assign - bool(yes) % ??? +]). + +% Optimization level 1: apply optimizations which are cheap and +% have a good payoff while still keeping compilation time small. + +opt_level(1, OptionTable, [ + use_local_vars - bool(yes), + c_optimize - bool(yes), % XXX we want `gcc -O1' + optimize_frames - bool(yes), + optimize_delay_slot - bool(DelaySlot), + middle_rec - bool(yes), + emit_c_loops - bool(yes), + optimize_tailcalls - bool(yes) + % dups? +]) :- + getopt_io.lookup_bool_option(OptionTable, have_delay_slot, DelaySlot). + +% Optimization level 2: apply optimizations which have a good +% payoff relative to their cost; but include optimizations +% which are more costly than with -O1. + +opt_level(2, _, [ + optimize_fulljumps - bool(yes), + optimize_repeat - int(3), + optimize_dups - bool(yes), + follow_code - bool(yes), + inline_simple - bool(yes), + inline_single_use - bool(yes), + inline_compound_threshold - int(10), + common_struct - bool(yes), + user_guided_type_specialization - bool(yes), + % XXX While inst `array' is defined as `ground', we can't optimize + % duplicate calls (we might combine calls to `array.init'). + % optimize_duplicate_calls - bool(yes), + simple_neg - bool(yes), + + optimize_initializations - bool(yes) +]). + +% Optimization level 3: apply optimizations which usually have a good +% payoff even if they increase compilation time quite a bit. + +opt_level(3, _, [ + optimize_saved_vars_const - bool(yes), + optimize_unused_args - bool(yes), + optimize_higher_order - bool(yes), + deforestation - bool(yes), + local_constraint_propagation - bool(yes), + constant_propagation - bool(yes), + optimize_reassign - bool(yes), + % Disabled until a bug in extras/trailed_update/var.m is resolved. + % introduce_accumulators - bool(yes), + optimize_repeat - int(4) +]). + +% Optimization level 4: apply optimizations which may have some +% payoff even if they increase compilation time quite a bit. + +% Currently this enables the use of local variables +% and increases the inlining thresholds. + +opt_level(4, _, [ + inline_simple_threshold - int(8), + inline_compound_threshold - int(20), + higher_order_size_limit - int(30) +]). + +% Optimization level 5: apply optimizations which may have some +% payoff even if they increase compilation time a lot. + +% Currently this enables the search for construction unifications that can be +% delayed past failing computations, allows more passes of the low-level +% optimizations, and increases the inlining thresholds still further. +% We also enable eliminate_local_vars only at this level, +% because that pass is implemented pretty inefficiently. + +opt_level(5, _, [ + optimize_repeat - int(5), + delay_construct - bool(yes), + inline_compound_threshold - int(100), + higher_order_size_limit - int(40), + eliminate_local_vars - bool(yes), + loop_invariants - bool(yes) +]). + +% Optimization level 6: apply optimizations which may have any payoff even if +% they increase compilation time to completely unreasonable levels. + +% Currently this sets `everything_in_one_c_function', which causes the compiler +% to put everything in the one C function and treat calls to predicates in the +% same module as local. We also enable inlining of GC_malloc(), redo(), and +% fail(). + +opt_level(6, _, [ + procs_per_c_function - int(0), % everything in one C function + inline_alloc - bool(yes), + use_macro_for_redo_fail - bool(yes) +]). + +% The following optimization options are not enabled at any level: +% +% checked_nondet_tailcalls: +% This is deliberate, because the transformation +% might make code run slower. +% +% constraint_propagation: +% I think this is deliberate, because the transformation +% might make code run slower? +% +% unneeded_code: +% Because it can cause slowdowns at high optimization levels; +% cause unknown +% type_specialization: +% XXX why not? +% +% introduce_accumulators: +% XXX Disabled until a bug in extras/trailed_update/var.m +% is resolved. +% +% optimize_constructor_last_call: +% Not a speedup in general. + +%-----------------------------------------------------------------------------% + +:- pred handle_quoted_flag(option::in, string::in, + option_table::in, option_table::out) is det. + +handle_quoted_flag(Option, Flag, Table, + append_to_accumulating_option(Option - quote_arg(Flag), Table)). + +quote_arg(Arg0) = Arg :- + % XXX Instead of using dir.use_windows_paths, this should really + % test whether we are using a Unix or Windows shell. + ( dir.use_windows_paths -> + ( ( string_contains_whitespace(Arg0) ; Arg0 = "" ) -> + Arg = """" ++ Arg0 ++ """" + ; + Arg = Arg0 + ) + ; + ArgList = quote_arg_unix(string.to_char_list(Arg0)), + ( + ArgList = [], + Arg = """""" + ; + ArgList = [_ | _], + ( + list.member(Char, ArgList), + \+ + ( char.is_alnum_or_underscore(Char) + ; Char = ('-') + ; Char = ('/') + ; Char = ('.') + ; Char = (',') + ; Char = (':') + ) + -> + Arg = """" ++ string.from_char_list(ArgList) ++ """" + ; + Arg = string.from_char_list(ArgList) + ) + ) + ). + +:- pred string_contains_whitespace(string::in) is semidet. + +string_contains_whitespace(Str) :- + Chars = string.to_char_list(Str), + some [Char] ( + list.member(Char, Chars), + char.is_whitespace(Char) + ). + +:- func quote_arg_unix(list(char)) = list(char). + +quote_arg_unix([]) = []. +quote_arg_unix([Char | Chars0]) = Chars :- + Chars1 = quote_arg_unix(Chars0), + ( quote_char_unix(Char) -> + Chars = [('\\'), Char | Chars1] + ; + Chars = [Char | Chars1] + ). + +:- pred quote_char_unix(char::in) is semidet. + +quote_char_unix('\\'). +quote_char_unix('"'). +quote_char_unix('`'). +quote_char_unix('$'). + +%-----------------------------------------------------------------------------% + +inconsequential_options(InconsequentialOptions) :- + option_defaults_2(warning_option, WarningOptions), + option_defaults_2(verbosity_option, VerbosityOptions), + option_defaults_2(internal_use_option, InternalUseOptions), + option_defaults_2(build_system_option, BuildSystemOptions), + assoc_list.keys(WarningOptions, WarningKeys), + assoc_list.keys(VerbosityOptions, VerbosityKeys), + assoc_list.keys(InternalUseOptions, InternalUseKeys), + assoc_list.keys(BuildSystemOptions, BuildSystemKeys), + Keys = WarningKeys ++ VerbosityKeys ++ InternalUseKeys ++ BuildSystemKeys, + InconsequentialOptions = set.from_list(Keys). + +%-----------------------------------------------------------------------------% + +options_help --> + io.write_string("\t-?, -h, --help\n"), + io.write_string("\t\tPrint this usage message.\n"), + options_help_warning, + options_help_verbosity, + options_help_output, + options_help_aux_output, + options_help_semantics, + options_help_termination, + options_help_ctgc, + options_help_compilation_model, + options_help_code_generation, + options_help_optimization, + options_help_hlds_hlds_optimization, + options_help_hlds_llds_optimization, + options_help_llds_llds_optimization, + options_help_mlds_mlds_optimization, + options_help_hlds_elds_optimization, + options_help_output_optimization, + options_help_target_code_compilation, + options_help_link, + options_help_build_system, + options_help_misc. + +:- pred options_help_warning(io::di, io::uo) is det. + +options_help_warning --> + io.write_string("\nWarning Options:\n"), + write_tabbed_lines([ + "-w, --inhibit-warnings", + "\tDisable all warning messages.", + "--halt-at-warn", + "\tThis option causes the compiler to treat all ", + "\twarnings as if they were errors. This means that", + "\tif any warning is issued, the compiler will not", + "\tgenerate code --- instead, it will return a", + "\tnon-zero exit status.", + "--halt-at-syntax-errors", + "\tThis option causes the compiler to halt immediately", + "\tafter syntax checking and not do any semantic checking", + "\tif it finds any syntax errors in the program.", +% "--halt-at-auto-parallel-failure", +% "\tThis option causes the compiler to halt if it cannot perform", +% "\tan auto-parallelization requested by a feedback file.", + "--inhibit-accumulator-warnings", + "\tDon't warn about argument order rearrangement caused", + "\tby --introduce-accumulators.", + "--no-warn-singleton-variables", + "\tDon't warn about variables which only occur once.", + "--no-warn-overlapping-scopes", + "\tDon't warn about variables which occur in overlapping scopes.", + "--no-warn-det-decls-too-lax", + "\tDon't warn about determinism declarations", + "\twhich could have been stricter.", + "--no-warn-inferred-erroneous", + "\tDon't warn about procedures whose determinism is inferred", + "\terroneous but whose determinism declarations are laxer.", + "--no-warn-insts-without-matching-type", + "\tDon't warn about insts that are not consistent with any", + "\tof the types in scope.", + % XXX disabled until compiler unused_imports, + % don't forget to update the user_guide.texi + % "--no-warn-unused-imports", + % "\tDon't warn about modules that are imported but not used.", + "--warn-unused-imports", + "\tWarn about modules that are imported but not used.", + "--no-warn-nothing-exported", + "\tDon't warn about modules which export nothing.", + "--warn-unused-args", + "\tWarn about predicate arguments which are not used.", + "--warn-interface-imports", + "\tWarn about modules imported in the interface, but", + "\twhich are not used in the interface.", + "--no-warn-missing-opt-files", + "\tDisable warnings about `.opt' files which cannot be opened.", + "--warn-missing-trans-opt-files", + "\tEnable warnings about `.trans_opt' files which cannot", + "\tbe opened.", + "--no-warn-missing-trans-opt-deps", + "\tDisable warnings produced when the information required", + "\tto allow `.trans_opt' files to be read when creating other", + "\t`.trans_opt' files has been lost. The information can be", + "\trecreated by running `mmake .depend'", + "--no-warn-non-contiguous-clauses", + "\tDo not generate a warning if the clauses of a predicate or function", + "\tare not contiguous.", + "--warn-non-contiguous-foreign-procs", + "\tGenerate a warning if the clauses and foreign_procs of a predicate", + "\tor function are not contiguous.", + "--warn-non-stratification", + "\tWarn about possible non-stratification of the predicates and/or", + "\tfunctions in the module.", + "\tNon-stratification occurs when a predicate or function can call", + "\titself negatively through some path along its call graph.", + "--no-warn-unification-cannot-succeed", + "\tDisable warnings about unifications which cannot succeed.", + "--no-warn-simple-code", + "\tDisable warnings about constructs which are so", + "\tsimple that they are likely to be programming errors.", + "--warn-duplicate-calls", + "\tWarn about multiple calls to a predicate with the", + "\tsame input arguments.", + "--no-warn-missing-module-name", + "\tDisable warnings for modules that do no start with", + "\ta `:- module' declaration.", + "--no-warn-wrong-module-name", + "\tDisable warnings for modules whose `:- module'", + "\tdeclaration does not match the module's file name.", + "--no-warn-smart-recompilation", + "\tDisable warnings from the smart recompilation system.", + "--no-warn-undefined-options-variables", + "\tDo not warn about references to undefined variables in", + "\toptions files with `--make'.", + "--warn-non-tail-recursion", + "\tWarn about any directly recursive calls that are not tail calls.", + "--no-warn-up-to-date", + "\tDon't warn if targets specified on the command line", + "\twith `--make' are already up to date.", + "--no-warn-stubs", + "\tDisable warnings about procedures for which there are no", + "\tclauses. Note that this option only has any effect if", + "\tthe `--allow-stubs' option (described in the ""Language", + "\tSemantics Options"" section below) is enabled.", + "--warn-dead-procs", + "\tWarn about procedures which are never called.", + "--no-warn-target-code", + "\tDisable warnings from the compiler used to process the", + "\ttarget code (e.g. gcc).", + "--no-warn-table-with-inline", + "\tDisable warnings about tabled procedures that also have", + "\ta `pragma inline' declaration.", + "--no-warn-non-term-special-preds", + "\tDo not warn about types that have user-defined equality or", + "\tcomparison predicates that cannot be proved to terminate.", + "\tThis option is only enabled when termination analysis is enabled.", + "\t(See the ""Termination Analysis Options"" section below).", + "--no-warn-known-bad-format-calls", + "\tDo not warn about calls to string.format or io.format that", + "\tthe compiler knows for sure contain mismatches between the", + "\tformat string and the supplied values.", + "--warn-unknown-format-calls", + "\tWarn about calls to string.format or io.format for which", + "\tthe compiler cannot tell whether there are any mismatches", + "\tbetween the format string and the supplied values.", + "--no-warn-obsolete", + "\tDo not warn about calls to predicates or functions that have", + "\tbeen marked as obsolete.", + "--inform-ite-instead-of-switch", + "\tGenerate informational messages for if-then-elses that could be", + "\treplaced by switches.", + "--no-warn-unresolved-polymorphism", + "\tDo not warn about unresolved polymorphism.", + "--warn-suspicious-foreign-procs", + "\tWarn about possible errors in the bodies of foreign", + "\tprocedures.", + "--no-warn-state-var-shadowing", + "\tDo not warn about one state variable shadowing another.", + "--no-inform-inferred", + "\tDo not generate messages about inferred types or modes.", + "--no-inform-inferred-types", + "\tDo not generate messages about inferred types.", + "--no-inform-inferred-modes", + "\tDo not generate messages about inferred modes." + ]). + +:- pred options_help_verbosity(io::di, io::uo) is det. + +options_help_verbosity --> + io.write_string("\nVerbosity Options:\n"), + write_tabbed_lines([ + "-v, --verbose", + "\tOutput progress messages at each stage in the compilation.", + "-V, --very-verbose", + "\tOutput very verbose progress messages.", + "-E, --verbose-error-messages", + "\tExplain error messages. Asks the compiler to give you a more", + "\tdetailed explanation of any errors it finds in your program.", + "--no-verbose-make", + "\tDisable messages about the progress of builds using", + "\tthe `--make' option.", + "--verbose-commands", + "\tOutput each external command before it is run.", + "\tNote that some commands will only be printed with `--verbose'.", + "--verbose-recompilation", + "\tWhen using `--smart-recompilation', output messages", + "\texplaining why a module needs to be recompiled.", + "--find-all-recompilation-reasons", + "\tFind all the reasons why a module needs to be recompiled,", + "\tnot just the first. Implies `--verbose-recompilation'.", + "--output-compile-error-lines ", + "\tWith `--make', output the first lines of the `.err'", + "\tfile after compiling a module (default: 15).", + "--report-cmd-line-args-doterr", + "\tReport the command line arguments.", + "--report-cmd-line-args-in-doterr", + "\tReport the command line arguments for compilations whose output", + "\tmmake normally redirects to a .err file.", + "-S, --statistics", + "\tOutput messages about the compiler's time/space usage.", + "\tAt the moment this option implies `--no-trad-passes', so you get", + "\tinformation at the boundaries between phases of the compiler.", +% The only sensible way to use --detailed-statistics, based on --very-verbose, +% is implemented automatically in handle_options, so users shouldn't need to be +% aware of it. +% "--detailed-statistics", +% "\tOutput more detailed messages about the compiler's", +% "\ttime/space usage.", + "--proc-size-statistics ", + "\tAppend information about the size of each procedure in the module", + "\tin terms of goals and variables to the end of the named file.", +% --debug-types works only if the compiler was compiled with +% "--trace-flag type_checkpoint". +% "-T, --debug-types", +% "\tOutput detailed debugging traces of the type checking.", + "-N, --debug-modes", + "\tOutput debugging traces of the mode checking.", + "--debug-modes-statistics", + "\tOutput statistics after each step of mode checking.", + "--debug-modes-minimal", + "\tOutput only minimal debugging traces of the mode checking.", + "--debug-modes-verbose", + "\tOutput detailed debugging traces of the mode checking.", + "--debug-modes-pred-id ", + "\tWith --debug-modes, restrict the debugging traces to the", + "\tmode checking of the predicate or function with the specified", + "\tpred id.", +% --debug-dep-par-conj is a developer only option, +% and it is effective only if the compiler was compiled with the right +% trace flags. +% "--debug-dep-par-conj ", +% "\tOutput detailed debugging traces during the dependent", +% "\tAND-parallelism transformation of the predicate with the", +% "\tpredicate id.", + "--debug-det, --debug-determinism", + "\tOutput detailed debugging traces of determinism analysis.", +% --debug-code-gen-pred-id is a developer only option, +% and it is effective only if the compiler was compiled with the right +% trace flags. +% "--debug-code-gen-pred-id ", +% "\tOutput detailed debugging traces of code generation for the", +% "\tpredicate or function with the given pred id.", +% The new termination analyser is currently a work-in-progress. +% + %"--debug-term, --debug-termination", + %"\tOutput detailed debugging traces of the termination2 analysis.", + "--debug-opt", + "\tOutput detailed debugging traces of the optimization process.", + "--debug-opt-pred-id ", + "\tOutput detailed debugging traces of the optimization process", + "\tonly for the predicate/function with the specified pred id.", + "--debug-opt-pred-name ", + "\tOutput detailed debugging traces of the optimization process", + "\tonly for the predicate/function with the specified name.", + "--debug-pd", + "\tOutput detailed debugging traces of the partial", + "\tdeduction and deforestation process.", + "--debug-liveness ", + "\tOutput detailed debugging traces of the liveness analysis", + "\tof the predicate with the given predicate id.", + "--debug-make", + "\tOutput detailed debugging traces of the `--make' option.", +% This can be uncommented when the '--analyse-closures' option is uncommented. +% (See below.) +% "--debug-closure", +% "\tOutput detailed debugging traces of the closure analysis." + "--debug-trail-usage", + "\tOutput detailed debugging traces of the `--analyse-trail-usage'", + "\toption.", + "--debug-intermodule-analysis", + "\tOutput detailed debugging traces of the `--intermodule-analysis'", + "\toption.", + "--debug-indirect-reuse", + "\tOutput detailed debugging traces of the indirect reuse pass of", + "\t`--structure-reuse' option.", + "--debug-type-rep", + "\tOutput debugging traces of type representation choices." +% The mode constraints code is still experimental so this option is +% currently commented out. +% "--debug-mode-constraints", +% "\tOutput detailed debugging traces of the `--prop-mode-constraints'", +% "\toption." + ]). + +:- pred options_help_output(io::di, io::uo) is det. + +options_help_output --> + io.write_string("\nOutput Options:\n"), + write_tabbed_lines([ + "These options are mutually exclusive.", + "Only the first one specified will apply.", + "If none of these options are specified, the default action", + "is to link the named modules to produce an executable.\n", + "-f, --generate-source-file-mapping", + "\tOutput the module name to file name mapping for the list", + "\tof source files given as non-option arguments to mmc", + "\tto `Mercury.modules'. This must be done before", + "\t`mmc --generate-dependencies' if there are any modules", + "\tfor which the file name does not match the module name.", + "\tIf there are no such modules the mapping need not be", + "\tgenerated.", + "-M, --generate-dependencies", + "\tOutput `Make'-style dependencies for the module", + "\tand all of its dependencies to `.dep'.", + "--generate-dependency-file", + "\tOutput `Make'-style dependencies for the module", + "\tto `.d'.", + "--generate-module-order", + "\tOutput the strongly connected components of the module", + "\tdependency graph in top-down order to `.order'.", + "\tImplies --generate-dependencies.", + "--generate-standalone-interface ", + "\tOutput a stand-alone interface.", + "\t is used as the basename of any files generated for", + "\tthe stand-alone interface. (See the Stand-alone Interface", + "\tchapter of the Mercury User's Guide for further details.)", + "-i, --make-int, --make-interface", + "\tWrite the module interface to `.int',", + "\tand write the short interface to `.int2'", + "\tThis option should only be used by mmake.", + "--make-priv-int, --make-private-interface", + "\tWrite the private interface to `.int0'.", + "\tThis option should only be used by mmake.", + "--make-short-int, --make-short-interface", + "\tWrite the unqualified short interface to `.int3'.", + "\tThis option should only be used by mmake.", + "--make-opt-int, --make-optimization-interface", + "\tWrite inter-module optimization information to", + "\t`.opt'.", + "\tThis option should only be used by mmake.", + "--make-trans-opt", + "--make-transitive-optimization-interface", + "\tOutput transitive optimization information", + "\tinto the `.trans_opt' file.", + "\tThis option should only be used by mmake.", + "-x,--make-xml-doc,--make-xml-documentation", + "\tOutput XML documentation of the module", + "\tinto the `.xml' file.", + "\tThis option should only be used by mmake.", + "-P, --convert-to-mercury", + "\tConvert to Mercury. Output to file `.ugly'", + "\tThis option acts as a Mercury ugly-printer.", + "-t, --typecheck-only", + "\tJust check that the code is syntactically correct and", + "\ttype-correct. Don't check modes or determinism,", + "\tand don't generate any code.", + "-e, --errorcheck-only", + "\tCheck the module for errors, but do not generate any code.", + "-C, --target-code-only", + "\tGenerate target code (i.e. C code in `.c',", + "\tIL code in `.il', or Java code in", + "\t`.java'), but not object code.", + "-c, --compile-only", + "\tGenerate C code in `.c' and object code in `.o'", + "\tbut do not attempt to link the named modules.", + % --compile-to-shared-lib is intended only for use + % by the debugger's interactive query facility, + % so it isn't documented. + "--output-grade-string", + "\tCompute the grade of the library to link with based on", + "\tthe command line options, and print it to the standard", + "\toutput.", + "--output-link-command", + "\tPrint the command used to link executables to the", + "\tstandard output.", + "--output-shared-lib-link-command", + "\tPrint the command used to link shared libraries to the", + "\tstandard output.", + "--output-libgrades", + "\tPrint the list of compilation grades in which a library", + "\tto be installed should be built to the standard output.", + "--output-cc", + "\tPrint the command used to invoke the C compiler to the", + "\tstandard output.", + "--output-cc-type, --output-c-compiler-type", + "\tPrint the C compiler type to the standard output.", + "--output-cflags", + "\tPrint the flags with which the C compiler will be invoked", + "\tto the standard output.", + "--output-csharp-compiler-type", + "\tPrint the C# compiler type to the standard output.", + "--output-library-link-flags", + "\tPrint the flags that are passed to linker in order to link", + "\tagainst the current set of libraries. This includes the", + "\tstandard library as well as any other libraries specified", + "\tvia the --ml option. The flags are printed to the standard", + "\toutput.", + "--output-grade-defines", + "\tPrint the flags that are passed to the C compiler to define the", + "\tmacros used to specify the compilation grade.", + "\tThe flags are printed to the standard output.", + "--output-c-include-dir-flags, --output-c-include-directory-flags", + "\tPrint the flags that are passed to the C compiler to specify", + "\twhich directories to search for C header files.", + "\tThis includes the C header files from the standard library.", + "\tThe flags are printed to the standard output." + ]). + +:- pred options_help_aux_output(io::di, io::uo) is det. + +options_help_aux_output --> + io.write_string("\nAuxiliary Output Options:\n"), + write_tabbed_lines([ + "--smart-recompilation", + "\tWhen compiling, write program dependency information", + "\tto be used to avoid unnecessary recompilations if an", + "\timported module's interface changes in a way which does", + "\tnot invalidate the compiled code. `--smart-recompilation'", + "\tdoes not yet work with `--intermodule-optimization'.", + "--no-assume-gmake", + "\tWhen generating `.dep' files, generate Makefile", + "\tfragments that use only the features of standard make;", + "\tdo not assume the availability of GNU Make extensions.", + "\tWhen generating `.dep' files, generate dependencies", + "\tfor use by `mmc --make' in addition to the dependencies", + "\tused by mmake.", + "--generate-mmc-deps", + "--generate-mmc-make-module-dependencies", + "\tGenerate dependencies for use by `mmc --make' even", + "\twhen using Mmake. This is recommended when building a", + "\tlibrary for installation.", + +% XXX The source-to-source debugging transform is not ready for public +% consumption. + %"--link-ssdebug-libs", + %"--link-ssdb-libs", + %"\tLink the source to source debugging libraries into the", + %"\tthe executable.", + %"--ss-trace {none, shallow, deep}", + %"\tThe trace level to use for source to source debugging of", + %"\tthe given module.", + +% "--trace decl" is not documented, because it is for backwards +% compatibility only. It is now equivalent to `--trace rep'. +% "--trace {minimum, shallow, deep, decl, rep, default}", + "--trace {minimum, shallow, deep, rep, default}", + "\tGenerate code that includes the specified level", + "\tof execution tracing.", + "\tSee the Debugging chapter of the Mercury User's Guide", + "\tfor details.", + "--exec-trace-tail-rec", + "\tGenerate TAIL events for self-tail-recursive calls instead of", + "\tEXIT events. This allows these recursive calls to reuse", + "\ttheir parent call's stack frame, but it also means that", + "\tthe debugger won't have access to the contents of the reused", + "\tstack frames", +% "--suppress-trace ,", +% "\tSuppress the named aspects of the execution tracing system.", +% This is a developer-only option: +% "--force-disable-trace", +% "\tForce tracing to be set to trace level none.", +% "\tThis overrides all other tracing/grade options.", +% "\tIts main use is to turn off tracing in the browser", +% "\tdirectory, even for .debug and .decldebug grades.", + "--trace-optimized", + "\tDo not disable optimizations that can change the trace.", +% "--trace-prof" is not documented because if is only intended for developers +% of the deep profiler. +% "--trace-prof"", +% "\tEnable tracing of deep profiling service predicates.", +% I/O tabling is deliberately not documented. It is mean to be switched on, +% with consistent parameters, in debugging grades, and to be consistently +% switched off in non-debugging grades. Inconsistent use of the options +% governing I/O tabling can yield core dumps from the debugger, so these +% options are for implementors only. +% "--trace-table-io", +% "\tEnable the tabling of I/O actions, to allow the debugger", +% "\tto execute retry commands across I/O actions.", +% "--trace-table-io-only-retry", +% "\tSet up I/O tabling to support only retries across I/O", +% "\tactions, not the printing of actions or declarative", +% "\tdebugging. This reduces the size of the I/O action table.", +% "--trace-table-io-states", +% "\tWhen tabling I/O actions, table the io.state arguments", +% "\ttogether with the others. This should be required iff", +% "\tvalues of type io.state actually contain information.", +% "--trace-table-io-require", +% "\tRequire the tabling of I/O actions, i.e. generate an error", +% "\tif an I/O primitive does not have the tabled_for_io", +% "\tannotation.", +% "--trace-table-io-all", +% "\tTable all I/O actions even in the absence of annotations.", +% "\tIf a primitive has no annotation specifying the type of", +% "\ttabling required, deduce it from the values of the other", +% "\tannotations.", + "--trace-flag ", + "\tEnable the trace goals that depend on the trace flag.", + "--profile-optimized", + "\tDo not disable optimizations that can distort deep profiles.", + "--no-delay-death", + "\tWhen the trace level is `deep', the compiler normally", + "\tpreserves the values of variables as long as possible, even", + "\tbeyond the point of their last use, in order to make them", + "\taccessible from as many debugger events as possible.", + "\tHowever, it will not do this if this option is given.", + "--delay-death-max-vars ", + "\tDelay the deaths of variables only when the number of variables", + "\tin the procedure is no more than N. The default value is 1000.", + "--stack-trace-higher-order", + "\tEnable stack traces through predicates and functions with", + "\thigher-order arguments, even if stack tracing is not", + "\tsupported in general.", +% This is a developer-only option: +% "--force-disable-ssdebug", +% "\tDisable ssdebug transformation even in ssdebug grades.", +% "--tabling-via-extra-args", +% "\tGenerate output via extra_args in foreign_procs.", +% "--allow-table-reset", +% "\tGenerate C code for resetting tabling data structures.", + "--generate-bytecode", + "\tOutput a bytecode form of the module for use", + "\tby an experimental debugger.", + "-n-, --no-line-numbers", + "\tDo not put source line numbers in the generated code.", + "\tThe generated code may be in C (the usual case),", + "\tor in Mercury (with the option --convert-to-mercury).", + "--auto-comments", + "\tOutput comments in the `.c' file.", +% This option is for developers only. Since it can include one C comment inside +% another, the resulting code is not guaranteed to be valid C. +% "--frameopt-comments", +% "\tGet frameopt.m to generate comments describing its operation.", + "\t(The code may be easier to understand if you also", + "\tuse the `--no-llds-optimize' option.)", + "--max-error-line-width ", + "\tSet the maximum width of an error message line to characters", + "\t(unless a long single word forces the line over this limit).", + "--show-dependency-graph", + "\tWrite out the dependency graph to `.dependency_graph'.", + "--imports-graph", + "\tWrite out the imports graph to `.imports_graph'.", + "\tThe imports graph contains the directed graph module A", + "\timports module B.", + "\tThe resulting file can be processed by the graphviz tools.", +% This option is for developers only. +% "--dump-trace-counts ", +% "\tIf the compiler was compiled with debugging enabled and is being", +% "\trun with trace counting enabled, write out the trace counts file", +% "\tafter the specified stage to `.trace_counts.-'.", +% "\tStage numbers range from 1-599.", +% "\tMultiple dump options accumulate.", + "-d , --dump-hlds ", + "\tDump the HLDS (high level intermediate representation) after", + "\tthe specified stage to `.hlds_dump.-'.", + "\tStage numbers range from 1-599.", + "\tMultiple dump options accumulate.", + "--dump-hlds-pred-id ", + "\tDump the HLDS only of the predicate/function with the given", + "\tpred id.", + "--dump-hlds-pred-name ", + "\tDump the HLDS only of the predicate/function with the given", + "\tname.", +% This option is for developers only. +% "-D, --dump-hlds-alias ", +% "\tWith `--dump-hlds', include extra detail in the dump.", +% "\tEach dump alias is shorthand for a set of option letters.", +% "\tThe list of aliases is in handle_options.m", + "--dump-hlds-options ", + "\tWith `--dump-hlds', include extra detail in the dump.", + "\tEach type of detail is included in the dump if its", + "\tcorresponding letter occurs in the option argument", + "\t(see the Mercury User's Guide for details).", + "--dump-hlds-inst-limit ", + "\tDump at most N insts in each inst table.", + "--dump-hlds-file-suffix ", + "\tAppend the given suffix to the names of the files created by", + "\tthe `--dump-hlds' option.", + "--dump-same-hlds", + "\tCreate a file for a HLDS stage even if the file notes only that", + "\tthis stage is identical to the previously dumped HLDS stage.", + "--dump-mlds ", + "\tDump the MLDS (medium level intermediate representation)", + "\tafter the specified stage, as C code,", + "\tto`.c_dump.-',", + "\tand `.h_dump.-'.", + "\tStage numbers range from 1-99.", + "\tMultiple dump options accumulate.", + "--verbose-dump-mlds ", + "\tDump the internal compiler representation of the MLDS, after", + "\tthe specified stage, to `.mlds_dump.-'." +% The mode constraints code is still experimental so these options are +% currently commented out. +% "--mode-constraints" +% "\tRun constraint based mode analysis. The default is to", +% "\tuse the robdd solution using the full (subtyping)", +% "\tconstraints and dump results.", +% "--simple-mode-constraints", +% "\tUse only the simplified constraint system when running", +% "\tthe robdd solver constraints based mode analysis.", +% "--prop-mode-constraints", +% "\tUse the new propagation solver for constraints based", +% "\tmode analysis.", +% IL options are commented out to reduce confusion. +% "--sign-assembly", +% "\tSign the current assembly with the Mercury strong name.", +% "\tTo use assemblies created with this command all the Mercury", +% "\tmodules must be compiled with this option enabled.", +% "\tThis option is specific to the IL backend, and is likely", +% "\tto be deprecated at a later date." + + /* XXX currently broken. + "--separate-assemblies", + "\tPlace sub-modules in separate assemblies.", + "\tThis option is specific to the IL backend." + */ + ]). + +:- pred options_help_semantics(io::di, io::uo) is det. + +options_help_semantics --> + io.write_string("\nLanguage semantics options:\n"), + io.write_string("(See the Mercury language reference manual for detailed explanations.)\n"), + write_tabbed_lines([ + "--no-reorder-conj", + "\tExecute conjunctions left-to-right except where the modes imply", + "\tthat reordering is unavoidable.", + "--no-reorder-disj", + "\tExecute disjunctions strictly left-to-right.", + "--no-fully-strict", + "\tAllow infinite loops or goals with determinism erroneous to be", + "\toptimised away.", + "--allow-stubs", + "\tAllow procedures to have no clauses. Any calls to", + "\tsuch procedures will raise an exception at run-time.", + "\tThis option is sometimes useful during program development.", + "\t(See also the documentation for the `--warn-stubs' option", + "\tin the ""Warning Options"" section.)", + "--infer-all", + "\tAbbreviation for `--infer-types --infer-modes --infer-det'.", + "--infer-types", + "\tIf there is no type declaration for a predicate or function,", + "\ttry to infer the type, rather than just reporting an error.", + "--infer-modes", + "\tIf there is no mode declaration for a predicate,", + "\ttry to infer the modes, rather than just reporting an error.", + + "--no-infer-det, --no-infer-determinism", + "\tIf there is no determinism declaration for a procedure,", + "\tdon't try to infer the determinism, just report an error.", + "--type-inference-iteration-limit ", + "\tPerform at most passes of type inference (default: 60).", + "--mode-inference-iteration-limit ", + "\tPerform at most passes of mode inference (default: 30).", + "--event-set-file-name ", + "\tGet the specification of user-defined events from ." + ]). + + +:- pred options_help_ctgc(io::di, io::uo) is det. + +options_help_ctgc --> + io.write_string("\nCompile Time Garbage Collection Options:\n"), + write_tabbed_lines([ + "--structure-sharing", + "\tPerform structure sharing analysis.", + "--structure-sharing-widening ", + "\tPerform widening when the set of structure sharing pairs becomes", + "\tlarger than . When n=0, widening is not enabled.", + "\t(default: 0).", + "--structure-reuse, --ctgc", + "\tPerform structure reuse analysis (Compile Time Garbage ", + "\tCollection).", + "--structure-reuse-constraint {same_cons_id, ", + "\twithin_n_cells_difference}, --ctgc-constraint {same_cons_id,", + "\twithin_n_cells_difference}", + "\tConstraint on the way we allow structure reuse. `same_cons_id'", + "\tspecifies that reuse is only allowed between terms of the same", + "\ttype and constructor. `within_n_cells_difference' states that", + "\treuse is allowed as long as the arities between the reused term", + "\tand new term does not exceed a certain threshold. The threshold ", + "\tneeds to be set using `--structure-reuse-constraint-arg'.", + "\t(default: within_n_cells_difference, with threshold 0)", + "--structure-reuse-constraint-arg, --ctgc-constraint-arg", + "\tSpecify the maximum difference in arities between the terms that", + "\tcan be reused, and the terms that reuse these terms.", + "\t(default: 0)" + +% This option is for developers only. +% "--structure-reuse-max-conditions", +% "\tSoft limit on the number of reuse conditions to accumulate", +% "\tfor a procedure. (default: 10)" + +% This option is likely to break many optimisations which haven't been updated. +% "--structure-reuse-free-cells", +% "\tImmediately free cells which are known to be dead but which", +% "\tcannot be reused." + ]). + +:- pred options_help_termination(io::di, io::uo) is det. + +options_help_termination --> + io.write_string("\nTermination Analysis Options:\n"), + write_tabbed_lines([ + "--enable-term, --enable-termination", + "\tAnalyse each predicate to discover if it terminates.", + "--chk-term, --check-term, --check-termination", + "\tEnable termination analysis, and emit warnings for some", + "\tpredicates or functions that cannot be proved to terminate.", + "\tIn many cases where the compiler is unable to prove termination", + "\tthe problem is either a lack of information about the", + "\ttermination properties of other predicates, or because language", + "\tconstructs (such as higher order calls) were used which could", + "\tnot be analysed. In these cases the compiler does not emit a", + "\twarning of non-termination, as it is likely to be spurious.", + "--verb-chk-term, --verb-check-term, --verbose-check-termination", + "\tEnable termination analysis, and emit warnings for all", + "\tpredicates or functions that cannot be proved to terminate.", + "--term-single-arg , --termination-single-argument-analysis ", + "\tWhen performing termination analysis, try analyzing", + "\trecursion on single arguments in strongly connected", + "\tcomponents of the call graph that have up to procedures.", + "\tSetting this limit to zero disables single argument analysis.", + "--termination-norm {simple, total, num-data-elems}", + "\tThe norm defines how termination analysis measures the size", + "\tof a memory cell. The `simple' norm says that size is always", + "\tone. The `total' norm says that it is the number of words", + "\tin the cell. The `num-data-elems' norm says that it is the", + "\tnumber of words in the cell that contain something other", + "\tthan pointers to cells of the same type.", + "--term-err-limit , --termination-error-limit ", + "\tPrint at most reasons for any single termination error", + "\t(default: 3).", + "--term-path-limit , --termination-path-limit ", + "\tPerform termination analysis only on predicates", + "\twith at most paths (default: 256)." + +% The following options are used to control the new termination analyser. +% They are currently disabled because that is still a work-in-progress. +% +% "--enable-term2, --enable-termination2", +% "\tAnalyse each predicate to discover if it terminates. ", +% "\tThis uses an alternative termination analysis based", +% "\ton convex constraints.", +% "--chk-term2, --check-termination2", +% "\tEnable the alternative termination analysis, and emit warnings for", +% "\tsome predicates or functions that cannot be proved to terminate. In", +% "\tmany cases where the compiler is unable to prove termination", +% "\tthe problem is either a lack of information about the", +% "\ttermination properties of other predicates, or because language", +% "\tconstructs (such as higher order calls) were used which could", +% "\tnot be analysed. In these cases the compiler does not emit a", +% "\twarning of non-termination, as it is likely to be spurious.", +% "--verb-chk-term2, --verb-check-term2, --verbose-check-termination2", +% "--termination2-norm {simple, total, num-data-elems}", +% "\tTell the alternative termination analyser which norm to use.", +% "\tSee the description of the `--termination-norm' option for a", +% "\tdescription of the different types of norm available." +% "--term2-widening-limit , --termination2-widening-limit ", +% "\tSet the threshold for the number of iterations after which the", +% "\targument size analyser invokes widening.", +% "--term2-propagate-failure-constrs, --termination2-propagate-failure-constraints", +% "\tMake the argument analyser infer information about the sizes of any" +% "\tinputs to a goal in contexts where that goal fails." +% "--term2-max-matrix-size , --termination2-maximum-matrix-size ", +% "\tLimit the sizes of constraints systems in the analyser to ", +% "\tconstraints. Use approximations of some constraint operations,", +% "\tsuch as projection, if this threshold is exceeded. This will", +% "\tspeed up the analysis at the cost of reduced precision.", + +% This option is for developers only. +% It is useful for benchmarking the argument size analysis. +% "--term2-argument-size-analysis-only, --term2-arg-size-analysis-only", +% "\tPerform argument size analysis on each SCC but do not", +% "\tattempt to infer termination," + ]). + +:- pred options_help_compilation_model(io::di, io::uo) is det. + +options_help_compilation_model --> + io.write_string("\nCompilation model options:\n"), + write_tabbed_lines([ + "The following compilation options affect the generated", + "code in such a way that the entire program must be", + "compiled with the same setting of these options,", + "and it must be linked to a version of the Mercury", + "library which has been compiled with the same setting.", + "", + "-s , --grade ", + "\tSelect the compilation model. The should be one of", + "\tthe base grades `none', `reg', `jump', `asm_jump', `fast', ", + "\t`asm_fast', `hl', `hlc', `il', or `java',", +% The hl, hl_nest, and hlc_nest are not yet documented, because +% the --high-level-data option is not yet supported for C, +% and the --gcc-nested-functions option is not yet documented. +% The ilc grade is not documented because it is not useful; +% it has been superceded by the il grade. + "\tor one of those with one or more of the grade modifiers", + "\t`.gc', `.mps', `.prof', `.memprof', `.profdeep', `.tr',", + "\t`.spf', `.stseg', `.debug', `.par' and/or `.pic_reg' appended.", + "\tDepending on your particular installation, only a subset", + "\tof these possible grades will have been installed.", + "\tAttempting to use a grade which has not been installed", + "\twill result in an error at link time." + ]), + + io.write_string("\n Target selection compilation model options:\n"), + write_tabbed_lines([ + "--target c\t\t\t(grades: none, reg, jump, fast,", + "\t\t\t\t\tasm_jump, asm_fast, hl, hlc)", + "--target il\t\t\t(grades: il)", + "--target csharp\t\t\t(grades: csharp)", + "--target java\t\t\t(grades: java)", + "--target erlang\t\t\t(grades: erlang)", + "\tSpecify the target language: C, IL, C#, Java or Erlang.", + "\tThe default is C. ""IL"" (also known as ""CIL"" or ""MSIL"")", + "\tis the Intermediate Language for the .NET Common Language", + "\tRuntime.", + "\tTargets other than C imply `--high-level-code' (see below).", + +% IL options are commented out to reduce confusion. +% "--il", +% "\tAn abbreviation for `--target il'.", +% "--il-only", +% "\tAn abbreviation for `--target il --target-code-only'.", +% "\tGenerate IL code in `.il', but do not generate", +% "\tobject code.", +% +% "--dotnet-library-version ", +% "\tThe version number for the mscorlib assembly distributed", +% "\twith the Microsoft .NET SDK.", +% +% "--no-support-ms-clr", +% "\tDon't use MS CLR specific workarounds in the generated code.", +% +% "--support-rotor-clr", +% "\tUse specific workarounds for the ROTOR CLR in the generated", +% "\tcode.", + + "--csharp", + "\tAn abbreviation for `--target csharp'.", + "--csharp-only", + "\tAn abbreviation for `--target csharp --target-code-only'.", + "\tGenerate C# code in `.cs', but do not generate", + "\tobject code.", + + "--java", + "\tAn abbreviation for `--target java'.", + "--java-only", + "\tAn abbreviation for `--target java --target-code-only'.", + "\tGenerate Java code in `.java', but do not generate", + "\tobject code.", + + "--erlang", + "\tAn abbreviation for `--target erlang'.", + "--erlang-only", + "\tAn abbreviation for `--target erlang --target-code-only'.", + "\tGenerate Erlang code in `.erl', but do not generate", + "\tobject code.", + + "--compile-to-c", + "\tAn abbreviation for `--target c --target-code-only'.", + "\tGenerate C code in `.c', but do not generate object", + "\tcode." + ]), + + io.write_string("\n Optional feature compilation model options:\n"), + io.write_string(" Debugging\n"), + write_tabbed_lines([ + "--debug\t\t\t\t(grade modifier: `.debug')", + "\tEnable Mercury-level debugging.", + "\tSee the Debugging chapter of the Mercury User's Guide", + "\tfor details.", + "\tThis option is not yet supported for the `--high-level-code'", + "\tback-ends.", + "--decl-debug\t\t\t\t(grade modifier: `.decldebug')", + "\tEnable full support for declarative debugging.", + "\tThis allows subterm dependency tracking in the declarative", + "\tdebugger.", + "\tSee the Debugging chapter of the Mercury User's Guide", + "\tfor details.", + "\tThis option is not yet supported for the `--high-level-code'", + "\tback-ends." +% XXX The source-to-source debugging transform is not ready for public +% consumption. +% "--ss-debug\t\t\t\t(grade modifier: `.ssdebug')", +% "\tEnable the source-to-source debugging transform." + ]), + io.write_string(" Profiling\n"), + write_tabbed_lines([ + "-p, --profiling, --time-profiling", + "\t\t\t\t(grade modifier: `.prof')", + "\tEnable time and call profiling. Insert profiling hooks in the", + "\tgenerated code, and also output some profiling", + "\tinformation (the static call graph) to the file", + "\t`.prof'.", + "\tThis option is not supported for the IL, C# or Java back-ends.", + "--memory-profiling\t\t(grade modifier: `.memprof')", + "\tEnable memory and call profiling.", + "\tThis option is not supported for the IL, C# or Java back-ends.", + "--deep-profiling\t\t(grade modifier: `.profdeep')", + "\tEnable deep profiling.", + "\tThis option is not supported for the high-level C, IL, C#", + "\tor Java back-ends.", + +% This option is not documented, it is intended for use by developers only. +% +% "--pre-prof-transforms-simplify", +% "\tForce the pre-profiling simplification pass that is usually", +% "\tenabled when building a profiling version of a program. This", +% "\tallows a developer to enable this pass when using a", +% "\tnon-profiling build. It can be used to test that generated code", +% "\tintroduced in earlier passes is well-formed before it is", +% "\tpotentially removed by the dead procedure elimination pass later", +% "\ton.", +% + +% XXX The following options are not documented, +% because they are currently not useful. +% The idea was for you to be able to use --profile-calls +% and --profile-time separately, but that doesn't work +% because compiling with --profile-time instead of +% --profile-calls results in different code addresses, +% so you can't combine the data from versions of +% your program compiled with different options. +% +% "--profile-calls\t\t(grade modifier: `.profcalls')", +% "\tSimilar to `--profiling', except that only gathers", +% "\tcall counts, not timing information.", +% "\tUseful on systems where time profiling is not supported,", +% "\tbut not as useful as `--memory-profiling'.", +% "--profile-time\t\t(grade modifier: `.proftime')", +% "\tSimilar to `--profiling', except that it only gathers", +% "\ttiming information, not call counts.", +% "--profile-memory\t\t(grade modifier: `.profmem')", +% "\tSimilar to `--memory-profiling', except that it only", +% "\tgathers memory usage information, not call counts.", + + "--no-coverage-profiling", + "\tDisable coverage profiling.", +% The following options are for implementors only (intended for experiments). +% "--coverage-profiling-via-calls", +% "\tUse calls to implement coverage points, not inline foreign code.", + +% "--coverage-profiling-static", +% "\tDisable dynamic coverage profiling, this uses less memory and may ", +% "\tbe faster.", + +% "Switches to effect coverage profiling (part of deep profiling). ", +% "they enable different types of coverage points.", + +% "--no-profile-deep-coverage-after-goal", +% "\tDisable coverage points after goals.", +% "--no-profile-deep-coverage-branch-ite", +% "\tDisable coverage points at the beginning of then and else", +% "\tbranches.", +% "--no-profile-deep-coverage-branch-switch", +% "\tDisable coverage points at the beginning of switch branches.", +% "--no-profile-deep-coverage-branch-disj", +% "\tDisable coverage points at the beginning of disjunction branches.", + +% I beleive these options are broken - pbone. +% "Switches to tune the coverage profiling pass, useful for ", +% "debugging.", +% +% "--no-profile-deep-coverage-use-portcounts", +% "\tTurn off usage of port counts in the deep profiler to provide", +% "\tsome coverage information.", +% "--no-profile-deep-coverage-use-trivial", +% "\tTurn off usage of trivial goal information", + + "--profile-for-feedback", + "\tSelect deep profiling options suitable for profiler directed", + "\timplicit parallelism.", + "\t--profile-for-implicit-parallelism is a deprecated synonym for", + "\tthis option", + + "--record-term-sizes-as-words\t\t(grade modifier: `.tsw')", + "\tAugment each heap cells with its size in words.", + "--record-term-sizes-as-cells\t\t(grade modifier: `.tsc')", + "\tAugment each heap cells with its size in cells.", + + "--experimental-complexity=\t\t", + "\tEnable experimental complexity analysis for the predicates", + "\tlisted in the given file.", + "\tThis option is supported for the C back-end, with", + "\t--no-highlevel-code.", + + "--threadscope\t\t(grade modifier: `.threadscope')", + "\tEnable support for profiling parallel execution.", + "\tThis option is supported by the low-level C back-end parallel", + "\tgrades on some processors, See README.ThreadScope for details." + ]), + + io.write_string(" Miscellaneous optional features\n"), + write_tabbed_lines([ + "--gc {none, boehm, hgc, mps, accurate, automatic}", + "--garbage-collection {none, boehm, hgc, mps, accurate, automatic}", + "\t\t\t\t(`java', `csharp', `il' and `erlang'", + "\t\t\t\t\tgrades use `--gc automatic',", + "\t\t\t\t`.gc' grades use `--gc boehm',", + "\t\t\t\t`.hgc' grades use `--gc hgc',", + "\t\t\t\t`.mps' grades use `--gc mps',", + "\t\t\t\tother grades use `--gc none'.)", + "\tSpecify which method of garbage collection to use", + "\t(default: boehm).", + "\t`boehm' is Hans Boehm et al's conservative collector.", + "\t`hgc' is our own conservative collector;", + "\t`accurate' is our own type-accurate copying GC;", + "\tit requires `--high-level-code'.", + "\t`mps' is a different conservative collector, based on", + "\tRavenbrook Limited's MPS (Memory Pool System) kit.", + "\t`automatic' means the target language provides it.", + "\tThis is the case for the IL, C#, Java and Erlang back-ends,", + "\twhich always use the garbage collector of the underlying", + "\timplementation.", + "--use-trail\t\t\t(grade modifier: `.tr')", + "\tEnable use of a trail.", + "\tThis is necessary for interfacing with constraint solvers,", + "\tor for backtrackable destructive update.", + "\tThis option is not yet supported for the IL, C# or Java back-ends.", + "--trail-segments\t\t\t(grade modifier: `.trseg')", + "\tAs above, but use a dynamically sized trail that is composed", + "\tof small segments. This can help to avoid trail exhaustion", + "\tat the cost of increased execution time.", + "--parallel\t\t(grade modifier: `.par')", + "\tEnable parallel execution support for the low-level C grades.", + "\tEnable concurrency (via pthreads) for the high-level C grades.", + "--maybe-thread-safe {yes, no}", + "\tSpecify how to treat the `maybe_thread_safe' foreign code", + "\tattribute. `yes' means that a foreign procedure with the", + "\t`maybe_thread_safe' option is treated as though it has a", + "\t`thread_safe' attribute. `no' means that the foreign", + "\tprocedure is treated as though it has a `not_thread_safe'", + "\tattribute. The default is no.", + "--single-prec-float\t\t(grade modifier: `.spf')", + "\tUse single precision floats so that, on 32-bit machines,", + "\tfloating point values don't need to be boxed. Double", + "\tprecision floats are used by default." + % This is commented out as this feature is still experimental. + %"--extend-stacks-when-needed", + %"\tSpecify that code that increments a stack pointer must", + %"\textend the stack when this is needed.", + % RBMM is undocumented since it is still experimental. + % should also document rbmmd rbmmp rbmmdp + %"--use-regions\t\t(grade modifier: `.rbmm')", + %"\tEnable support for region-based memory managment." + %"--use-alloc-regions", + %"\tCompute and use the exact set of regions", + %"\t that may be allocated into by a call." + ]), + + io.write_string("\n LLDS back-end compilation model options:\n"), + write_tabbed_lines([ + + "--gcc-global-registers\t\t(grades: reg, fast, asm_fast)", + "--no-gcc-global-registers\t(grades: none, jump, asm_jump)", + "\tSpecify whether or not to use GNU C's", + "\tglobal register variables extension.", + "\tThis option is ignored if the `--high-level-code' option is", + "\tenabled.", + "--gcc-non-local-gotos\t\t(grades: jump, fast, asm_jump, asm_fast)", + "--no-gcc-non-local-gotos\t(grades: none, reg)", + "\tSpecify whether or not to use GNU C's", + "\t""labels as values"" extension.", + "\tThis option is ignored if the `--high-level-code' option is", + "\tenabled.", + "--asm-labels\t\t\t(grades: asm_jump, asm_fast)", + "--no-asm-labels\t\t\t(grades: none, reg, jump, fast)", + "\tSpecify whether or not to use GNU C's", + "\tasm extensions for inline assembler labels.", + "\tThis option is ignored if the `--high-level-code' option is", + "\tenabled.", + "--pic-reg\t\t\t(grade modifier: `.pic_reg')", + "[For Unix with intel x86 architecture only]", + "\tSelect a register usage convention that is compatible,", + "\twith position-independent code (gcc's `-fpic' option).", + "\tThis is necessary when using shared libraries on Intel x86", + "\tsystems running Unix. On other systems it has no effect.", + "--stack-segments\t\t(grade modifier: `.stseg')", + "\tSpecify whether to use dynamically sized stacks that are", + "\tcomposed of small segments. This can help to avoid stack", + "\texhaustion at the cost of increased execution time.", + "\tThis option is ignored if the `--high-level-code' option is", + "\tenabled." + % This is a developer only option. +% "--use-float-registers", +% "(This option is not for general use.)", +% "\tUse float registers for argument passing." + ]), + + io.write_string("\n MLDS back-end compilation model options:\n"), + write_tabbed_lines([ +% These grades (hl_nest, and hlc_nest) are not yet documented, +% because the --gcc-nested-functions option is not yet documented. +% "-H, --high-level-code\t\t\t(grades: hl_nest, hlc_nest)", +% The ilc grade is not documented because it is not useful; +% it has been superceded by the il grade. + "-H, --high-level-code\t\t\t(grades: hl, hlc, il, csharp, java)", + "\tUse an alternative back-end that generates high-level code", + "\trather than the very low-level code that is generated by our", + "\toriginal back-end.", +% The hl_nest grade is not yet documented, +% because the --gcc-nested-functions option is not yet documented. +% because it is not yet supported +% "--high-level-data\t\t\t(grades: hl, hl_nest, il, csharp, java)", + "--high-level-data\t\t\t(grades: hl, il, csharp, java)", + "\tUse an alternative higher-level data representation.", +% "--high-level\t\t\t(grades: hl, hl_nest, il, csharp, java)", + "--high-level\t\t\t(grades: hl, il, csharp, java)", + "\tAn abbreviation for `--high-level-code --high-level-data'." +% The --gcc-nested-functions option is not yet documented, +% because it doesn't pass our test suite, and it is +% probably not very useful. +% "--gcc-nested-functions\t\t(grades: hl_nest, hlc_nest)", +% "\tSpecify whether or not to use GNU C's nested functions extension.", +% "\tThis option is ignored if the `--high-level-code' option is not enabled.", +% The --det-copy-out option is not yet documented, +% because it is not yet tested much and probably not very useful, +% except for Java, where it is the default. +% "--det-copy-out", +% "\tSpecify whether to handle output arguments for det/semidet", +% "\tprocedures using return-by-value rather than pass-by-reference.", +% "\tThis option is ignored if the `--high-level-code' option is not enabled.", +% The --nondet-copy-out option is not yet documented, +% because it is probably not very useful except for IL and Java, +% where it is the default. +% "--nondet-copy-out\t\t(grades: il, ilc)", +% "\tSpecify whether to handle output arguments for nondet", +% "\tprocedures using pass-by-value rather than pass-by-reference.", +% "\tThis option is ignored if the `--high-level-code' option is not enabled.", +% The --put-commit-in-own-func option is not documented because +% it is enabled automatically (by handle_options) in the situations +% where it is needed; the user should never need to set it. +% "--put-commit-in-own-func", +% "\tPut each commit in its own C function.", +% "\tThis option only affects the MLDS back-ends.", +% "\tIt is needed for the high-level C back-end,", +% "\twhere commits are implemented via setjmp()/longjmp(),", +% "\tsince longjmp() may clobber any non-volatile local vars", +% "\tin the function that called setjmp().", +% The --put-nondet-env-on-heap option is not documented because +% it is enabled automatically (by handle_options) in the situations +% where it is needed; the user should never need to set it. +% "--put-nondet-env-on-heap", +% "\tAllocate the environment structures used for", +% "\tnondeterministic Mercury procedures on the heap,", +% "\trather than on the stack." +% ]), +% io.write_string("\n IL back-end compilation model options:\n"), +% write_tabbed_lines([ +% +% The --verifiable-code option is not yet documented because it is not yet fully +% implemented. +% "--verifiable, --verifiable-code\t\t\t", +% "\tEnsure that the generated IL code is verifiable.", +% +% The --il-refany-fields option is not documented because currently there +% are no IL implementations for which it is useful. +% "--il-refany-fields", +% "\tGenerate IL code that assumes that the CLI implementation", +% "\tsupports value types with fields of type `refany'.", +% "\tUsing this option could in theory allow more efficient", +% "\tverifiable IL code for nondeterministic Mercury procedures,", +% "\tif the CLI implementation supported it." +% "\tHowever, the current Microsoft CLR does not support it." +% +% The --il-byref-tailcalls option is not documented because currently there +% are no IL implementations for which it is useful. +% "--il-byref-tailcalls", +% "\tGenerate IL code that assumes that the CLI verifier", +% "\tsupports tail calls with byref arguments." +% +% The --il-funcptr-types option is not documented because it is not yet +% implemented. +% "--il-funcptr-types", +% "\tGenerate IL code that assumes that the IL assembler", +% "\tsupports function pointer types." +% "\tThe ECMA CLI specification allows function pointer types," +% "\tbut some CLR implementations, e.g. the old Beta 2 version of" +% "\tthe Microsoft CLR implementation, do not support them." + ]), + + io.write_string("\n Developer compilation model options:\n"), + io.write_string("\n Data representation\n"), + write_tabbed_lines([ + "--tags {none, low, high} (This option is not for general use.)", + "\tSpecify whether to use the low bits or the high bits of ", + "\teach word as tag bits (default: low).", + % "\t\t`--tags none' implies `--num-tag-bits 0'.", + "--num-tag-bits (This option is not for general use.)", + "\tUse tag bits.", + "--num-reserved-addresses (This option is not for general use.)", + "\tTreat the integer values from 0 up to - 1 as reserved", + "\taddresses that can be used to represent nullary constructors", + "\t(constants) of discriminated union types.", + "--num-reserved-objects (This option is not for general use.)", + "\tAllocate up to global objects per type,", + "\tfor representing nullary constructors", + "\t(constants) of discriminated union types." + + % The --conf-low-tag-bits option is reserved for use + % by the `mmc' script; it is deliberately not documented. + + % The --bits-per-word option is intended for use + % by the `mmc' script; it is deliberately not documented. + + % The --bytes-per-word option is intended for use + % by the `mmc' script; it is deliberately not documented. + + % This is a developer only option. +% "--unboxed-float", +% "(This option is not for general use.)", +% "\tDon't box floating point numbers.", +% "\tThis assumes that a Mercury float will fit in a word.", +% "\tThe C code needs to be compiled with `-UBOXED_FLOAT'.", +% "\tIt may also need to be compiled with", +% "\t`-DUSE_SINGLE_PREC_FLOAT', if double precision", +% "\tfloats don't fit into a word." + + % This is a developer only option. +% "--no-unboxed-enums", +% "(This option is not for general use.)", +% "\tBox enumerations. This option is disabled by default.", + + % This is a developer only option. +% "--no-unboxed-no-tag-types", +% "(This option is not for general use.)", +% "\tBox no-tag types. This option is disabled by default." + + ]), + io.write_string("\n Developer optional features\n"), + write_tabbed_lines([ + "--use-minimal-model-stack-copy", + "(This option is not for general use.)", + "\tEnable the use of the standard form of minimal model tabling.", + + "--use-minimal-model-own-stacks", + "(This option is not for general use.)", + "\tEnable the use of an experimental form of minimal model tabling.", + + "--minimal-model-debug", + "(This option is not for general use.)", + "\tEnables extra data structures that assist in debugging", + "\tminimal model tabling.", + + "--no-type-layout", + "(This option is not for general use.)", + "\tDon't output type_ctor_layout structures or references", + "\tto them. (The C code also needs to be compiled with", + "\t`-DNO_TYPE_LAYOUT')." + + % This is a developer only option. +% "--basic-stack-layout", +% "(This option is not for general use.)", +% "\tGenerate the simple stack_layout structures required", +% "\tfor stack traces.", + + % This is a developer only option. +% "--agc-stack-layout", +% "(This option is not for general use.)", +% "\tGenerate the stack_layout structures required for", +% "\taccurate garbage collection.", + + % This is a developer only option. +% "--procid-stack-layout", +% "(This option is not for general use.)", +% "\tGenerate the stack_layout structures required for", +% "\tlooking up procedure identification information.", + + % This is a developer only option. +% "--trace-stack-layout", +% "(This option is not for general use.)", +% "\tGenerate the stack_layout structures required for", +% "\texecution tracing.", + + % This is a developer only option. +% "--body-typeinfo-liveness", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--can-compare-constants-as-ints", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--pretest-equality-cast-pointers", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--can-compare-compound-values" +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--lexically-order-constructors" +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--mutable-always-boxed", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--delay-partial-instantiations", +% "(This option is not for general use.)", +% For documentation, see delay_partial_inst.m + + % This is a developer only option. +% "--allow-defn-of-builtins", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % This is a developer only option. +% "--special-preds", +% "(This option is not for general use.)", +% For documentation, see the comment in the type declaration. + + % All these are developer only options. +% "(These options are not for general use.)", +% For documentation, see runtime/mercury_region.h. +% "--size-region-ite-fixed" +% "--size-region-disj-fixed" +% "--size-region-commit-fixed" +% "--size-region-ite-protect" +% "--size-region-ite-snapshot" +% "--size-region-disj-protect" +% "--size-region-disj-snapshot" +% "--size-region-commit-entry" + + % This is a developer only option. +% "--solver-type-auto-init", +% "(This option is not for general use.)", +% Allow automatic initialisation of solver types. + + % This is a developer only option. +% "--allow-multi-arm-switches", +% "(This option is not for general use.)", +% Allow the compiler to generate switches in which one arm handles +% more than one cons_id. + + % This is a developer only option. +% "--type-check-constraints", +% "(This option is not for general use.)", +% Use the constraint based type checker instead of the old one. + + % This is a developer only option. +% "--allow-argument-packing", +% "(This option is not for general use.)", +% Allow the compiler to pack multiple constructor arguments into +% a single field. + ]). + +:- pred options_help_code_generation(io::di, io::uo) is det. + +options_help_code_generation --> + io.write_string("\nCode generation options:\n"), + write_tabbed_lines([ +% "--low-level-debug", +% "\tEnables various low-level debugging stuff, that was in", +% "\tthe distant past used to debug the low-level code generation.", +% "\tYou don't want to use this option unless you are hacking", +% "\tthe Mercury compiler itself (and probably not even then).", +% "\tCauses the generated code to become VERY big and VERY", +% "\tinefficient. Slows down compilation a LOT.", + +% "--table-debug", +% "\tEnables the generation of code that helps to debug tabling", +% "\tprimitives.", + + "--no-trad-passes", + "\tThe default `--trad-passes' completely processes each predicate", + "\tbefore going on to the next predicate.", + "\tThis option tells the compiler", + "\tto complete each phase of code generation on all predicates", + "\tbefore going on the next phase on all predicates.", + % "--parallel-liveness", + % "Use multiple threads when computing liveness.", + % "At the moment this option implies `--no-trad-passes',", + % "and requires the compiler to be built in a", + % "low-level parallel grade and running with multiple engines.", + % "--parallel-code-gen", + % "Use multiple threads when generating code.", + % "At the moment this option implies `--no-trad-passes',", + % "and requires the compiler to be built in a", + % "low-level parallel grade and running with multiple engines.", + % "\t--no-polymorphism", + % "\t\tDon't handle polymorphic types.", + % "\t\t(Generates slightly more efficient code, but stops", + % "\t\tpolymorphism from working except in special cases.)", + "--no-reclaim-heap-on-nondet-failure", + "\tDon't reclaim heap on backtracking in nondet code.", + "--no-reclaim-heap-on-semidet-failure", + "\tDon't reclaim heap on backtracking in semidet code.", + "--no-reclaim-heap-on-failure", + "\tCombines the effect of the two options above.", + + "--max-jump-table-size=", + "\tThe maximum number of entries a jump table can have.", + "\tThe special value 0 indicates the table size is unlimited.", + "\tThis option can be useful to avoid exceeding fixed limits", + "\timposed by some C compilers.", + + % This is a developer only option. +% "--compare-specialization=", +% "\tGenerate quadratic instead of linear compare predicates for", +% "\ttypes with up to n function symbols. Higher values of n lead to", +% "\tfaster but also bigger compare predicates.", + + % This is a developer only option. +% "--no-should-pretest-equality", +% "\tIf specified, do not add a test for the two values being equal", +% "\tas words to the starts of potentially expensive unify and compare", +% "\tpredicates." + + "--fact-table-max-array-size ", + "\tSpecify the maximum number of elements in a single", + "\t`:- pragma fact_table' data array (default: 1024).", + "--fact-table-hash-percent-full ", + "\tSpecify how full the `:- pragma fact_table' hash tables", + "\tshould be allowed to get. Given as an integer percentage", + "\t(valid range: 1 to 100, default: 90)." + +% This option is not yet documented because the `--gcc-nested-functions' option +% is not documented. +% "--gcc-local-labels", +% "\tThis option has no effect unless both the `--high-level-code' option", +% "\tand the `--gcc-nested-functions' options are enabled.", +% "\tIf this option is enabled, the Mercury compiler will generate", +% "\tC code that uses GNU C's local labels extension to allow", +% "\tGNU C nested functions to exit into their containing function", +% "\tvia a `goto'.", +% "\tIf this option is not enabled, the default behaviour is to", +% "\tuse the standard ANSI/ISO C setjmp() and longjmp() functions." + +% This option is not yet documented because it is not yet useful -- currently +% we don't take advantage of GNU C's computed gotos extension. +% "--no-prefer-switch", +% "\tGenerate code using computed gotos rather than switches.", +% "\tThis makes the generated code less readable, but potentially", +% "\tslightly more efficient.", +% "\tThis option has no effect unless the `--high-level-code' option", +% "\tis enabled. It also has no effect if the `--target' option is", +% "\tset to `il'.", +% This optimization is for implementors only. Turning this option on provides +% the fairest possible test of --optimize-saved-vars-cell. +% "--no-opt-no-return-calls", +% "\tDo not optimize the stack usage of calls that cannot return.", + + ]), + + io.write_string("\n Code generation target options:\n"), + write_tabbed_lines([ + "--branch-delay-slot \t(This option is not for general use.)", + "\tAssume that branch instructions have a delay slot.", + "--num-real-r-regs \t(This option is not for general use.)", + "\tAssume registers r1 up to r are real general purpose", + "\tregisters.", + "--num-real-f-regs \t(This option is not for general use.)", + "\tAssume registers f1 up to f are real floating point", + "\tregisters.", + "--num-real-r-temps \t(This option is not for general use.)", + "\tAssume that non-float temporaries will fit into", + "\treal machine registers.", + "--num-real-f-temps \t(This option is not for general use.)", + "\tAssume that float temporaries will fit into", + "\treal machine registers." + ]). + +:- pred options_help_optimization(io::di, io::uo) is det. + +options_help_optimization --> + io.write_string("\nOptimization Options:\n"), + write_tabbed_lines([ + "-O , --opt-level , --optimization-level ", + "\tSet optimization level to .", + "\tOptimization level -1 means no optimization", + "\twhile optimization level 6 means full optimization.", + % "\t\tFor a full description of each optimization level,", + % "\t\tsee the Mercury User's Guide.", + "--opt-space, --optimize-space", + "\tTurn on optimizations that reduce code size", + "\tand turn off optimizations that significantly", + "\tincrease code size.", + "--intermod-opt", + "--intermodule-optimization", + "\tPerform inlining and higher-order specialization of", + "\tthe code for predicates imported from other modules.", + "\tThis option must be set throughout the compilation process.", + "--trans-intermod-opt", + "--transitive-intermodule-optimization", + "\tImport the transitive intermodule optimization data.", + "\tThis data is imported from `.trans_opt' files.", + "\tNote that `--transitive-intermodule-optimization' does not", + "\twork with `mmc --make'.", + "--no-read-opt-files-transitively", + "\tOnly read the inter-module optimization information", + "\tfor directly imported modules, not the transitive", + "\tclosure of the imports.", + "--use-opt-files", + "\tPerform inter-module optimization using any", + "\t`.opt' files which are already built,", + "\te.g. those for the standard library, but do", + "\tnot build any others.", + "--use-trans-opt-files", + "\tPerform inter-module optimization using any", + "\t`.trans_opt' files which are already built,", + "\te.g. those for the standard library, but do", + "\tnot build any others.", + "--intermodule-analysis", + "\tPerform analyses such as termination analysis and", + "\tunused argument elimination across module boundaries.", + "\tThis option is not yet fully implemented.", + "--analysis-repeat ", + "\tThe maximum number of times to repeat analyses of", + "\tsuboptimal modules with `--intermodule-analysis'", + "\t(default: 0)." + % This is commented out as this feature is still experimental. +% "--analysis-file-cache", +% "\tEnable caching of parsed analysis files. This may", +% "\timprove compile times with `--intermodule-analysis'." + ]). + +:- pred options_help_hlds_hlds_optimization(io::di, io::uo) is det. + +options_help_hlds_hlds_optimization --> + io.write_string("\n High-level (HLDS -> HLDS) optimizations:\n"), + write_tabbed_lines([ + "--no-inlining", + "\tDisable all forms of inlining.", + "--no-inline-simple", + "\tDisable the inlining of simple procedures.", + "--no-inline-builtins", + "\tGenerate builtins (e.g. arithmetic operators) as calls to", + "\tout of line procedures. This is done by default when,", + "\tdebugging, as without this option the execution of", + "\tbuiltins is not traced.", + "--no-inline-single-use", + "\tDisable the inlining of procedures called only once.", + "--inline-call-cost ", + "\tAssume that the cost of a call is the given parameter.", + "\tUsed only in conjunction with --inline-compound-threshold.", + "\tmultiplied by the number of times it is called,", + "--inline-compound-threshold ", + "\tInline a procedure if its size (measured roughly", + "\tin terms of the number of connectives in its internal form)", + "\tless the assumed call cost, multiplied by the number of times", + "\tit is called is below the given threshold.", + "--inline-simple-threshold ", + "\tInline a procedure if its size is less than the", + "\tgiven threshold.", + "--intermod-inline-simple-threshold", + "\tSimilar to `--inline-simple-threshold', except used to", + "\tdetermine which predicates should be included in", + "\t`.opt' files. Note that changing this between writing", + "\tthe `.opt' file and compiling to C may cause link errors,", + "\tand too high a value may result in reduced performance.", + "--inline-vars-threshold ", + "\tDon't inline a call if it would result in a procedure", + "\tcontaining more than variables. Procedures", + "\tcontaining large numbers of variables can cause", + "\tslow compilation.", +% "--from-ground-term-threshold ", +% "\tWrap a from_ground_term scope around the expanded,", +% "\tsuperhomogeneous form of a ground term that involves at least.", +% "\tthe given number of function symbols.", + "--no-const-struct", + "\tDisable the gathering of constant structures in a separate table.", + "--no-common-struct", + "\tDisable optimization of common term structures.", +% "--common-struct-preds ", +% "\tLimit common struct optimization to the preds with the given ids.", + +% Common goal optimization should not be turned off, since it can +% break programs that would otherwise compile properly (e.g., +% benchmarks/icfp2000). This is kept as a developer-only option. +% +% "--no-common-goal", +% "\tDisable optimization of common goals.", +% "\tAt the moment this optimization", +% "\tdetects only common deconstruction unifications.", +% "\tDisabling this optimization reduces the class of predicates", +% "\tthat the compiler considers to be deterministic.", + + "--constraint-propagation", + "\tEnable the constraint propagation transformation,", + "\twhich attempts to transform the code so that goals", + "\twhich can fail are executed as early as possible.", + "--local-constraint-propagation", + "\tEnable the constraint propagation transformation,", + "\tbut only rearrange goals within each procedure.", + "\tSpecialized versions of procedures will not be created.", + "--prev-code", + "\tMigrate into the start of branched goals.", + "--no-follow-code", + "\tDon't migrate into the end of branched goals.", + "--excess-assign", + "\tRemove excess assignment unifications.", + "--no-optimize-format-calls", + "\tDo not attempt to interpret the format string in calls to", + "\tstring.format and related predicates at compile time;", + "\talways leave this to be done at runtime.", + "--optimize-duplicate-calls", + "\tOptimize away multiple calls to a predicate", + "\twith the same input arguments.", + "--loop-invariants", + "\tHoist loop invariants out of loops.", + "--delay-constructs", + "\tReorder goals to move construction unifications after", + "\tprimitive goals that can fail.", + % "--optimize-saved-vars-const", + % "\tMinimize the number of variables saved across calls by", + % "\tintroducing duplicate copies of variables bound to", + % "\tconstants in each interval between flushes where they", + % "\tare needed.", + % "--optimize-saved-vars-cell", + % "\tMinimize the number of variables saved across calls by", + % "\ttrying to use saved variables pointing to cells to reach", + % "\tthe variables stored in those cells.", + "--optimize-saved-vars", + "\tMinimize the number of variables saved across calls.", + "--optimize-unused-args", + "\tRemove unused predicate arguments.", + "\tThis will cause the compiler to generate more", + "\tefficient code for many polymorphic predicates.", + "--intermod-unused-args", + "\tPerform unused argument removal across module boundaries.", + "\tThis option implies `--optimize-unused-args' and", + "\t`--intermodule-optimization'.", + + "--optimize-higher-order", + "\tEnable specialization of higher-order predicates.", + "--type-specialization", + "\tEnable specialization of polymorphic predicates where the", + "\tpolymorphic types are known.", + "--user-guided-type-specialization", + "\tEnable specialization of polymorphic predicates for which", + "\tthere are `:- pragma type_spec' declarations.", + "--higher-order-size-limit", + "\tSet the maximum goal size of specialized versions created by", + "\t`--optimize-higher-order' and `--type-specialization'.", + "\tGoal size is measured as the number of calls, unifications", + "\tand branched goals.", + "--higher-order-arg-limit", + "\tSet the maximum size of higher-order arguments to", + "\tbe specialized by `--optimize-higher-order' and", + "\t`--type-specialization'.", + "--unneeded-code", + "\tRemove goals from computation paths where their outputs are", + "\tnot needed, provided the semantics options allow the deletion", + "\tor movement of the goal.", + "--unneeded-code-copy-limit", + "\tGives the maximum number of places to which a goal may be copied", + "\twhen removing it from computation paths on which its outputs are", + "\tnot needed. A value of zero forbids goal movement and allows", + "\tonly goal deletion; a value of one prevents any increase in the", + "\tsize of the code.", +% "--unneeded-code-debug", +% "\tPrint progress messages during the unneeded code elimination", +% "\tpasses.", +% "--unneeded-code-debug-pred-name ", +% "\tPrint the definition of at the start of each pass", +% "\tof the unneeded code elimination algorithm.", + "--introduce-accumulators", + "\tAttempt to introduce accumulating variables into", + "\tprocedures, so as to make them tail recursive.", +% "--optimize-constructor-last-call-accumulator", +% "\tEnable the optimization via accumulators of ""last"" calls", +% "\tthat are followed by constructor application.", +% "--optimize-constructor-last-call-null", +% "\tWhen --optimize-constructor-last-call is enabled, put NULL in" +% "\tuninitialized fields (to prevent the garbage collector from", +% "\tlooking at and following a random bit pattern).", + "--optimize-constructor-last-call", + "\tEnable the optimization of ""last"" calls that are followed by", + "\tconstructor application.", + "--deforestation", + "\tEnable deforestation. Deforestation is a program", + "\ttransformation whose aim is to avoid the construction of", + "\tintermediate data structures and to avoid repeated traversals", + "\tover data structures within a conjunction.", + "--deforestation-depth-limit ", + "\tSpecify a depth limit to prevent infinite loops in the", + "\tdeforestation algorithm.", + "\tA value of -1 specifies no depth limit. The default is 4.", + "--deforestation-vars-threshold ", + "\tSpecify a rough limit on the number of variables", + "\tin a procedure created by deforestation.", + "\tA value of -1 specifies no limit. The default is 200.", + "--deforestation-size-threshold ", + "\tSpecify a rough limit on the size of a goal", + "\tto be optimized by deforestation.", + "\tA value of -1 specifies no limit. The default is 15.", + "--analyse-exceptions", + "\tEnable exception analysis. Identify those", + "\tprocedures that will not throw an exception.", + "\tSome optimizations can make use of this information.", +% XXX The options controlling closure analysis are currently +% commented out because it isn't useful. It can be uncommented when +% we actually have something that uses it. +% "--analyse-closures", +% "\tEnable closure analysis. Try to identify the possible", +% "\tvalues that higher-order valued variables can take.", +% "\tSome optimizations can make use of this information.", + "--analyse-trail-usage", + "\tEnable trail usage analysis. Identify those", + "\tprocedures that will not modify the trail.", + "\tThis information is used to reduce the overhead", + "\tof trailing.", +% `--no-optimize-trail-usage' is a developer-only option. +% It is intended for the benchmarking of trail usage optimization. +% Otherwise, it should not be turned off as doing so interferes with +% the results of the trail usage analysis. + % "--no-optimize-trail-usage", + % "\tDo not try and restrict trailing to those parts", + % "\tof the program that actually use it.", +% `--no-optimize-region-ops' is a developer-only option. +% It is intended for the benchmarking of region ops optimization. + % "--no-optimize-region-ops", + % "\tDo not try and restrict region operations to those parts", + % "\tof the program that actually use it.", + "--analyse-mm-tabling", + "\tIdentify those goals that do not call procedures", + "\tthat are evaluated using minimal model tabling.", + "\tThis information is used to reduce the overhead", + "\tof minimal model tabling." + % "--untuple", + % "\tExpand out procedure arguments when the argument type", + % "\tis a tuple or a type with exactly one functor.", + % "\tNote: this is almost always a pessimization.", + % "--tuple", + % "\tTry to find opportunities for procedures to pass some", + % "\targuments to each other as a tuple rather than as", + % "\tindividual arguments.", + % "\tNote: so far this has mostly a detrimental effect.", + % "--tuple-trace-counts-file", + % "\tSupply a trace counts summary file for the tupling", + % "\ttransformation. The summary should be made from a sample", + % "\trun of the program you are compiling, compiled without", + % "\toptimizations.", + % "--tuple-costs-ratio", + % "\tA value of 110 for this parameter means the tupling", + % "\ttransformation will transform a procedure if it thinks", + % "\tthat procedure would be 10% worse, on average, than", + % "\twhatever transformed version of the procedure it has in", + % "\tmind. The default is 100.", + % "--tuple-min-args", + % "\tThe minimum number of input arguments that the tupling", + % "\ttransformation will consider passing together as a", + % "\ttuple. This is mostly to speed up the compilation", + % "\tprocess by not pursuing (presumably) unfruitful searches.", +% This is for measurements by implementors only. +% "--no-inline-par-builtins", +% "\tGenerate calls to the predicates of par_builtin.m, instead of", +% "\tbodily including their definitions as C code.", +% Actually, this is the default for now. +% This is for measurements by implementors only. +% "--always-specialize-in-dep-par-conjs", +% "\tWhen the transformation for handling dependent parallel conjunctions", +% "\tadds waits and/or signals around a call, create a specialized", +% "\tversion of the called procedure, even if this is not profitable.", +% '--region-analysis' is not documented because it is still experimental. +% "--region-analysis", +% "\tEnable the analysis for region-based memory management." + ]). + +:- pred options_help_hlds_llds_optimization(io::di, io::uo) is det. + +options_help_hlds_llds_optimization --> + io.write_string("\n Medium-level (HLDS -> LLDS) optimizations:\n"), + write_tabbed_lines([ + "--no-smart-indexing", + "\tGenerate switches as a simple if-then-else chains;", + "\tdisable string hashing and integer table-lookup indexing.", + "--dense-switch-req-density ", + "\tThe jump table generated for an atomic switch", + "\tmust have at least this percentage of full slots (default: 25).", + "--lookup-switch-req-density ", + "\tThe jump table generated for an atomic switch", + "\tin which all the outputs are constant terms", + "\tmust have at least this percentage of full slots (default: 25).", + "--dense-switch-size ", + "\tThe jump table generated for an atomic switch", + "\tmust have at least this many entries (default: 4).", + "--lookup-switch-size ", + "\tThe lookup table generated for an atomic switch", + "\tmust have at least this many entries (default: 4).", + "--string-hash-switch-size ", + "\tThe hash table generated for a string switch", + "\tmust have at least this many entries (default: 8).", + "--string-binary-switch-size ", + "\tThe binary search table generated for a string switch", + "\tmust have at least this many entries (default: 4).", + "--tag-switch-size ", + "\tThe number of alternatives in a tag switch", + "\tmust be at least this number (default: 3).", + "--try-switch-size ", + "\tThe number of alternatives in a try/retry chain switch", + "\tmust be at least this number (default: 3).", + "--binary-switch-size ", + "\tThe number of alternatives in a binary search switch", + "\tmust be at least this number (default: 4).", +% These options are only for performance tests. +% "--switch-single-rec-base-first", +% "\tIn a switch with two arms, one a base case and one with a single", +% "\trecursive call, put the base case first. +% "--switch-multi-rec-base-first", +% "\tIn a switch with two arms, one a base case and one with multiple", +% "\trecursive calls, put the base case first. + "--no-static-ground-terms", + "\tDisable the optimization of constructing constant ground terms", + "\tat compile time and storing them as static constants.", + "\tNote that auxiliary data structures created by the compiler", + "\tfor purposes such as debugging will still be created as", + "\tstatic constants.", + "--no-use-atomic-cells", + "\tDon't use the atomic variants of the Boehm gc allocator calls,", + "\teven when this would otherwise be possible.", + "--no-middle-rec", + "\tDisable the middle recursion optimization.", + "--no-simple-neg", + "\tDon't generate simplified code for simple negations." +% "--no-allow-hijacks", +% "\tDo not generate code in which a procedure hijacks", +% "\ta nondet stack frame that possibly belongs to", +% "\tanother procedure invocation". + ]). + +:- pred options_help_llds_llds_optimization(io::di, io::uo) is det. + +options_help_llds_llds_optimization --> + io.write_string("\n Low-level (LLDS -> LLDS) optimizations:\n"), + write_tabbed_lines([ + "--no-common-data", + "\tDisable optimization of common data structures.", + "--no-common-layout-data", + "\tDisable optimization of common subsequences in layout structures.", + "--no-llds-optimize", + "\tDisable the low-level optimization passes.", + "--optimize-dead-procs", + "\tEnable dead predicate elimination.", + "--no-optimize-peep", + "\tDisable local peephole optimizations.", +% This is useful for developers only, to test whether a gcc bug has been fixed. +% "--no-optimize-peep-mkword", +% "\tDisable peephole optimizations of words created by mkword.", + "--no-optimize-jumps", + "\tDisable elimination of jumps to jumps.", + "--no-optimize-fulljumps", + "\tDisable elimination of jumps to ordinary code.", + "--pessimize-tailcalls", + "\tDisable the optimization of tailcalls.", + "--checked-nondet-tailcalls", + "\tConvert nondet calls into tail calls whenever possible, even", + "\twhen this requires a runtime check. This option tries to", + "\tminimize stack consumption, possibly at the expense of speed.", + "--no-use-local-vars", + "\tDisable the transformation to use local variables in C code", + "\tblocks wherever possible.", +% This is useful for developers only. +% "--standardize-labels", +% "\tStandardize internal labels in the generated code.", + "--no-optimize-labels", + "\tDisable elimination of dead labels and code.", + "--optimize-dups", + "\tEnable elimination of duplicate code within procedures.", + "--optimize-proc-dups", + "\tEnable elimination of duplicate procedures.", +%%% "--optimize-copyprop", +%%% "\tEnable the copy propagation optimization.", + "--no-optimize-frames", + "\tDisable stack frame optimizations.", + "--no-optimize-delay-slot", + "\tDisable branch delay slot optimizations.", + "--optimize-reassign", + "\tOptimize away assignments to locations that already hold", + "\tthe assigned value.", + "--optimize-repeat ", + "\tIterate most optimizations at most times (default: 3).", + "--layout-compression-limit ", + "\tAttempt to compress the layout structures used by the debugger", + "\tonly as long as the arrays involved have at most elements", + "\t(default: 4000)." + ]). + +:- pred options_help_mlds_mlds_optimization(io::di, io::uo) is det. + +options_help_mlds_mlds_optimization --> + io.write_string("\n MLDS -> MLDS optimizations:\n"), + write_tabbed_lines([ + "--no-mlds-optimize", + "\tDisable the MLDS->MLDS optimization passes.", + "--no-mlds-peephole", + "\tDo not perform peephole optimization of the MLDS.", + "--no-optimize-tailcalls", + "\tTreat tailcalls as ordinary calls, rather than optimizing", + "\tby turning self-tailcalls into loops.", + "--no-optimize-initializations", + "\tLeave initializations of local variables as", + "\tassignment statements, rather than converting such", + "\tassignment statements into initializers.", + "--eliminate-local-vars", + "\tEliminate local variables with known values, where possible,", + "\tby replacing occurrences of such variables with their values.", + "--no-generate-trail-ops-inline", + "\tDo not generate trailing operations inline,", + "\tbut instead insert calls to the versions of these operations", + "\tin the standard library." +]). + +:- pred options_help_hlds_elds_optimization(io::di, io::uo) is det. + +options_help_hlds_elds_optimization --> + io.write_string("\n HLDS -> ELDS optimizations:\n"), + write_tabbed_lines([ + "--erlang-switch-on-strings-as-atoms", + "\tEnable a workaround for slow HiPE compilation of large string", + "\tswitches by converting the string to an atom at runtime and", + "\tswitching on atoms. Do not enable if the string switched on", + "\tcould be longer than 255 characters at runtime." + ]). + +:- pred options_help_output_optimization(io::di, io::uo) is det. + +options_help_output_optimization --> + io.write_string("\n Output-level (LLDS -> C) optimizations:\n"), + write_tabbed_lines([ + "--use-macro-for-redo-fail", + "\tEmit the fail or redo macro instead of a branch", + "\tto the fail or redo code in the runtime system.", + "\tThis produces slightly bigger but slightly faster code.", + "--no-emit-c-loops", + "\tUse only gotos, don't emit C loop constructs.", + "--procs-per-c-function ", + "\tPut the code for up to Mercury", + "\tprocedures in a single C function. The default", + "\tvalue of is one. Increasing can produce", + "\tslightly more efficient code, but makes compilation slower.", + "--everything-in-one-c-function", + "\tThis option has the effect of putting the code for all", + "\tthe Mercury procedures in a single C function,", + "\twhich produces the most efficient code but tends to", + "\tseverely stress the C compiler on large modules.", + "--no-local-thread-engine-base", + "\tDon't copy the thread-local Mercury engine base address", + "\tinto local variables. This option only affects low-level", + "\tparallel grades not using the global register variables", + "\textension." + ]). + +:- pred options_help_target_code_compilation(io::di, io::uo) is det. + +options_help_target_code_compilation --> + io.write_string("\n Target code compilation:\n"), + write_tabbed_lines([ + "\tNote that if you are using Mmake, you need to pass these", + "\toptions to the target code compiler (e.g. `mgnuc')", + "\trather than to `mmc'.", + + "--target-debug", + "\tEnable debugging of the generated target code.", + "\tIf the target language is C, this has the same effect as", + "\t`--c-debug' (see below).", + "\tIf the target language is IL or C#, this causes the compiler to", + "\tpass `/debug' to the IL assembler or C# compiler.)", + + "--cc ", + "\tSpecify which C compiler to use.", + + "--no-c-optimize", + "\tDon't enable the C compiler's optimizations.", + + "--no-ansi-c", + "\tDon't specify to the C compiler that the ANSI dialect", + "\tof C should be used. Use the full contents of system", + "\theaders, rather than the ANSI subset.", + + "--c-debug", + "\tEnable debugging of the generated C code.", + "\t(This has the same effect as `--cflags ""-g""'", + "\tand disables stripping of the executable.)", + + "--c-include-directory , --c-include-dir ", + "\tAppend to the list of directories to be searched for", + "\tC header files. Note that if you want to override", + "\tthis list, rather than append to it, then you can set the", + "\t`MERCURY_MC_ALL_C_INCL_DIRS' environment variable to a", + "\tsequence of `--c-include-directory' options.", + + "--inline-alloc", + "\tInline calls to GC_malloc().", + "\tThis can improve performance a fair bit,", + "\tbut may significantly increase code size.", + "\tThis option has no effect if `--gc boehm'", + "\tis not set or if the C compiler is not GNU C.", + + "--cflags , --cflag