mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Compare commits
	
		
			131 Commits
		
	
	
		
			v2.11.3
			...
			test/maste
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					d40b4a33de | ||
| 
						 | 
					87498679bd | ||
| 
						 | 
					f4e254202b | ||
| 
						 | 
					e91d225e7d | ||
| 
						 | 
					b90d940aef | ||
| 
						 | 
					dbff196b08 | ||
| 
						 | 
					5b7316fb2a | ||
| 
						 | 
					fa4dfe39ba | ||
| 
						 | 
					89999e60bf | ||
| 
						 | 
					4819fb12a3 | ||
| 
						 | 
					27a4eeb206 | ||
| 
						 | 
					bacf4d5780 | ||
| 
						 | 
					f92fed60f8 | ||
| 
						 | 
					5e797b548c | ||
| 
						 | 
					700e2f1b2b | ||
| 
						 | 
					861656978b | ||
| 
						 | 
					9c05bdac85 | ||
| 
						 | 
					bd34c16c8f | ||
| 
						 | 
					13109bb9b8 | ||
| 
						 | 
					84f3b3720b | ||
| 
						 | 
					858a66ccc8 | ||
| 
						 | 
					abb05eace6 | ||
| 
						 | 
					62bd96a778 | ||
| 
						 | 
					8cb736adfa | ||
| 
						 | 
					0758c05186 | ||
| 
						 | 
					62bc6f0457 | ||
| 
						 | 
					ea7e894139 | ||
| 
						 | 
					21f0ac99e6 | ||
| 
						 | 
					b251866a29 | ||
| 
						 | 
					bf3db20a9d | ||
| 
						 | 
					bd55147847 | ||
| 
						 | 
					f4d64af39b | ||
| 
						 | 
					b7bda34645 | ||
| 
						 | 
					b13dea6df0 | ||
| 
						 | 
					28a64c9318 | ||
| 
						 | 
					74be618fff | ||
| 
						 | 
					8bbe10bf50 | ||
| 
						 | 
					d275911624 | ||
| 
						 | 
					c26382301c | ||
| 
						 | 
					e12bc07041 | ||
| 
						 | 
					20416369ac | ||
| 
						 | 
					2be91e9b2e | ||
| 
						 | 
					dc1b8d9e80 | ||
| 
						 | 
					bf0a814514 | ||
| 
						 | 
					b14267d40f | ||
| 
						 | 
					195a4115d8 | ||
| 
						 | 
					e1da8eb841 | ||
| 
						 | 
					14738f037f | ||
| 
						 | 
					a437943516 | ||
| 
						 | 
					900ee57de8 | ||
| 
						 | 
					947f4e1c57 | ||
| 
						 | 
					d9f17a65dd | ||
| 
						 | 
					f71def19ae | ||
| 
						 | 
					e452e85cae | ||
| 
						 | 
					5059fe90b0 | ||
| 
						 | 
					b90da731d6 | ||
| 
						 | 
					d2012519ba | ||
| 
						 | 
					1b7f26091c | ||
| 
						 | 
					548e4f1845 | ||
| 
						 | 
					625bed8fca | ||
| 
						 | 
					db15367775 | ||
| 
						 | 
					309d14a955 | ||
| 
						 | 
					5ff16e1195 | ||
| 
						 | 
					cf43aa9111 | ||
| 
						 | 
					138c1e6024 | ||
| 
						 | 
					382870a881 | ||
| 
						 | 
					31921838cd | ||
| 
						 | 
					a707587182 | ||
| 
						 | 
					bc482af999 | ||
| 
						 | 
					6818744dae | ||
| 
						 | 
					607185ac61 | ||
| 
						 | 
					81b7a412c3 | ||
| 
						 | 
					09b9a8b441 | ||
| 
						 | 
					85479cc2de | ||
| 
						 | 
					3ad4eb2b59 | ||
| 
						 | 
					878fe95ec3 | ||
| 
						 | 
					3d23d1be69 | ||
| 
						 | 
					701e720ab8 | ||
| 
						 | 
					e709ce7d56 | ||
| 
						 | 
					32c89a5405 | ||
| 
						 | 
					1735982a73 | ||
| 
						 | 
					625e0aa1af | ||
| 
						 | 
					00e1a3f8fd | ||
| 
						 | 
					539256b08e | ||
| 
						 | 
					ff791f5a39 | ||
| 
						 | 
					de4d48b0fe | ||
| 
						 | 
					b5c49f6d1c | ||
| 
						 | 
					03cb7d6ffb | ||
| 
						 | 
					304fc344a1 | ||
| 
						 | 
					33c42638e9 | ||
| 
						 | 
					9d940755e7 | ||
| 
						 | 
					bc04232f87 | ||
| 
						 | 
					e17ebec098 | ||
| 
						 | 
					a7cba23526 | ||
| 
						 | 
					7cd23036a7 | ||
| 
						 | 
					44c5413abf | ||
| 
						 | 
					50ab58e91f | ||
| 
						 | 
					1fd0732390 | ||
| 
						 | 
					ed1b9ee899 | ||
| 
						 | 
					d3c04d6310 | ||
| 
						 | 
					f66ffe305f | ||
| 
						 | 
					2a9ff0083c | ||
| 
						 | 
					c1cf7ea825 | ||
| 
						 | 
					67f7268a55 | ||
| 
						 | 
					a55ee7eb09 | ||
| 
						 | 
					203f6d1944 | ||
| 
						 | 
					42c68f21d1 | ||
| 
						 | 
					7e8be1293e | ||
| 
						 | 
					09c234ec26 | ||
| 
						 | 
					65a26c3e73 | ||
| 
						 | 
					98f35aefdc | ||
| 
						 | 
					38a3714514 | ||
| 
						 | 
					491700f925 | ||
| 
						 | 
					ac2723abe3 | ||
| 
						 | 
					0d0e219532 | ||
| 
						 | 
					cf35807709 | ||
| 
						 | 
					c2b53db96d | ||
| 
						 | 
					8e6efc3a7d | ||
| 
						 | 
					4b6f05b4d1 | ||
| 
						 | 
					7aad5f93e4 | ||
| 
						 | 
					6d5da4c9ec | ||
| 
						 | 
					dcc598442b | ||
| 
						 | 
					91877056fb | ||
| 
						 | 
					868e9df434 | ||
| 
						 | 
					9d569c8bd5 | ||
| 
						 | 
					9ae0bdbb43 | ||
| 
						 | 
					a3aaa1ec4d | ||
| 
						 | 
					ee3c9bcdbd | ||
| 
						 | 
					aa78060e41 | ||
| 
						 | 
					5fb6f34d8a | ||
| 
						 | 
					7c1716aa1e | 
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
 | 
			
		||||
  s.files = Dir['lib/**/*']
 | 
			
		||||
  s.executables << 'linguist'
 | 
			
		||||
 | 
			
		||||
  s.add_dependency 'charlock_holmes', '~> 0.7.1'
 | 
			
		||||
  s.add_dependency 'charlock_holmes', '~> 0.7.3'
 | 
			
		||||
  s.add_dependency 'escape_utils',    '~> 1.0.1'
 | 
			
		||||
  s.add_dependency 'mime-types',      '~> 1.19'
 | 
			
		||||
  s.add_dependency 'pygments.rb',     '~> 0.5.4'
 | 
			
		||||
  s.add_dependency 'pygments.rb',     '~> 0.6.0'
 | 
			
		||||
 | 
			
		||||
  s.add_development_dependency 'json'
 | 
			
		||||
  s.add_development_dependency 'mocha'
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -258,7 +264,7 @@ module Linguist
 | 
			
		||||
          # large) strings.
 | 
			
		||||
          begin
 | 
			
		||||
            encoded_newlines = ["\r\n", "\r", "\n"].
 | 
			
		||||
              map { |nl| nl.encode(encoding, "ASCII-8BIT").force_encoding(data.encoding) }
 | 
			
		||||
              map { |nl| nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data.encoding) }
 | 
			
		||||
 | 
			
		||||
            data.split(Regexp.union(encoded_newlines), -1)
 | 
			
		||||
          rescue Encoding::ConverterNotFoundError
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -157,6 +157,7 @@ Assembly:
 | 
			
		||||
  - nasm
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .asm
 | 
			
		||||
  - .inc
 | 
			
		||||
 | 
			
		||||
Augeas:
 | 
			
		||||
  type: programming
 | 
			
		||||
@@ -430,6 +431,14 @@ Common Lisp:
 | 
			
		||||
  - clisp
 | 
			
		||||
  - ecl
 | 
			
		||||
 | 
			
		||||
Component Pascal:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Delphi
 | 
			
		||||
  color: "#b0ce4e"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .cp
 | 
			
		||||
  - .cps
 | 
			
		||||
 | 
			
		||||
Coq:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
@@ -520,15 +529,6 @@ Dart:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .dart
 | 
			
		||||
 | 
			
		||||
DCPU-16 ASM:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: dasm16
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .dasm16
 | 
			
		||||
  - .dasm
 | 
			
		||||
  aliases:
 | 
			
		||||
  - dasm16
 | 
			
		||||
 | 
			
		||||
Diff:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .diff
 | 
			
		||||
@@ -932,7 +932,7 @@ Hy:
 | 
			
		||||
 | 
			
		||||
IDL:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
  lexer: IDL
 | 
			
		||||
  color: "#e3592c"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .pro
 | 
			
		||||
@@ -951,7 +951,7 @@ Inno Setup:
 | 
			
		||||
 | 
			
		||||
Idris:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
  lexer: Idris
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .idr
 | 
			
		||||
  - .lidr
 | 
			
		||||
@@ -990,6 +990,13 @@ Ioke:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .ik
 | 
			
		||||
 | 
			
		||||
Isabelle:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
  color: "#fdcd00"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .thy
 | 
			
		||||
 | 
			
		||||
J:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
@@ -1079,6 +1086,8 @@ JavaScript:
 | 
			
		||||
  - .pac
 | 
			
		||||
  - .sjs
 | 
			
		||||
  - .ssjs
 | 
			
		||||
  - .xsjs
 | 
			
		||||
  - .xsjslib
 | 
			
		||||
  filenames:
 | 
			
		||||
  - Jakefile
 | 
			
		||||
  interpreters:
 | 
			
		||||
@@ -1277,6 +1286,8 @@ Mathematica:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .mathematica
 | 
			
		||||
  - .m
 | 
			
		||||
  - .nb
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
 | 
			
		||||
Matlab:
 | 
			
		||||
@@ -1384,6 +1395,12 @@ Nimrod:
 | 
			
		||||
  - .nim
 | 
			
		||||
  - .nimrod
 | 
			
		||||
 | 
			
		||||
Nix:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Nix
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .nix
 | 
			
		||||
 | 
			
		||||
Nu:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Scheme
 | 
			
		||||
@@ -1593,7 +1610,7 @@ Perl6:
 | 
			
		||||
Pike:
 | 
			
		||||
  type: programming
 | 
			
		||||
  color: "#066ab2"
 | 
			
		||||
  lexer: C
 | 
			
		||||
  lexer: Pike
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .pike
 | 
			
		||||
  - .pmod
 | 
			
		||||
@@ -1690,6 +1707,7 @@ Python:
 | 
			
		||||
  - .gyp
 | 
			
		||||
  - .lmi
 | 
			
		||||
  - .pyde
 | 
			
		||||
  - .pyp
 | 
			
		||||
  - .pyt
 | 
			
		||||
  - .pyw
 | 
			
		||||
  - .wsgi
 | 
			
		||||
@@ -1715,6 +1733,12 @@ QML:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .qml
 | 
			
		||||
 | 
			
		||||
QMake:
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .pro
 | 
			
		||||
  - .pri
 | 
			
		||||
 | 
			
		||||
R:
 | 
			
		||||
  type: programming
 | 
			
		||||
  color: "#198ce7"
 | 
			
		||||
@@ -1854,12 +1878,15 @@ Ruby:
 | 
			
		||||
  interpreters:
 | 
			
		||||
  - ruby
 | 
			
		||||
  filenames:
 | 
			
		||||
  - .pryrc
 | 
			
		||||
  - Appraisals
 | 
			
		||||
  - Berksfile
 | 
			
		||||
  - Buildfile
 | 
			
		||||
  - Gemfile
 | 
			
		||||
  - Gemfile.lock
 | 
			
		||||
  - Guardfile
 | 
			
		||||
  - Jarfile
 | 
			
		||||
  - Mavenfile
 | 
			
		||||
  - Podfile
 | 
			
		||||
  - Thorfile
 | 
			
		||||
  - Vagrantfile
 | 
			
		||||
@@ -1895,6 +1922,13 @@ SQL:
 | 
			
		||||
  - .udf
 | 
			
		||||
  - .viw
 | 
			
		||||
 | 
			
		||||
STON:
 | 
			
		||||
  type: data
 | 
			
		||||
  group: Smalltalk
 | 
			
		||||
  lexer: JSON
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .ston
 | 
			
		||||
 | 
			
		||||
Sage:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Python
 | 
			
		||||
@@ -1987,6 +2021,14 @@ Slash:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .sl
 | 
			
		||||
 | 
			
		||||
Slim:
 | 
			
		||||
  group: HTML
 | 
			
		||||
  type: markup
 | 
			
		||||
  lexer: Slim
 | 
			
		||||
  color: "#ff8877"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .slim
 | 
			
		||||
 | 
			
		||||
Smalltalk:
 | 
			
		||||
  type: programming
 | 
			
		||||
  color: "#596706"
 | 
			
		||||
@@ -2017,8 +2059,9 @@ Standard ML:
 | 
			
		||||
  aliases:
 | 
			
		||||
  - sml
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .sml
 | 
			
		||||
  - .ML
 | 
			
		||||
  - .fun
 | 
			
		||||
  - .sml
 | 
			
		||||
 | 
			
		||||
Stata:
 | 
			
		||||
  type: programming
 | 
			
		||||
@@ -2048,8 +2091,8 @@ SuperCollider:
 | 
			
		||||
 | 
			
		||||
Swift:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Swift
 | 
			
		||||
  color: "#ffac45"
 | 
			
		||||
  lexer: Text only
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .swift
 | 
			
		||||
 | 
			
		||||
@@ -2161,6 +2204,14 @@ UnrealScript:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .uc
 | 
			
		||||
 | 
			
		||||
VCL:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: Perl
 | 
			
		||||
  ace_mode: perl
 | 
			
		||||
  color: "#0298c3"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .vcl
 | 
			
		||||
 | 
			
		||||
VHDL:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: vhdl
 | 
			
		||||
@@ -2256,6 +2307,7 @@ XML:
 | 
			
		||||
  - .launch
 | 
			
		||||
  - .mxml
 | 
			
		||||
  - .nproj
 | 
			
		||||
  - .nuspec
 | 
			
		||||
  - .osm
 | 
			
		||||
  - .plist
 | 
			
		||||
  - .pluginspec
 | 
			
		||||
@@ -2327,6 +2379,17 @@ XSLT:
 | 
			
		||||
  - .xslt
 | 
			
		||||
  - .xsl
 | 
			
		||||
 | 
			
		||||
Xojo:
 | 
			
		||||
  type: programming
 | 
			
		||||
  lexer: VB.net
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .xojo_code
 | 
			
		||||
  - .xojo_menu
 | 
			
		||||
  - .xojo_report
 | 
			
		||||
  - .xojo_script
 | 
			
		||||
  - .xojo_toolbar
 | 
			
		||||
  - .xojo_window
 | 
			
		||||
 | 
			
		||||
Xtend:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
@@ -2387,6 +2450,7 @@ mupad:
 | 
			
		||||
nesC:
 | 
			
		||||
  type: programming
 | 
			
		||||
  color: "#ffce3b"
 | 
			
		||||
  lexer: nesC
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .nc
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -28,7 +28,7 @@ module Linguist
 | 
			
		||||
    #
 | 
			
		||||
    # Returns nothing.
 | 
			
		||||
    def self.each(&block)
 | 
			
		||||
      Dir.entries(ROOT).each do |category|
 | 
			
		||||
      Dir.entries(ROOT).sort!.each do |category|
 | 
			
		||||
        next if category == '.' || category == '..'
 | 
			
		||||
 | 
			
		||||
        # Skip text and binary for now
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@
 | 
			
		||||
# Vendored dependencies
 | 
			
		||||
- thirdparty/
 | 
			
		||||
- vendors?/
 | 
			
		||||
- extern(al)?/
 | 
			
		||||
 | 
			
		||||
# Debian packaging
 | 
			
		||||
- ^debian/
 | 
			
		||||
@@ -168,6 +169,9 @@
 | 
			
		||||
- (^|/)extjs/src/
 | 
			
		||||
- (^|/)extjs/welcome/
 | 
			
		||||
 | 
			
		||||
# Html5shiv
 | 
			
		||||
- (^|/)html5shiv(\.min)?\.js$
 | 
			
		||||
 | 
			
		||||
# Samples folders
 | 
			
		||||
- ^[Ss]amples/
 | 
			
		||||
 | 
			
		||||
@@ -196,3 +200,12 @@
 | 
			
		||||
 | 
			
		||||
# Mercury --use-subdirs
 | 
			
		||||
- Mercury/
 | 
			
		||||
 | 
			
		||||
# R packages
 | 
			
		||||
- ^vignettes/
 | 
			
		||||
- ^inst/extdata/
 | 
			
		||||
 | 
			
		||||
# Octicons
 | 
			
		||||
- octicons.css
 | 
			
		||||
- octicons.min.css
 | 
			
		||||
- sprockets-octicons.scss
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
module Linguist
 | 
			
		||||
  VERSION = "2.11.3"
 | 
			
		||||
  VERSION = "2.12.0"
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2048
									
								
								samples/Assembly/ASSEMBLE.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2048
									
								
								samples/Assembly/ASSEMBLE.inc
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										350
									
								
								samples/Assembly/FASM.asm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										350
									
								
								samples/Assembly/FASM.asm
									
									
									
									
									
										Normal file
									
								
							@@ -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 <source> [output]',0Dh,0Ah
 | 
			
		||||
       db 'optional settings:',0Dh,0Ah
 | 
			
		||||
       db ' -m <limit>    set the limit in kilobytes for the available memory',0Dh,0Ah
 | 
			
		||||
       db ' -p <limit>    set the maximum allowed number of passes',0Dh,0Ah
 | 
			
		||||
       db ' -s <file>     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
 | 
			
		||||
							
								
								
									
										503
									
								
								samples/Assembly/SYSTEM.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										503
									
								
								samples/Assembly/SYSTEM.inc
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
							
								
								
									
										7060
									
								
								samples/Assembly/X86_64.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7060
									
								
								samples/Assembly/X86_64.inc
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										130
									
								
								samples/Component Pascal/Example.cp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								samples/Component Pascal/Example.cp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,130 @@
 | 
			
		||||
MODULE ObxControls;
 | 
			
		||||
(**
 | 
			
		||||
    project         = "BlackBox"
 | 
			
		||||
    organization    = "www.oberon.ch"
 | 
			
		||||
    contributors    = "Oberon microsystems"
 | 
			
		||||
    version         = "System/Rsrc/About"
 | 
			
		||||
    copyright       = "System/Rsrc/About"
 | 
			
		||||
    license         = "Docu/BB-License"
 | 
			
		||||
    changes         = ""
 | 
			
		||||
    issues          = ""
 | 
			
		||||
 | 
			
		||||
**)
 | 
			
		||||
 | 
			
		||||
IMPORT Dialog, Ports, Properties, Views;
 | 
			
		||||
 | 
			
		||||
CONST beginner = 0; advanced = 1; expert = 2; guru = 3;    (* user classes *)
 | 
			
		||||
 | 
			
		||||
TYPE
 | 
			
		||||
    View = POINTER TO RECORD (Views.View)
 | 
			
		||||
        size: INTEGER    (* border size in mm *)
 | 
			
		||||
    END;
 | 
			
		||||
 | 
			
		||||
VAR
 | 
			
		||||
    data*: RECORD
 | 
			
		||||
        class*: INTEGER;    (* current user class *)
 | 
			
		||||
        list*: Dialog.List;    (* list of currently available sizes, derived from class *)
 | 
			
		||||
        width*: INTEGER    (* width of next view to be opened. Derived from
 | 
			
		||||
                                    class, or entered through a text entry field *)
 | 
			
		||||
    END;
 | 
			
		||||
 | 
			
		||||
    predef: ARRAY 6 OF INTEGER;    (* table of predefined sizes *)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
PROCEDURE SetList;
 | 
			
		||||
BEGIN
 | 
			
		||||
    IF data.class = beginner THEN
 | 
			
		||||
        data.list.SetLen(1);
 | 
			
		||||
        data.list.SetItem(0, "default")
 | 
			
		||||
    ELSIF data.class = advanced THEN
 | 
			
		||||
        data.list.SetLen(4);
 | 
			
		||||
        data.list.SetItem(0, "default");
 | 
			
		||||
        data.list.SetItem(1, "small");
 | 
			
		||||
        data.list.SetItem(2, "medium");
 | 
			
		||||
        data.list.SetItem(3, "large");
 | 
			
		||||
    ELSE
 | 
			
		||||
        data.list.SetLen(6);
 | 
			
		||||
        data.list.SetItem(0, "default");
 | 
			
		||||
        data.list.SetItem(1, "small");
 | 
			
		||||
        data.list.SetItem(2, "medium");
 | 
			
		||||
        data.list.SetItem(3, "large");
 | 
			
		||||
        data.list.SetItem(4, "tiny");
 | 
			
		||||
        data.list.SetItem(5, "huge");
 | 
			
		||||
    END
 | 
			
		||||
END SetList;
 | 
			
		||||
 | 
			
		||||
(* View *)
 | 
			
		||||
 | 
			
		||||
PROCEDURE (v: View) CopyFromSimpleView (source: Views.View);
 | 
			
		||||
BEGIN
 | 
			
		||||
    v.size := source(View).size
 | 
			
		||||
END CopyFromSimpleView;
 | 
			
		||||
 | 
			
		||||
PROCEDURE (v: View) Restore (f: Views.Frame; l, t, r, b: INTEGER);
 | 
			
		||||
BEGIN    (* fill view with a red square of size v.size *)
 | 
			
		||||
    IF v.size = 0 THEN v.size := predef[0] END;    (* lazy initialization of size *)
 | 
			
		||||
    f.DrawRect(0, 0, v.size, v.size, Ports.fill, Ports.red)
 | 
			
		||||
END Restore;
 | 
			
		||||
 | 
			
		||||
PROCEDURE (v: View) HandlePropMsg (VAR msg: Views.PropMessage);
 | 
			
		||||
BEGIN
 | 
			
		||||
    WITH msg: Properties.SizePref DO
 | 
			
		||||
        IF v.size = 0 THEN v.size := predef[0] END;    (* lazy initialization of size *)
 | 
			
		||||
        msg.w := v.size; msg.h := v.size    (* tell environment about desired width and height *)
 | 
			
		||||
    ELSE    (* ignore other messages *)
 | 
			
		||||
    END
 | 
			
		||||
END HandlePropMsg;
 | 
			
		||||
 | 
			
		||||
(* notifiers *)
 | 
			
		||||
 | 
			
		||||
PROCEDURE ClassNotify* (op, from, to: INTEGER);
 | 
			
		||||
BEGIN    (* react to change in data.class *)
 | 
			
		||||
    IF op = Dialog.changed THEN
 | 
			
		||||
        IF (to = beginner) OR (to = advanced) & (data.list.index > 3) THEN
 | 
			
		||||
            (* if class is reduced, make sure that selection contains legal elements *)
 | 
			
		||||
            data.list.index := 0; data.width := predef[0];    (* modify interactor *)
 | 
			
		||||
            Dialog.Update(data)    (* redraw controls where necessary *)
 | 
			
		||||
        END;
 | 
			
		||||
        SetList;
 | 
			
		||||
        Dialog.UpdateList(data.list)    (* reconstruct list box contents *)
 | 
			
		||||
    END
 | 
			
		||||
END ClassNotify;
 | 
			
		||||
 | 
			
		||||
PROCEDURE ListNotify* (op, from, to: INTEGER);
 | 
			
		||||
BEGIN    (* reacto to change in data.list (index to was selected) *)
 | 
			
		||||
    IF op = Dialog.changed THEN
 | 
			
		||||
        data.width := predef[to];    (* modify interactor *)
 | 
			
		||||
        Dialog.Update(data)    (* redraw controls where necessary *)
 | 
			
		||||
    END
 | 
			
		||||
END ListNotify;
 | 
			
		||||
 | 
			
		||||
(* guards *)
 | 
			
		||||
 | 
			
		||||
PROCEDURE ListGuard* (VAR par: Dialog.Par);
 | 
			
		||||
BEGIN    (* disable list box for a beginner *)
 | 
			
		||||
    par.disabled := data.class = beginner
 | 
			
		||||
END ListGuard;
 | 
			
		||||
 | 
			
		||||
PROCEDURE WidthGuard* (VAR par: Dialog.Par);
 | 
			
		||||
BEGIN    (* make text entry field read-only if user is not guru *)
 | 
			
		||||
    par.readOnly := data.class # guru
 | 
			
		||||
END WidthGuard;
 | 
			
		||||
 | 
			
		||||
(* commands *)
 | 
			
		||||
 | 
			
		||||
PROCEDURE Open*;
 | 
			
		||||
    VAR v: View;
 | 
			
		||||
BEGIN
 | 
			
		||||
    NEW(v);    (* create and initialize a new view *)
 | 
			
		||||
    v.size := data.width * Ports.mm;    (* define view's size in function of class *)
 | 
			
		||||
    Views.OpenAux(v, "Example")    (* open the view in a window *)
 | 
			
		||||
END Open;
 | 
			
		||||
 | 
			
		||||
BEGIN    (* initialization of global variables *)
 | 
			
		||||
    predef[0] := 40; predef[1] := 30; predef[2] := 50;    (* predefined sizes *)
 | 
			
		||||
    predef[3] := 70; predef[4] := 20; predef[5] := 100;
 | 
			
		||||
    data.class := beginner;    (* default values *)
 | 
			
		||||
    data.list.index := 0;
 | 
			
		||||
    data.width := predef[0];
 | 
			
		||||
    SetList
 | 
			
		||||
END ObxControls.
 | 
			
		||||
							
								
								
									
										71
									
								
								samples/Component Pascal/Example2.cps
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								samples/Component Pascal/Example2.cps
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
MODULE ObxFact;
 | 
			
		||||
(**
 | 
			
		||||
    project         = "BlackBox"
 | 
			
		||||
    organization    = "www.oberon.ch"
 | 
			
		||||
    contributors    = "Oberon microsystems"
 | 
			
		||||
    version         = "System/Rsrc/About"
 | 
			
		||||
    copyright       = "System/Rsrc/About"
 | 
			
		||||
    license         = "Docu/BB-License"
 | 
			
		||||
    changes         = ""
 | 
			
		||||
    issues          = ""
 | 
			
		||||
 | 
			
		||||
**)
 | 
			
		||||
 | 
			
		||||
IMPORT
 | 
			
		||||
    Stores, Models, TextModels, TextControllers, Integers;
 | 
			
		||||
 | 
			
		||||
PROCEDURE Read(r: TextModels.Reader; VAR x: Integers.Integer);
 | 
			
		||||
    VAR i, len, beg: INTEGER; ch: CHAR; buf: POINTER TO ARRAY OF CHAR;
 | 
			
		||||
BEGIN
 | 
			
		||||
    r.ReadChar(ch);
 | 
			
		||||
    WHILE ~r.eot & (ch <= " ") DO r.ReadChar(ch) END;
 | 
			
		||||
    ASSERT(~r.eot & (((ch >= "0") & (ch <= "9")) OR (ch = "-")));
 | 
			
		||||
    beg := r.Pos() - 1; len := 0;
 | 
			
		||||
    REPEAT INC(len); r.ReadChar(ch) UNTIL r.eot OR (ch < "0") OR (ch > "9");
 | 
			
		||||
    NEW(buf, len + 1);
 | 
			
		||||
    i := 0; r.SetPos(beg);
 | 
			
		||||
    REPEAT r.ReadChar(buf[i]); INC(i) UNTIL i = len;
 | 
			
		||||
    buf[i] := 0X;
 | 
			
		||||
    Integers.ConvertFromString(buf^, x)
 | 
			
		||||
END Read;
 | 
			
		||||
 | 
			
		||||
PROCEDURE Write(w: TextModels.Writer; x: Integers.Integer);
 | 
			
		||||
    VAR i: INTEGER;
 | 
			
		||||
BEGIN
 | 
			
		||||
    IF Integers.Sign(x) < 0 THEN w.WriteChar("-") END;
 | 
			
		||||
    i := Integers.Digits10Of(x);
 | 
			
		||||
    IF i # 0 THEN
 | 
			
		||||
        REPEAT DEC(i); w.WriteChar(Integers.ThisDigit10(x, i)) UNTIL i = 0
 | 
			
		||||
    ELSE w.WriteChar("0")
 | 
			
		||||
    END
 | 
			
		||||
END Write;
 | 
			
		||||
 | 
			
		||||
PROCEDURE Compute*;
 | 
			
		||||
    VAR beg, end, i, n: INTEGER; ch: CHAR;
 | 
			
		||||
        s: Stores.Operation;
 | 
			
		||||
        r: TextModels.Reader; w: TextModels.Writer; attr: TextModels.Attributes;
 | 
			
		||||
        c: TextControllers.Controller;
 | 
			
		||||
        x: Integers.Integer;
 | 
			
		||||
BEGIN
 | 
			
		||||
    c := TextControllers.Focus();
 | 
			
		||||
    IF (c # NIL) & c.HasSelection() THEN
 | 
			
		||||
        c.GetSelection(beg, end);
 | 
			
		||||
        r := c.text.NewReader(NIL); r.SetPos(beg); r.ReadChar(ch);
 | 
			
		||||
        WHILE ~r.eot & (beg < end) & (ch <= " ") DO r.ReadChar(ch); INC(beg) END;
 | 
			
		||||
        IF ~r.eot & (beg < end) THEN
 | 
			
		||||
            r.ReadPrev; Read(r, x);
 | 
			
		||||
            end := r.Pos(); r.ReadPrev; attr :=r.attr;
 | 
			
		||||
            IF (Integers.Sign(x) > 0) & (Integers.Compare(x, Integers.Long(MAX(LONGINT))) <= 0) THEN
 | 
			
		||||
                n := SHORT(Integers.Short(x)); i := 2; x := Integers.Long(1);
 | 
			
		||||
                WHILE i <= n DO x := Integers.Product(x, Integers.Long(i)); INC(i) END;
 | 
			
		||||
                Models.BeginScript(c.text, "computation", s);
 | 
			
		||||
                c.text.Delete(beg, end);
 | 
			
		||||
                w := c.text.NewWriter(NIL); w.SetPos(beg); w.SetAttr(attr);
 | 
			
		||||
                Write(w, x);
 | 
			
		||||
                Models.EndScript(c.text, s)
 | 
			
		||||
            END
 | 
			
		||||
        END
 | 
			
		||||
    END
 | 
			
		||||
END Compute;
 | 
			
		||||
 | 
			
		||||
END ObxFact.
 | 
			
		||||
							
								
								
									
										46
									
								
								samples/Isabelle/HelloWorld.thy
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								samples/Isabelle/HelloWorld.thy
									
									
									
									
									
										Normal file
									
								
							@@ -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 \<equiv> ''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 "\<dots> = [l] @ rev (rev ls)" by simp
 | 
			
		||||
    finally show "rev (rev (l#ls)) = l#ls" using IH by simp
 | 
			
		||||
  qed
 | 
			
		||||
 | 
			
		||||
corollary "\<forall>(l::string). rev (rev l) = l" by(fastforce intro: rev_rev_ident)
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										24
									
								
								samples/JavaScript/helloHanaEndpoint.xsjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								samples/JavaScript/helloHanaEndpoint.xsjs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
/*
 | 
			
		||||
 invoke endpoint by calling in a browser:
 | 
			
		||||
 http://<hanaserveradress>:<xsengineport(usually 8000)>/<path>/<to>/<endpoint>/helloHanaMath.xsjslib?x=4&y=2
 | 
			
		||||
 e.g.:
 | 
			
		||||
 http://192.168.178.20:8000/geekflyer/linguist/helloHanaEndpoint.xsjs?x=4&y=2
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
var hanaMath = $.import("./helloHanaMath.xsjslib");
 | 
			
		||||
 | 
			
		||||
var x = parseFloat($.request.parameters.get("x"));
 | 
			
		||||
var y = parseFloat($.request.parameters.get("y"));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
var result = hanaMath.multiply(x, y);
 | 
			
		||||
 | 
			
		||||
var output = {
 | 
			
		||||
    title: "Hello HANA XS - do some simple math",
 | 
			
		||||
    input: {x: x, y: y},
 | 
			
		||||
    result: result
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
$.response.contentType = "application/json";
 | 
			
		||||
$.response.statusCode = $.net.http.OK;
 | 
			
		||||
$.response.setBody(JSON.stringify(output));
 | 
			
		||||
							
								
								
									
										9
									
								
								samples/JavaScript/helloHanaMath.xsjslib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								samples/JavaScript/helloHanaMath.xsjslib
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
/* simple hana xs demo library, which can be used by multiple endpoints */
 | 
			
		||||
 | 
			
		||||
function multiply(x, y) {
 | 
			
		||||
    return x * y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function add(x, y) {
 | 
			
		||||
    return x + y;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										232
									
								
								samples/Mathematica/MiscCalculations.nb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										232
									
								
								samples/Mathematica/MiscCalculations.nb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,232 @@
 | 
			
		||||
(* Content-type: application/vnd.wolfram.mathematica *)
 | 
			
		||||
 | 
			
		||||
(*** Wolfram Notebook File ***)
 | 
			
		||||
(* http://www.wolfram.com/nb *)
 | 
			
		||||
 | 
			
		||||
(* CreatedBy='Mathematica 9.0' *)
 | 
			
		||||
 | 
			
		||||
(*CacheID: 234*)
 | 
			
		||||
(* Internal cache information:
 | 
			
		||||
NotebookFileLineBreakTest
 | 
			
		||||
NotebookFileLineBreakTest
 | 
			
		||||
NotebookDataPosition[       157,          7]
 | 
			
		||||
NotebookDataLength[      7164,        223]
 | 
			
		||||
NotebookOptionsPosition[      6163,        182]
 | 
			
		||||
NotebookOutlinePosition[      6508,        197]
 | 
			
		||||
CellTagsIndexPosition[      6465,        194]
 | 
			
		||||
WindowFrame->Normal*)
 | 
			
		||||
 | 
			
		||||
(* Beginning of Notebook Content *)
 | 
			
		||||
Notebook[{
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{
 | 
			
		||||
  RowBox[{"Solve", "[", 
 | 
			
		||||
   RowBox[{
 | 
			
		||||
    RowBox[{"y", "'"}], "\[Equal]", " ", "xy"}], "]"}], 
 | 
			
		||||
  "\[IndentingNewLine]"}]], "Input",
 | 
			
		||||
 CellChangeTimes->{{3.6112716342092056`*^9, 3.6112716549793935`*^9}}],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"{", 
 | 
			
		||||
  RowBox[{"{", 
 | 
			
		||||
   RowBox[{"xy", "\[Rule]", 
 | 
			
		||||
    SuperscriptBox["y", "\[Prime]",
 | 
			
		||||
     MultilineFunction->None]}], "}"}], "}"}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.6112716579295626`*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"Log", "[", 
 | 
			
		||||
  RowBox[{"Sin", "[", "38", "]"}], "]"}]], "Input",
 | 
			
		||||
 CellChangeTimes->{{3.611271663920905*^9, 3.6112716759275913`*^9}}],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"Log", "[", 
 | 
			
		||||
  RowBox[{"Sin", "[", "38", "]"}], "]"}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.611271678256725*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"N", "[", 
 | 
			
		||||
  RowBox[{"Log", "[", 
 | 
			
		||||
   RowBox[{"Sin", "[", "38", "]"}], "]"}], "]"}]], "Input",
 | 
			
		||||
 NumberMarks->False],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"-", "1.2161514009320473`"}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.611271682061942*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"Abs", "[", 
 | 
			
		||||
  RowBox[{"-", "1.2161514009320473`"}], "]"}]], "Input",
 | 
			
		||||
 NumberMarks->False],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData["1.2161514009320473`"], "Output",
 | 
			
		||||
 CellChangeTimes->{3.6112716842780695`*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"RealDigits", "[", "1.2161514009320473`", "]"}]], "Input",
 | 
			
		||||
 NumberMarks->False],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"{", 
 | 
			
		||||
  RowBox[{
 | 
			
		||||
   RowBox[{"{", 
 | 
			
		||||
    RowBox[{
 | 
			
		||||
    "1", ",", "2", ",", "1", ",", "6", ",", "1", ",", "5", ",", "1", ",", "4",
 | 
			
		||||
      ",", "0", ",", "0", ",", "9", ",", "3", ",", "2", ",", "0", ",", "4", 
 | 
			
		||||
     ",", "7"}], "}"}], ",", "1"}], "}"}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.611271685319129*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{
 | 
			
		||||
  RowBox[{"Graph", "[", 
 | 
			
		||||
   RowBox[{"Log", "[", "x", "]"}], "]"}], "\[IndentingNewLine]"}]], "Input",
 | 
			
		||||
 CellChangeTimes->{{3.611271689258354*^9, 3.611271702038085*^9}}],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{"Graph", "[", 
 | 
			
		||||
  RowBox[{"Log", "[", "x", "]"}], "]"}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.611271704295214*^9}]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[""], "Input",
 | 
			
		||||
 CellChangeTimes->{{3.611271712769699*^9, 3.6112717423153887`*^9}}],
 | 
			
		||||
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 RowBox[{
 | 
			
		||||
  RowBox[{"Plot", "[", 
 | 
			
		||||
   RowBox[{
 | 
			
		||||
    RowBox[{"Log", "[", "x", "]"}], ",", " ", 
 | 
			
		||||
    RowBox[{"{", 
 | 
			
		||||
     RowBox[{"x", ",", " ", "0", ",", " ", "10"}], "}"}]}], "]"}], 
 | 
			
		||||
  "\[IndentingNewLine]"}]], "Input",
 | 
			
		||||
 CellChangeTimes->{{3.6112717573482485`*^9, 3.6112717747822456`*^9}}],
 | 
			
		||||
 | 
			
		||||
Cell[BoxData[
 | 
			
		||||
 GraphicsBox[{{}, {}, 
 | 
			
		||||
   {Hue[0.67, 0.6, 0.6], LineBox[CompressedData["
 | 
			
		||||
1:eJwVzXs81Pkex/GZH7XlsutSQprwqxTSZVfJGp9P6UYqlyxHUhTaLrq4JpVK
 | 
			
		||||
0SHRisGWjYiEbHSvb+Q27rllmYwaY6JpwxgZTI7zx/vxejz/eht4H3PyoRgM
 | 
			
		||||
Rsj0/t+1MEPjP1Zc8O6L0tCYkJERTokxP5YLLR+MQy2qZWSzX62gWcaFn9s7
 | 
			
		||||
5sVFyohY4ZvLs5Ya6AheLQxnyIgFe4fllag6yH4zayhMcYw0FU5SRl8bweS/
 | 
			
		||||
wyVFa0aJBsz2VDVrAl8V299DGKPk1yWJllEHmqD42vuI4RopiRvJlYS9bYLZ
 | 
			
		||||
a2c4j3pJyS8JbT7eeW/By6ht44vkEXKuxtRu1d4WOB5QmStjSUhO0eMleTda
 | 
			
		||||
4EZtHmU5PEyaORsUFte1QFHRg6WjFcNkkZ/bC+11rVC0s8n9nf8wqVGINGNo
 | 
			
		||||
tkFRzD3HsYohosXu0misbAdxXml1VdQgKSi80nXErBNo/oP47aliMqAxEGvn
 | 
			
		||||
1QlVgoRvezzExCjYznppYifkn+K6CVli8peV8m2BrBNM20LljlmfyXVurK97
 | 
			
		||||
RRfcVCpPCXg8QIIF14a2eLyHn6Y4909//UTSlWsvqm/qge1fVjduzhISa/Zp
 | 
			
		||||
jwjPHvCM6ZD7BQgJz9/E/GtIDyRsSj3Svl5ItJtj+uru9cBdE2PXZH4vSeDY
 | 
			
		||||
20arfYAT6Z3e8axecnFxw49TXR/gU5X5vDu5H4kfvE0RnxSAsqvDMcduPmFk
 | 
			
		||||
jD7rihGA7RmZ5qlYPuEo6vFq7gigR67QPetXPqnm+rJy2wUA0hVVHindZOmu
 | 
			
		||||
yQwfy17Y4OU185n7e/LpoNH9bqYQPPrPvwn+2kkOXT/zqim+DzJ72WEzdrcT
 | 
			
		||||
SprBJ7l9UD/Fag2c005SXasZhWV9kH51Z/aqhjZSo6dpc3WkD4L1tqolbGgj
 | 
			
		||||
JndzqmzdRPD67PLxVrNWIn7e0lS28BMs6Ba9FM1pJv7CZYLign6IeWFYmrqk
 | 
			
		||||
jvR4/jOrlNsPoqNsieZftcS5I9qsvrcf8tnmIzq6tcSiVnRKqDsALqbKTVU/
 | 
			
		||||
1RCFoiw1ragBULG3LYphVhNOuIF1yN7PkFMpYVXI35BSTZ2UdWpfgMls07e/
 | 
			
		||||
84QoGUQa8S0GgVn/55MIdixUWyWsOLtpEAIiTazYlglw2e3W2gVOg5BMOVFO
 | 
			
		||||
zolAxT/ZsvvwIJAvj7SczqbC+Hex37ubgxD8udJ0tkcmfOa55DRSQ8DwsFzc
 | 
			
		||||
6lkIdRyjZa/rhsAywLBSze45xKnVGt/eJwFLB1UN7sVq8O7aRRTqRsFbq7Mr
 | 
			
		||||
JqcdTlREeh8zGoeOsKZ1bgF8KDqu4qxtK4c/T0q26boJ4PbpwwMrXRn4N9vd
 | 
			
		||||
qamzDy6kTzqOiJmo6OOuteZtPzBaevBFmALy6nNqfwkTw5JA39BdxjPwSH3B
 | 
			
		||||
vlWGX6FXmvyb8suZeCtkhRV5NAh2wkNnrp+YhaOXrkQMdg/Bjt54ExZLCdti
 | 
			
		||||
v+y2+XcYBt54R1TnKyOH4R+txpOAmXr7Apu9quiaByGbG0dACaRePMmPmLmw
 | 
			
		||||
vX84Swpbvrh/M3RRQziRFnP5wih0lB1gupuqY0FCbZyewzcoiS731JeqY4Zj
 | 
			
		||||
3+qZP4yB74ygnoYGDcz5GOJ8uXwM9p88XaKSqonn9R26+EdlsMLPpMHeaw4K
 | 
			
		||||
rc1neaqOQ6OGqXLQurmYKexKyno4Ds8LLqSZKmhhhvxW6cjWCTjNNHaoe6+F
 | 
			
		||||
pidKHHi9E6DEC9vqXzwPGaH7eO6hkyDMNkhMD9fGsUD+Knv5JCQu1VF86qKD
 | 
			
		||||
h3vll15HyyE+1bfKS18XbTje/KqZ38E9cU+DikgXNYxUk++f/Q5jG7Nk6a/m
 | 
			
		||||
49yHih6fJ7+DQLghtCxKD9We/pFtf2wKMtir5td7LcDHFdUyrmgK8i8Fqfst
 | 
			
		||||
Z2H5rdC2ZGMGRrns36YgZWHfc/sj7Z4MNOfdzo2qX4jaWiITpSQGcpal5ddv
 | 
			
		||||
08c4nrYPVjPw3OurnG1P9ZGdfship5yB2+e7ZNUsMsAzD/MLtFcycb1/1W71
 | 
			
		||||
Kwb4qn7LsIcnE9P1vBfVSQ1QUbd5z75rTFz05m7Sjt2GeHJ9UIrOCybGLy8z
 | 
			
		||||
bn5liLETFcsURUz0lSi+5RrTGL/GlX1jDoXeRcP6V67R6DRvQNHcmsIjF5wn
 | 
			
		||||
7RJoPPVD0ph42kHOxe9U/qDR/97LrjtAYbQ0KC4+iUa6N+b4nPUUFqyTTSTf
 | 
			
		||||
pDFTFtw6bEOhrHSqPTuPRo1786Pv21IY36xytbyKxo0v5z7UdKEwNfPowctc
 | 
			
		||||
GuUeojTutDMDG2y21tIYpHQ98NxvFD7Sih+vbaBRfeZZ6YArhTx3zYMtbTRC
 | 
			
		||||
CmNNqTuFRgIdm48CGveGmxUf2kfhyuIw1h0hjasPiNIWelFoealL5iOiMZKf
 | 
			
		||||
HdA6bXujmw/6B2gk7zZK2PspPHlYnzU0RGN40raf1XwpDLc6L/tbMv0vikor
 | 
			
		||||
n/Yl1Y+tgVIayzZ/kIT6UcgpzIwZG6Px0d7RwA8HKcyIUPR7Nk7j8sLHN2/8
 | 
			
		||||
TmGeo8+G8Ekab1ncfmR7iMJiw8oF1t9pnF9RQuTTfiVZIpuaonFCb+xJ0WEK
 | 
			
		||||
/wc13qzo
 | 
			
		||||
     "]]}},
 | 
			
		||||
  AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948],
 | 
			
		||||
  Axes->True,
 | 
			
		||||
  AxesLabel->{None, None},
 | 
			
		||||
  AxesOrigin->{0, 0},
 | 
			
		||||
  Method->{},
 | 
			
		||||
  PlotRange->{{0, 10}, {-1.623796532045525, 2.3025850725858823`}},
 | 
			
		||||
  PlotRangeClipping->True,
 | 
			
		||||
  PlotRangePadding->{
 | 
			
		||||
    Scaled[0.02], 
 | 
			
		||||
    Scaled[0.02]}]], "Output",
 | 
			
		||||
 CellChangeTimes->{3.6112717778594217`*^9}]
 | 
			
		||||
}, Open  ]]
 | 
			
		||||
},
 | 
			
		||||
WindowSize->{716, 833},
 | 
			
		||||
WindowMargins->{{Automatic, 214}, {Automatic, 26}},
 | 
			
		||||
FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (January 25, 2013)",
 | 
			
		||||
StyleDefinitions->"Default.nb"
 | 
			
		||||
]
 | 
			
		||||
(* End of Notebook Content *)
 | 
			
		||||
 | 
			
		||||
(* Internal cache information *)
 | 
			
		||||
(*CellTagsOutline
 | 
			
		||||
CellTagsIndex->{}
 | 
			
		||||
*)
 | 
			
		||||
(*CellTagsIndex
 | 
			
		||||
CellTagsIndex->{}
 | 
			
		||||
*)
 | 
			
		||||
(*NotebookFileOutline
 | 
			
		||||
Notebook[{
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[579, 22, 224, 6, 52, "Input"],
 | 
			
		||||
Cell[806, 30, 211, 6, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[1054, 41, 155, 3, 31, "Input"],
 | 
			
		||||
Cell[1212, 46, 130, 3, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[1379, 54, 137, 4, 31, "Input"],
 | 
			
		||||
Cell[1519, 60, 105, 2, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[1661, 67, 113, 3, 31, "Input"],
 | 
			
		||||
Cell[1777, 72, 90, 1, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[1904, 78, 102, 2, 31, "Input"],
 | 
			
		||||
Cell[2009, 82, 321, 8, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[2367, 95, 191, 4, 52, "Input"],
 | 
			
		||||
Cell[2561, 101, 131, 3, 31, "Output"]
 | 
			
		||||
}, Open  ]],
 | 
			
		||||
Cell[2707, 107, 94, 1, 31, "Input"],
 | 
			
		||||
Cell[CellGroupData[{
 | 
			
		||||
Cell[2826, 112, 299, 8, 52, "Input"],
 | 
			
		||||
Cell[3128, 122, 3019, 57, 265, "Output"]
 | 
			
		||||
}, Open  ]]
 | 
			
		||||
}
 | 
			
		||||
]
 | 
			
		||||
*)
 | 
			
		||||
 | 
			
		||||
(* End of internal cache information *)
 | 
			
		||||
							
								
								
									
										3666
									
								
								samples/Mathematica/MiscCalculations2.nb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3666
									
								
								samples/Mathematica/MiscCalculations2.nb
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										8
									
								
								samples/Mathematica/Problem12.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								samples/Mathematica/Problem12.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
(* ::Package:: *)
 | 
			
		||||
 | 
			
		||||
(* Problem12.m *)
 | 
			
		||||
(* Author: William Woodruff *)
 | 
			
		||||
(* Problem: What is the value of the first triangle number to have over five hundred divisors? *)
 | 
			
		||||
 | 
			
		||||
Do[If[Length[Divisors[Binomial[i + 1, 2]]] > 500, 
 | 
			
		||||
  Print[Binomial[i + 1, 2]]; Break[]], {i, 1000000}]
 | 
			
		||||
							
								
								
									
										80
									
								
								samples/Nix/nginx.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								samples/Nix/nginx.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,80 @@
 | 
			
		||||
{ stdenv, fetchurl, fetchgit, openssl, zlib, pcre, libxml2, libxslt, expat
 | 
			
		||||
, rtmp ? false
 | 
			
		||||
, fullWebDAV ? false
 | 
			
		||||
, syslog ? false
 | 
			
		||||
, moreheaders ? false, ...}:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  version = "1.4.4";
 | 
			
		||||
  mainSrc = fetchurl {
 | 
			
		||||
    url = "http://nginx.org/download/nginx-${version}.tar.gz";
 | 
			
		||||
    sha256 = "1f82845mpgmhvm151fhn2cnqjggw9w7cvsqbva9rb320wmc9m63w";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  rtmp-ext = fetchgit {
 | 
			
		||||
    url = git://github.com/arut/nginx-rtmp-module.git;
 | 
			
		||||
    rev = "1cfb7aeb582789f3b15a03da5b662d1811e2a3f1";
 | 
			
		||||
    sha256 = "03ikfd2l8mzsjwx896l07rdrw5jn7jjfdiyl572yb9jfrnk48fwi";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  dav-ext = fetchgit {
 | 
			
		||||
    url = git://github.com/arut/nginx-dav-ext-module.git;
 | 
			
		||||
    rev = "54cebc1f21fc13391aae692c6cce672fa7986f9d";
 | 
			
		||||
    sha256 = "1dvpq1fg5rslnl05z8jc39sgnvh3akam9qxfl033akpczq1bh8nq";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  syslog-ext = fetchgit {
 | 
			
		||||
    url = https://github.com/yaoweibin/nginx_syslog_patch.git;
 | 
			
		||||
    rev = "165affd9741f0e30c4c8225da5e487d33832aca3";
 | 
			
		||||
    sha256 = "14dkkafjnbapp6jnvrjg9ip46j00cr8pqc2g7374z9aj7hrvdvhs";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  moreheaders-ext = fetchgit {
 | 
			
		||||
    url = https://github.com/agentzh/headers-more-nginx-module.git;
 | 
			
		||||
    rev = "refs/tags/v0.23";
 | 
			
		||||
    sha256 = "12pbjgsxnvcf2ff2i2qdn39q4cm5czlgrng96j8ml4cgxvnbdh39";
 | 
			
		||||
  };
 | 
			
		||||
in
 | 
			
		||||
 | 
			
		||||
stdenv.mkDerivation rec {
 | 
			
		||||
  name = "nginx-${version}";
 | 
			
		||||
  src = mainSrc;
 | 
			
		||||
 | 
			
		||||
  buildInputs = [ openssl zlib pcre libxml2 libxslt
 | 
			
		||||
    ] ++ stdenv.lib.optional fullWebDAV expat;
 | 
			
		||||
 | 
			
		||||
  patches = if syslog then [ "${syslog-ext}/syslog_1.4.0.patch" ] else [];
 | 
			
		||||
 | 
			
		||||
  configureFlags = [
 | 
			
		||||
    "--with-http_ssl_module"
 | 
			
		||||
    "--with-http_spdy_module"
 | 
			
		||||
    "--with-http_xslt_module"
 | 
			
		||||
    "--with-http_sub_module"
 | 
			
		||||
    "--with-http_dav_module"
 | 
			
		||||
    "--with-http_gzip_static_module"
 | 
			
		||||
    "--with-http_secure_link_module"
 | 
			
		||||
    "--with-ipv6"
 | 
			
		||||
    # Install destination problems
 | 
			
		||||
    # "--with-http_perl_module"
 | 
			
		||||
  ] ++ stdenv.lib.optional rtmp "--add-module=${rtmp-ext}"
 | 
			
		||||
    ++ stdenv.lib.optional fullWebDAV "--add-module=${dav-ext}"
 | 
			
		||||
    ++ stdenv.lib.optional syslog "--add-module=${syslog-ext}"
 | 
			
		||||
    ++ stdenv.lib.optional moreheaders "--add-module=${moreheaders-ext}";
 | 
			
		||||
 | 
			
		||||
  preConfigure = ''
 | 
			
		||||
    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2 }/include/libxml2"
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  # escape example
 | 
			
		||||
  postInstall = ''
 | 
			
		||||
    mv $out/sbin $out/bin ''' ''${
 | 
			
		||||
   ${ if true then ${ "" } else false }
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  meta = {
 | 
			
		||||
    description = "A reverse proxy and lightweight webserver";
 | 
			
		||||
    maintainers = [ stdenv.lib.maintainers.raskin];
 | 
			
		||||
    platforms = stdenv.lib.platforms.all;
 | 
			
		||||
    inherit version;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								samples/Pike/Error.pmod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								samples/Pike/Error.pmod
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
#pike __REAL_VERSION__
 | 
			
		||||
 | 
			
		||||
constant Generic = __builtin.GenericError;
 | 
			
		||||
 | 
			
		||||
constant Index = __builtin.IndexError;
 | 
			
		||||
 | 
			
		||||
constant BadArgument = __builtin.BadArgumentError;
 | 
			
		||||
 | 
			
		||||
constant Math = __builtin.MathError;
 | 
			
		||||
 | 
			
		||||
constant Resource = __builtin.ResourceError;
 | 
			
		||||
 | 
			
		||||
constant Permission = __builtin.PermissionError;
 | 
			
		||||
 | 
			
		||||
constant Decode = __builtin.DecodeError;
 | 
			
		||||
 | 
			
		||||
constant Cpp = __builtin.CppError;
 | 
			
		||||
 | 
			
		||||
constant Compilation = __builtin.CompilationError;
 | 
			
		||||
 | 
			
		||||
constant MasterLoad = __builtin.MasterLoadError;
 | 
			
		||||
 | 
			
		||||
constant ModuleLoad = __builtin.ModuleLoadError;
 | 
			
		||||
 | 
			
		||||
//! Returns an Error object for any argument it receives. If the
 | 
			
		||||
//! argument already is an Error object or is empty, it does nothing.
 | 
			
		||||
object mkerror(mixed error)
 | 
			
		||||
{
 | 
			
		||||
  if (error == UNDEFINED)
 | 
			
		||||
    return error;
 | 
			
		||||
  if (objectp(error) && error->is_generic_error)
 | 
			
		||||
    return error;
 | 
			
		||||
  if (arrayp(error))
 | 
			
		||||
    return Error.Generic(@error);
 | 
			
		||||
  if (stringp(error))
 | 
			
		||||
    return Error.Generic(error);
 | 
			
		||||
  return Error.Generic(sprintf("%O", error));
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										360
									
								
								samples/Pike/FakeFile.pike
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										360
									
								
								samples/Pike/FakeFile.pike
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,360 @@
 | 
			
		||||
#pike __REAL_VERSION__
 | 
			
		||||
 | 
			
		||||
//! A string wrapper that pretends to be a @[Stdio.File] object
 | 
			
		||||
//! in addition to some features of a @[Stdio.FILE] object.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//! This constant can be used to distinguish a FakeFile object
 | 
			
		||||
//! from a real @[Stdio.File] object.
 | 
			
		||||
constant is_fake_file = 1;
 | 
			
		||||
 | 
			
		||||
protected string data;
 | 
			
		||||
protected int ptr;
 | 
			
		||||
protected int(0..1) r;
 | 
			
		||||
protected int(0..1) w;
 | 
			
		||||
protected int mtime;
 | 
			
		||||
 | 
			
		||||
protected function read_cb;
 | 
			
		||||
protected function read_oob_cb;
 | 
			
		||||
protected function write_cb;
 | 
			
		||||
protected function write_oob_cb;
 | 
			
		||||
protected function close_cb;
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->close()]
 | 
			
		||||
int close(void|string direction) {
 | 
			
		||||
  direction = lower_case(direction||"rw");
 | 
			
		||||
  int cr = has_value(direction, "r");
 | 
			
		||||
  int cw = has_value(direction, "w");
 | 
			
		||||
 | 
			
		||||
  if(cr) {
 | 
			
		||||
    r = 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(cw) {
 | 
			
		||||
    w = 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // FIXME: Close callback
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @decl void create(string data, void|string type, void|int pointer)
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->create()]
 | 
			
		||||
void create(string _data, void|string type, int|void _ptr) {
 | 
			
		||||
  if(!_data) error("No data string given to FakeFile.\n");
 | 
			
		||||
  data = _data;
 | 
			
		||||
  ptr = _ptr;
 | 
			
		||||
  mtime = time();
 | 
			
		||||
  if(type) {
 | 
			
		||||
    type = lower_case(type);
 | 
			
		||||
    if(has_value(type, "r"))
 | 
			
		||||
      r = 1;
 | 
			
		||||
    if(has_value(type, "w"))
 | 
			
		||||
      w = 1;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    r = w = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
protected string make_type_str() {
 | 
			
		||||
  string type = "";
 | 
			
		||||
  if(r) type += "r";
 | 
			
		||||
  if(w) type += "w";
 | 
			
		||||
  return type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->dup()]
 | 
			
		||||
this_program dup() {
 | 
			
		||||
  return this_program(data, make_type_str(), ptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Always returns 0.
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->errno()]
 | 
			
		||||
int errno() { return 0; }
 | 
			
		||||
 | 
			
		||||
//! Returns size and the creation time of the string.
 | 
			
		||||
Stdio.Stat stat() {
 | 
			
		||||
  Stdio.Stat st = Stdio.Stat();
 | 
			
		||||
  st->size = sizeof(data);
 | 
			
		||||
  st->mtime=st->ctime=mtime;
 | 
			
		||||
  st->atime=time();
 | 
			
		||||
  return st;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->line_iterator()]
 | 
			
		||||
String.SplitIterator line_iterator(int|void trim) {
 | 
			
		||||
  if(trim)
 | 
			
		||||
    return String.SplitIterator( data-"\r", '\n' );
 | 
			
		||||
  return String.SplitIterator( data, '\n' );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
protected mixed id;
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_id()]
 | 
			
		||||
mixed query_id() { return id; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_id()]
 | 
			
		||||
void set_id(mixed _id) { id = _id; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->read_function()]
 | 
			
		||||
function(:string) read_function(int nbytes) {
 | 
			
		||||
  return lambda() { return read(nbytes); };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->peek()]
 | 
			
		||||
int(-1..1) peek(int|float|void timeout) {
 | 
			
		||||
  if(!r) return -1;
 | 
			
		||||
  if(ptr >= sizeof(data)) return 0;
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Always returns 0.
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_address()]
 | 
			
		||||
string query_address(void|int(0..1) is_local) { return 0; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->read()]
 | 
			
		||||
string read(void|int(0..) len, void|int(0..1) not_all) {
 | 
			
		||||
  if(!r) return 0;
 | 
			
		||||
  if (len < 0) error("Cannot read negative number of characters.\n");
 | 
			
		||||
  int start=ptr;
 | 
			
		||||
  ptr += len;
 | 
			
		||||
  if(zero_type(len) || ptr>sizeof(data))
 | 
			
		||||
    ptr = sizeof(data);
 | 
			
		||||
 | 
			
		||||
  // FIXME: read callback
 | 
			
		||||
  return data[start..ptr-1];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.FILE()->gets()]
 | 
			
		||||
string gets() {
 | 
			
		||||
  if(!r) return 0;
 | 
			
		||||
  string ret;
 | 
			
		||||
  sscanf(data,"%*"+(string)ptr+"s%[^\n]",ret);
 | 
			
		||||
  if(ret)
 | 
			
		||||
  {
 | 
			
		||||
    ptr+=sizeof(ret)+1;
 | 
			
		||||
    if(ptr>sizeof(data))
 | 
			
		||||
    {
 | 
			
		||||
      ptr=sizeof(data);
 | 
			
		||||
      if(!sizeof(ret))
 | 
			
		||||
	ret = 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // FIXME: read callback
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.FILE()->getchar()]
 | 
			
		||||
int getchar() {
 | 
			
		||||
  if(!r) return 0;
 | 
			
		||||
  int c;
 | 
			
		||||
  if(catch(c=data[ptr]))
 | 
			
		||||
    c=-1;
 | 
			
		||||
  else
 | 
			
		||||
    ptr++;
 | 
			
		||||
 | 
			
		||||
  // FIXME: read callback
 | 
			
		||||
  return c;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.FILE()->unread()]
 | 
			
		||||
void unread(string s) {
 | 
			
		||||
  if(!r) return;
 | 
			
		||||
  if(data[ptr-sizeof(s)..ptr-1]==s)
 | 
			
		||||
    ptr-=sizeof(s);
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    data=s+data[ptr..];
 | 
			
		||||
    ptr=0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->seek()]
 | 
			
		||||
int seek(int pos, void|int mult, void|int add) {
 | 
			
		||||
  if(mult)
 | 
			
		||||
    pos = pos*mult+add;
 | 
			
		||||
  if(pos<0)
 | 
			
		||||
  {
 | 
			
		||||
    pos = sizeof(data)+pos;
 | 
			
		||||
    if( pos < 0 )
 | 
			
		||||
	pos = 0;
 | 
			
		||||
  }
 | 
			
		||||
  ptr = pos;
 | 
			
		||||
  if( ptr > strlen( data ) )
 | 
			
		||||
      ptr = strlen(data);
 | 
			
		||||
  return ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Always returns 1.
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->sync()]
 | 
			
		||||
int(1..1) sync() { return 1; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->tell()]
 | 
			
		||||
int tell() { return ptr; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->truncate()]
 | 
			
		||||
int(0..1) truncate(int length) {
 | 
			
		||||
  data = data[..length-1];
 | 
			
		||||
  return sizeof(data)==length;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->write()]
 | 
			
		||||
int(-1..) write(string|array(string) str, mixed ... extra) {
 | 
			
		||||
  if(!w) return -1;
 | 
			
		||||
  if(arrayp(str)) str=str*"";
 | 
			
		||||
  if(sizeof(extra)) str=sprintf(str, @extra);
 | 
			
		||||
 | 
			
		||||
  if(ptr==sizeof(data)) {
 | 
			
		||||
    data += str;
 | 
			
		||||
    ptr = sizeof(data);
 | 
			
		||||
  }
 | 
			
		||||
  else if(sizeof(str)==1)
 | 
			
		||||
    data[ptr++] = str[0];
 | 
			
		||||
  else {
 | 
			
		||||
    data = data[..ptr-1] + str + data[ptr+sizeof(str)..];
 | 
			
		||||
    ptr += sizeof(str);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // FIXME: write callback
 | 
			
		||||
  return sizeof(str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_blocking]
 | 
			
		||||
void set_blocking() {
 | 
			
		||||
  close_cb = 0;
 | 
			
		||||
  read_cb = 0;
 | 
			
		||||
  read_oob_cb = 0;
 | 
			
		||||
  write_cb = 0;
 | 
			
		||||
  write_oob_cb = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_blocking_keep_callbacks]
 | 
			
		||||
void set_blocking_keep_callbacks() { }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_blocking]
 | 
			
		||||
void set_nonblocking(function rcb, function wcb, function ccb,
 | 
			
		||||
		     function rocb, function wocb) {
 | 
			
		||||
  read_cb = rcb;
 | 
			
		||||
  write_cb = wcb;
 | 
			
		||||
  close_cb = ccb;
 | 
			
		||||
  read_oob_cb = rocb;
 | 
			
		||||
  write_oob_cb = wocb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_blocking_keep_callbacks]
 | 
			
		||||
void set_nonblocking_keep_callbacks() { }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_close_callback]
 | 
			
		||||
void set_close_callback(function cb) { close_cb = cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_read_callback]
 | 
			
		||||
void set_read_callback(function cb) { read_cb = cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_read_oob_callback]
 | 
			
		||||
void set_read_oob_callback(function cb) { read_oob_cb = cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_write_callback]
 | 
			
		||||
void set_write_callback(function cb) { write_cb = cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->set_write_oob_callback]
 | 
			
		||||
void set_write_oob_callback(function cb) { write_oob_cb = cb; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_close_callback]
 | 
			
		||||
function query_close_callback() { return close_cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_read_callback]
 | 
			
		||||
function query_read_callback() { return read_cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_read_oob_callback]
 | 
			
		||||
function query_read_oob_callback() { return read_oob_cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_write_callback]
 | 
			
		||||
function query_write_callback() { return write_cb; }
 | 
			
		||||
 | 
			
		||||
//! @seealso
 | 
			
		||||
//!   @[Stdio.File()->query_write_oob_callback]
 | 
			
		||||
function query_write_oob_callback() { return write_oob_cb; }
 | 
			
		||||
 | 
			
		||||
string _sprintf(int t) {
 | 
			
		||||
  return t=='O' && sprintf("%O(%d,%O)", this_program, sizeof(data),
 | 
			
		||||
			   make_type_str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// FakeFile specials.
 | 
			
		||||
 | 
			
		||||
//! A FakeFile can be casted to a string.
 | 
			
		||||
mixed cast(string to) {
 | 
			
		||||
  switch(to) {
 | 
			
		||||
  case "string": return data;
 | 
			
		||||
  case "object": return this;
 | 
			
		||||
  }
 | 
			
		||||
  error("Can not cast object to %O.\n", to);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Sizeof on a FakeFile returns the size of its contents.
 | 
			
		||||
int(0..) _sizeof() {
 | 
			
		||||
  return sizeof(data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! @ignore
 | 
			
		||||
 | 
			
		||||
#define NOPE(X) mixed X (mixed ... args) { error("This is a FakeFile. %s is not available.\n", #X); }
 | 
			
		||||
NOPE(assign);
 | 
			
		||||
NOPE(async_connect);
 | 
			
		||||
NOPE(connect);
 | 
			
		||||
NOPE(connect_unix);
 | 
			
		||||
NOPE(open);
 | 
			
		||||
NOPE(open_socket);
 | 
			
		||||
NOPE(pipe);
 | 
			
		||||
NOPE(tcgetattr);
 | 
			
		||||
NOPE(tcsetattr);
 | 
			
		||||
 | 
			
		||||
// Stdio.Fd
 | 
			
		||||
NOPE(dup2);
 | 
			
		||||
NOPE(lock); // We could implement this
 | 
			
		||||
NOPE(mode); // We could implement this
 | 
			
		||||
NOPE(proxy); // We could implement this
 | 
			
		||||
NOPE(query_fd);
 | 
			
		||||
NOPE(read_oob);
 | 
			
		||||
NOPE(set_close_on_exec);
 | 
			
		||||
NOPE(set_keepalive);
 | 
			
		||||
NOPE(trylock); // We could implement this
 | 
			
		||||
NOPE(write_oob);
 | 
			
		||||
 | 
			
		||||
//! @endignore
 | 
			
		||||
							
								
								
									
										260
									
								
								samples/Prolog/format_spec.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								samples/Prolog/format_spec.pl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,260 @@
 | 
			
		||||
:- module(format_spec, [ format_error/2
 | 
			
		||||
                       , format_spec/2
 | 
			
		||||
                       , format_spec//1
 | 
			
		||||
                       , spec_arity/2
 | 
			
		||||
                       , spec_types/2
 | 
			
		||||
                       ]).
 | 
			
		||||
 | 
			
		||||
:- use_module(library(dcg/basics), [eos//0, integer//1, string_without//2]).
 | 
			
		||||
:- use_module(library(error)).
 | 
			
		||||
:- use_module(library(when), [when/2]).
 | 
			
		||||
 | 
			
		||||
% TODO loading this module is optional
 | 
			
		||||
% TODO it's for my own convenience during development
 | 
			
		||||
%:- use_module(library(mavis)).
 | 
			
		||||
 | 
			
		||||
%% format_error(+Goal, -Error:string) is nondet.
 | 
			
		||||
%
 | 
			
		||||
%  True if Goal exhibits an Error in its format string. The
 | 
			
		||||
%  Error string describes what is wrong with Goal. Iterates each
 | 
			
		||||
%  error on backtracking.
 | 
			
		||||
%
 | 
			
		||||
%  Goal may be one of the following predicates:
 | 
			
		||||
%
 | 
			
		||||
%    * format/2
 | 
			
		||||
%    * format/3
 | 
			
		||||
%    * debug/3
 | 
			
		||||
format_error(format(Format,Args), Error) :-
 | 
			
		||||
    format_error_(Format, Args,Error).
 | 
			
		||||
format_error(format(_,Format,Args), Error) :-
 | 
			
		||||
    format_error_(Format,Args,Error).
 | 
			
		||||
format_error(debug(_,Format,Args), Error) :-
 | 
			
		||||
    format_error_(Format,Args,Error).
 | 
			
		||||
 | 
			
		||||
format_error_(Format,Args,Error) :-
 | 
			
		||||
    format_spec(Format, Spec),
 | 
			
		||||
    !,
 | 
			
		||||
    is_list(Args),
 | 
			
		||||
    spec_types(Spec, Types),
 | 
			
		||||
    types_error(Args, Types, Error).
 | 
			
		||||
format_error_(Format,_,Error) :-
 | 
			
		||||
    % \+ format_spec(Format, _),
 | 
			
		||||
    format(string(Error), "Invalid format string: ~q", [Format]).
 | 
			
		||||
 | 
			
		||||
types_error(Args, Types, Error) :-
 | 
			
		||||
    length(Types, TypesLen),
 | 
			
		||||
    length(Args, ArgsLen),
 | 
			
		||||
    TypesLen =\= ArgsLen,
 | 
			
		||||
    !,
 | 
			
		||||
    format( string(Error)
 | 
			
		||||
          , "Wrong argument count. Expected ~d, got ~d"
 | 
			
		||||
          , [TypesLen, ArgsLen]
 | 
			
		||||
          ).
 | 
			
		||||
types_error(Args, Types, Error) :-
 | 
			
		||||
    types_error_(Args, Types, Error).
 | 
			
		||||
 | 
			
		||||
types_error_([Arg|_],[Type|_],Error) :-
 | 
			
		||||
    ground(Arg),
 | 
			
		||||
    \+ is_of_type(Type,Arg),
 | 
			
		||||
    message_to_string(error(type_error(Type,Arg),_Location),Error).
 | 
			
		||||
types_error_([_|Args],[_|Types],Error) :-
 | 
			
		||||
    types_error_(Args, Types, Error).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% check/0 augmentation
 | 
			
		||||
:- multifile check:checker/2.
 | 
			
		||||
:- dynamic check:checker/2.
 | 
			
		||||
check:checker(format_spec:checker, "format/2 strings and arguments").
 | 
			
		||||
 | 
			
		||||
:- dynamic format_fail/3.
 | 
			
		||||
 | 
			
		||||
checker :-
 | 
			
		||||
    prolog_walk_code([ module_class([user])
 | 
			
		||||
                     , infer_meta_predicates(false)
 | 
			
		||||
                     , autoload(false)  % format/{2,3} are always loaded
 | 
			
		||||
                     , undefined(ignore)
 | 
			
		||||
                     , trace_reference(_)
 | 
			
		||||
                     , on_trace(check_format)
 | 
			
		||||
                     ]),
 | 
			
		||||
    retract(format_fail(Goal,Location,Error)),
 | 
			
		||||
    print_message(warning, format_error(Goal,Location,Error)),
 | 
			
		||||
    fail.  % iterate all errors
 | 
			
		||||
checker.  % succeed even if no errors are found
 | 
			
		||||
 | 
			
		||||
check_format(Module:Goal, _Caller, Location) :-
 | 
			
		||||
    predicate_property(Module:Goal, imported_from(Source)),
 | 
			
		||||
    memberchk(Source, [system,prolog_debug]),
 | 
			
		||||
    can_check(Goal),
 | 
			
		||||
    format_error(Goal, Error),
 | 
			
		||||
    assert(format_fail(Goal, Location, Error)),
 | 
			
		||||
    fail.
 | 
			
		||||
check_format(_,_,_).  % succeed to avoid printing goals
 | 
			
		||||
 | 
			
		||||
% true if format_error/2 can check this goal
 | 
			
		||||
can_check(Goal) :-
 | 
			
		||||
    once(clause(format_error(Goal,_),_)).
 | 
			
		||||
 | 
			
		||||
prolog:message(format_error(Goal,Location,Error)) -->
 | 
			
		||||
    prolog:message_location(Location),
 | 
			
		||||
    ['~n    In goal: ~q~n    ~s'-[Goal,Error]].
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%% format_spec(-Spec)//
 | 
			
		||||
%
 | 
			
		||||
%  DCG for parsing format strings. It doesn't yet generate format
 | 
			
		||||
%  strings from a spec.  See format_spec/2 for details.
 | 
			
		||||
format_spec([]) -->
 | 
			
		||||
    eos.
 | 
			
		||||
format_spec([escape(Numeric,Modifier,Action)|Rest]) -->
 | 
			
		||||
    "~",
 | 
			
		||||
    numeric_argument(Numeric),
 | 
			
		||||
    modifier_argument(Modifier),
 | 
			
		||||
    action(Action),
 | 
			
		||||
    format_spec(Rest).
 | 
			
		||||
format_spec([text(String)|Rest]) -->
 | 
			
		||||
    { when((ground(String);ground(Codes)),string_codes(String, Codes)) },
 | 
			
		||||
    string_without("~", Codes),
 | 
			
		||||
    { Codes \= [] },
 | 
			
		||||
    format_spec(Rest).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%% format_spec(+Format, -Spec:list) is semidet.
 | 
			
		||||
%
 | 
			
		||||
%  Parse a format string.  Each element of Spec is one of the following:
 | 
			
		||||
%
 | 
			
		||||
%    * `text(Text)` - text sent to the output as is
 | 
			
		||||
%    * `escape(Num,Colon,Action)` - a format escape
 | 
			
		||||
%
 | 
			
		||||
%  `Num` represents the optional numeric portion of an esape. `Colon`
 | 
			
		||||
%  represents the optional colon in an escape. `Action` is an atom
 | 
			
		||||
%  representing the action to be take by this escape.
 | 
			
		||||
format_spec(Format, Spec) :-
 | 
			
		||||
    when((ground(Format);ground(Codes)),text_codes(Format, Codes)),
 | 
			
		||||
    once(phrase(format_spec(Spec), Codes, [])).
 | 
			
		||||
 | 
			
		||||
%% spec_arity(+FormatSpec, -Arity:positive_integer) is det.
 | 
			
		||||
%
 | 
			
		||||
%  True if FormatSpec requires format/2 to have Arity arguments.
 | 
			
		||||
spec_arity(Spec, Arity) :-
 | 
			
		||||
    spec_types(Spec, Types),
 | 
			
		||||
    length(Types, Arity).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%% spec_types(+FormatSpec, -Types:list(type)) is det.
 | 
			
		||||
%
 | 
			
		||||
%  True if FormatSpec requires format/2 to have arguments of Types. Each
 | 
			
		||||
%  value of Types is a type as described by error:has_type/2. This
 | 
			
		||||
%  notion of types is compatible with library(mavis).
 | 
			
		||||
spec_types(Spec, Types) :-
 | 
			
		||||
    phrase(spec_types(Spec), Types).
 | 
			
		||||
 | 
			
		||||
spec_types([]) -->
 | 
			
		||||
    [].
 | 
			
		||||
spec_types([Item|Items]) -->
 | 
			
		||||
    item_types(Item),
 | 
			
		||||
    spec_types(Items).
 | 
			
		||||
 | 
			
		||||
item_types(text(_)) -->
 | 
			
		||||
    [].
 | 
			
		||||
item_types(escape(Numeric,_,Action)) -->
 | 
			
		||||
    numeric_types(Numeric),
 | 
			
		||||
    action_types(Action).
 | 
			
		||||
 | 
			
		||||
numeric_types(number(_)) -->
 | 
			
		||||
    [].
 | 
			
		||||
numeric_types(character(_)) -->
 | 
			
		||||
    [].
 | 
			
		||||
numeric_types(star) -->
 | 
			
		||||
    [number].
 | 
			
		||||
numeric_types(nothing) -->
 | 
			
		||||
    [].
 | 
			
		||||
 | 
			
		||||
action_types(Action) -->
 | 
			
		||||
    { atom_codes(Action, [Code]) },
 | 
			
		||||
    { action_types(Code, Types) },
 | 
			
		||||
    phrase(Types).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%% text_codes(Text:text, Codes:codes).
 | 
			
		||||
text_codes(Var, Codes) :-
 | 
			
		||||
    var(Var),
 | 
			
		||||
    !,
 | 
			
		||||
    string_codes(Var, Codes).
 | 
			
		||||
text_codes(Atom, Codes) :-
 | 
			
		||||
    atom(Atom),
 | 
			
		||||
    !,
 | 
			
		||||
    atom_codes(Atom, Codes).
 | 
			
		||||
text_codes(String, Codes) :-
 | 
			
		||||
    string(String),
 | 
			
		||||
    !,
 | 
			
		||||
    string_codes(String, Codes).
 | 
			
		||||
text_codes(Codes, Codes) :-
 | 
			
		||||
    is_of_type(codes, Codes).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
numeric_argument(number(N)) -->
 | 
			
		||||
    integer(N).
 | 
			
		||||
numeric_argument(character(C)) -->
 | 
			
		||||
    "`",
 | 
			
		||||
    [C].
 | 
			
		||||
numeric_argument(star) -->
 | 
			
		||||
    "*".
 | 
			
		||||
numeric_argument(nothing) -->
 | 
			
		||||
    "".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
modifier_argument(colon) -->
 | 
			
		||||
    ":".
 | 
			
		||||
modifier_argument(no_colon) -->
 | 
			
		||||
    \+ ":".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
action(Action) -->
 | 
			
		||||
    [C],
 | 
			
		||||
    { is_action(C) },
 | 
			
		||||
    { atom_codes(Action, [C]) }.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%% is_action(+Action:integer) is semidet.
 | 
			
		||||
%% is_action(-Action:integer) is multi.
 | 
			
		||||
%
 | 
			
		||||
%  True if Action is a valid format/2 action character. Iterates all
 | 
			
		||||
%  acceptable action characters, if Action is unbound.
 | 
			
		||||
is_action(Action) :-
 | 
			
		||||
    action_types(Action, _).
 | 
			
		||||
 | 
			
		||||
%% action_types(?Action:integer, ?Types:list(type))
 | 
			
		||||
%
 | 
			
		||||
%  True if Action consumes arguments matching Types. An action (like
 | 
			
		||||
%  `~`), which consumes no arguments, has `Types=[]`.  For example,
 | 
			
		||||
%
 | 
			
		||||
%      ?- action_types(0'~, Types).
 | 
			
		||||
%      Types = [].
 | 
			
		||||
%      ?- action_types(0'a, Types).
 | 
			
		||||
%      Types = [atom].
 | 
			
		||||
action_types(0'~, []).
 | 
			
		||||
action_types(0'a, [atom]).
 | 
			
		||||
action_types(0'c, [integer]).  % specifically, a code
 | 
			
		||||
action_types(0'd, [integer]).
 | 
			
		||||
action_types(0'D, [integer]).
 | 
			
		||||
action_types(0'e, [float]).
 | 
			
		||||
action_types(0'E, [float]).
 | 
			
		||||
action_types(0'f, [float]).
 | 
			
		||||
action_types(0'g, [float]).
 | 
			
		||||
action_types(0'G, [float]).
 | 
			
		||||
action_types(0'i, [any]).
 | 
			
		||||
action_types(0'I, [integer]).
 | 
			
		||||
action_types(0'k, [any]).
 | 
			
		||||
action_types(0'n, []).
 | 
			
		||||
action_types(0'N, []).
 | 
			
		||||
action_types(0'p, [any]).
 | 
			
		||||
action_types(0'q, [any]).
 | 
			
		||||
action_types(0'r, [integer]).
 | 
			
		||||
action_types(0'R, [integer]).
 | 
			
		||||
action_types(0's, [text]).
 | 
			
		||||
action_types(0'@, [callable]).
 | 
			
		||||
action_types(0't, []).
 | 
			
		||||
action_types(0'|, []).
 | 
			
		||||
action_types(0'+, []).
 | 
			
		||||
action_types(0'w, [any]).
 | 
			
		||||
action_types(0'W, [any, list]).
 | 
			
		||||
							
								
								
									
										194
									
								
								samples/Prolog/func.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										194
									
								
								samples/Prolog/func.pl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,194 @@
 | 
			
		||||
:- module(func, [ op(675, xfy, ($))
 | 
			
		||||
                , op(650, xfy, (of))
 | 
			
		||||
                , ($)/2
 | 
			
		||||
                , (of)/2
 | 
			
		||||
                ]).
 | 
			
		||||
:- use_module(library(list_util), [xfy_list/3]).
 | 
			
		||||
:- use_module(library(function_expansion)).
 | 
			
		||||
:- use_module(library(arithmetic)).
 | 
			
		||||
:- use_module(library(error)).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% true if the module whose terms are being read has specifically
 | 
			
		||||
% imported library(func).
 | 
			
		||||
wants_func :-
 | 
			
		||||
    prolog_load_context(module, Module),
 | 
			
		||||
    Module \== func,  % we don't want func sugar ourselves
 | 
			
		||||
    predicate_property(Module:of(_,_),imported_from(func)).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%%  compile_function(+Term, -In, -Out, -Goal) is semidet.
 | 
			
		||||
%
 | 
			
		||||
%   True if Term represents a function from In to Out
 | 
			
		||||
%   implemented by calling Goal.  This multifile hook is
 | 
			
		||||
%   called by $/2 and of/2 to convert a term into a goal.
 | 
			
		||||
%   It's used at compile time for macro expansion.
 | 
			
		||||
%   It's used at run time to handle functions which aren't
 | 
			
		||||
%   known at compile time.
 | 
			
		||||
%   When called as a hook, Term is guaranteed to be =nonvar=.
 | 
			
		||||
%
 | 
			
		||||
%   For example, to treat library(assoc) terms as functions which
 | 
			
		||||
%   map a key to a value, one might define:
 | 
			
		||||
%
 | 
			
		||||
%       :- multifile compile_function/4.
 | 
			
		||||
%       compile_function(Assoc, Key, Value, Goal) :-
 | 
			
		||||
%           is_assoc(Assoc),
 | 
			
		||||
%           Goal = get_assoc(Key, Assoc, Value).
 | 
			
		||||
%
 | 
			
		||||
%   Then one could write:
 | 
			
		||||
%
 | 
			
		||||
%       list_to_assoc([a-1, b-2, c-3], Assoc),
 | 
			
		||||
%       Two = Assoc $ b,
 | 
			
		||||
:- multifile compile_function/4.
 | 
			
		||||
compile_function(Var, _, _, _) :-
 | 
			
		||||
    % variables storing functions must be evaluated at run time
 | 
			
		||||
    % and can't be compiled, a priori, into a goal
 | 
			
		||||
    var(Var),
 | 
			
		||||
    !,
 | 
			
		||||
    fail.
 | 
			
		||||
compile_function(Expr, In, Out, Out is Expr) :-
 | 
			
		||||
    % arithmetic expression of one variable are simply evaluated
 | 
			
		||||
    \+ string(Expr),  % evaluable/1 throws exception with strings
 | 
			
		||||
    arithmetic:evaluable(Expr),
 | 
			
		||||
    term_variables(Expr, [In]).
 | 
			
		||||
compile_function(F, In, Out, func:Goal) :-
 | 
			
		||||
    % composed functions
 | 
			
		||||
    function_composition_term(F),
 | 
			
		||||
    user:function_expansion(F, func:Functor, true),
 | 
			
		||||
    Goal =.. [Functor,In,Out].
 | 
			
		||||
compile_function(F, In, Out, Goal) :-
 | 
			
		||||
    % string interpolation via format templates
 | 
			
		||||
    format_template(F),
 | 
			
		||||
    ( atom(F) ->
 | 
			
		||||
        Goal = format(atom(Out), F, In)
 | 
			
		||||
    ; string(F) ->
 | 
			
		||||
        Goal = format(string(Out), F, In)
 | 
			
		||||
    ; error:has_type(codes, F) ->
 | 
			
		||||
        Goal = format(codes(Out), F, In)
 | 
			
		||||
    ; fail  % to be explicit
 | 
			
		||||
    ).
 | 
			
		||||
compile_function(Dict, In, Out, Goal) :-
 | 
			
		||||
    is_dict(Dict),
 | 
			
		||||
    Goal = get_dict(In, Dict, Out).
 | 
			
		||||
 | 
			
		||||
%%	$(+Function, +Argument) is det.
 | 
			
		||||
%
 | 
			
		||||
%	Apply Function to an Argument.  A Function is any predicate
 | 
			
		||||
%	whose final argument generates output and whose penultimate argument
 | 
			
		||||
%	accepts input.
 | 
			
		||||
%
 | 
			
		||||
%	This is realized by expanding function application to chained
 | 
			
		||||
%	predicate calls at compile time.  Function application itself can
 | 
			
		||||
%	be chained.
 | 
			
		||||
%
 | 
			
		||||
%	==
 | 
			
		||||
%	Reversed = reverse $ sort $ [c,d,b].
 | 
			
		||||
%	==
 | 
			
		||||
:- meta_predicate $(2,+).
 | 
			
		||||
$(_,_) :-
 | 
			
		||||
    throw(error(permission_error(call, predicate, ($)/2),
 | 
			
		||||
          context(_, '$/2 must be subject to goal expansion'))).
 | 
			
		||||
 | 
			
		||||
user:function_expansion($(F,X), Y, Goal) :-
 | 
			
		||||
    wants_func,
 | 
			
		||||
    ( func:compile_function(F, X, Y, Goal) ->
 | 
			
		||||
        true
 | 
			
		||||
    ; var(F) -> Goal =      % defer until run time
 | 
			
		||||
        ( func:compile_function(F, X, Y, P) ->
 | 
			
		||||
            call(P)
 | 
			
		||||
        ; call(F, X, Y)
 | 
			
		||||
        )
 | 
			
		||||
    ; Goal = call(F, X, Y)
 | 
			
		||||
    ).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%%	of(+F, +G) is det.
 | 
			
		||||
%
 | 
			
		||||
%	Creates a new function by composing F and G.  The functions are
 | 
			
		||||
%	composed at compile time to create a new, compiled predicate which
 | 
			
		||||
%	behaves like a function.  Function composition can be chained.
 | 
			
		||||
%	Composed functions can also be applied with $/2.
 | 
			
		||||
%
 | 
			
		||||
%	==
 | 
			
		||||
%	Reversed = reverse of sort $ [c,d,b].
 | 
			
		||||
%	==
 | 
			
		||||
:- meta_predicate of(2,2).
 | 
			
		||||
of(_,_).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%%  format_template(Format) is semidet.
 | 
			
		||||
%
 | 
			
		||||
%   True if Format is a template string suitable for format/3.
 | 
			
		||||
%   The current check is very naive and should be improved.
 | 
			
		||||
format_template(Format) :-
 | 
			
		||||
    atom(Format), !,
 | 
			
		||||
    atom_codes(Format, Codes),
 | 
			
		||||
    format_template(Codes).
 | 
			
		||||
format_template(Format) :-
 | 
			
		||||
    string(Format),
 | 
			
		||||
    !,
 | 
			
		||||
    string_codes(Format, Codes),
 | 
			
		||||
    format_template(Codes).
 | 
			
		||||
format_template(Format) :-
 | 
			
		||||
    error:has_type(codes, Format),
 | 
			
		||||
    memberchk(0'~, Format).  % ' fix syntax highlighting
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% True if the argument is a function composition term
 | 
			
		||||
function_composition_term(of(_,_)).
 | 
			
		||||
 | 
			
		||||
% Converts a function composition term into a list of functions to compose
 | 
			
		||||
functions_to_compose(Term, Funcs) :-
 | 
			
		||||
    functor(Term, Op, 2),
 | 
			
		||||
    Op = (of),
 | 
			
		||||
    xfy_list(Op, Term, Funcs).
 | 
			
		||||
 | 
			
		||||
% Thread a state variable through a list of functions.  This is similar
 | 
			
		||||
% to a DCG expansion, but much simpler.
 | 
			
		||||
thread_state([], [], Out, Out).
 | 
			
		||||
thread_state([F|Funcs], [Goal|Goals], In, Out) :-
 | 
			
		||||
    ( compile_function(F, In, Tmp, Goal) ->
 | 
			
		||||
        true
 | 
			
		||||
    ; var(F) ->
 | 
			
		||||
        instantiation_error(F)
 | 
			
		||||
    ; F =.. [Functor|Args],
 | 
			
		||||
      append(Args, [In, Tmp], NewArgs),
 | 
			
		||||
      Goal =.. [Functor|NewArgs]
 | 
			
		||||
    ),
 | 
			
		||||
    thread_state(Funcs, Goals, Tmp, Out).
 | 
			
		||||
 | 
			
		||||
user:function_expansion(Term, func:Functor, true) :-
 | 
			
		||||
    wants_func,
 | 
			
		||||
    functions_to_compose(Term, Funcs),
 | 
			
		||||
    debug(func, 'building composed function for: ~w', [Term]),
 | 
			
		||||
    variant_sha1(Funcs, Sha),
 | 
			
		||||
    format(atom(Functor), 'composed_function_~w', [Sha]),
 | 
			
		||||
    debug(func, '  name: ~s', [Functor]),
 | 
			
		||||
    ( func:current_predicate(Functor/2) ->
 | 
			
		||||
        debug(func, '  composed predicate already exists', [])
 | 
			
		||||
    ; true ->
 | 
			
		||||
        reverse(Funcs, RevFuncs),
 | 
			
		||||
        thread_state(RevFuncs, Threaded, In, Out),
 | 
			
		||||
        xfy_list(',', Body, Threaded),
 | 
			
		||||
        Head =.. [Functor, In, Out],
 | 
			
		||||
        func:assert(Head :- Body),
 | 
			
		||||
        func:compile_predicates([Functor/2])
 | 
			
		||||
    ).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% support foo(x,~,y) evaluation
 | 
			
		||||
user:function_expansion(Term, Output, Goal) :-
 | 
			
		||||
    wants_func,
 | 
			
		||||
    compound(Term),
 | 
			
		||||
 | 
			
		||||
    % has a single ~ argument
 | 
			
		||||
    setof( X
 | 
			
		||||
         , ( arg(X,Term,Arg), Arg == '~' )
 | 
			
		||||
         , [N]
 | 
			
		||||
         ),
 | 
			
		||||
 | 
			
		||||
    % replace ~ with a variable
 | 
			
		||||
    Term =.. [Name|Args0],
 | 
			
		||||
    nth1(N, Args0, ~, Rest),
 | 
			
		||||
    nth1(N, Args, Output, Rest),
 | 
			
		||||
    Goal =.. [Name|Args].
 | 
			
		||||
							
								
								
									
										241
									
								
								samples/Python/Cinema4DPythonPlugin.pyp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										241
									
								
								samples/Python/Cinema4DPythonPlugin.pyp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,241 @@
 | 
			
		||||
#
 | 
			
		||||
# Cinema 4D Python Plugin Source file
 | 
			
		||||
# https://github.com/nr-plugins/nr-xpresso-alignment-tools
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# coding: utf-8
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2012, Niklas Rosenstein
 | 
			
		||||
# Licensed under the GNU General Public License
 | 
			
		||||
#
 | 
			
		||||
# XPAT - XPresso Alignment Tools
 | 
			
		||||
# ==============================
 | 
			
		||||
#
 | 
			
		||||
# The XPAT plugin provides tools for aligning nodes in the Cinema 4D
 | 
			
		||||
# XPresso Editor, improving readability of complex XPresso set-ups
 | 
			
		||||
# immensively.
 | 
			
		||||
#
 | 
			
		||||
# Requirements:
 | 
			
		||||
# - MAXON Cinema 4D R13+
 | 
			
		||||
# - Python `c4dtools` library. Get it from
 | 
			
		||||
#   http://github.com/NiklasRosenstein/c4dtools
 | 
			
		||||
#
 | 
			
		||||
# Author:  Niklas Rosenstein <rosensteinniklas@gmail.com>
 | 
			
		||||
# Version: 1.1 (01/06/2012)
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import json
 | 
			
		||||
import c4d
 | 
			
		||||
import c4dtools
 | 
			
		||||
import itertools
 | 
			
		||||
 | 
			
		||||
from c4d.modules import graphview as gv
 | 
			
		||||
from c4dtools.misc import graphnode
 | 
			
		||||
 | 
			
		||||
res, importer = c4dtools.prepare(__file__, __res__)
 | 
			
		||||
settings = c4dtools.helpers.Attributor({
 | 
			
		||||
    'options_filename': res.file('config.json'),
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
def align_nodes(nodes, mode, spacing):
 | 
			
		||||
    r"""
 | 
			
		||||
    Aligns the passed nodes horizontally and apply the minimum spacing
 | 
			
		||||
    between them.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    modes = ['horizontal', 'vertical']
 | 
			
		||||
    if not nodes:
 | 
			
		||||
        return
 | 
			
		||||
    if mode not in modes:
 | 
			
		||||
        raise ValueError('invalid mode, choices are: ' + ', '.join(modes))
 | 
			
		||||
 | 
			
		||||
    get_0 = lambda x: x.x
 | 
			
		||||
    get_1 = lambda x: x.y
 | 
			
		||||
    set_0 = lambda x, v: setattr(x, 'x', v)
 | 
			
		||||
    set_1 = lambda x, v: setattr(x, 'y', v)
 | 
			
		||||
 | 
			
		||||
    if mode == 'vertical':
 | 
			
		||||
        get_0, get_1 = get_1, get_0
 | 
			
		||||
        set_0, set_1 = set_1, set_0
 | 
			
		||||
 | 
			
		||||
    nodes = [graphnode.GraphNode(n) for n in nodes]
 | 
			
		||||
    nodes.sort(key=lambda n: get_0(n.position))
 | 
			
		||||
    midpoint = graphnode.find_nodes_mid(nodes)
 | 
			
		||||
 | 
			
		||||
    # Apply the spacing between the nodes relative to the coordinate-systems
 | 
			
		||||
    # origin. We can offset them later because we now the nodes' midpoint
 | 
			
		||||
    # already.
 | 
			
		||||
    first_position = nodes[0].position
 | 
			
		||||
    new_positions = []
 | 
			
		||||
    prev_offset = 0
 | 
			
		||||
    for node in nodes:
 | 
			
		||||
        # Compute the relative position of the node.
 | 
			
		||||
        position = node.position
 | 
			
		||||
        set_0(position, get_0(position) - get_0(first_position))
 | 
			
		||||
 | 
			
		||||
        # Obtain it's size and check if the node needs to be re-placed.
 | 
			
		||||
        size = node.size
 | 
			
		||||
        if get_0(position) < prev_offset:
 | 
			
		||||
            set_0(position, prev_offset)
 | 
			
		||||
            prev_offset += spacing + get_0(size)
 | 
			
		||||
        else:
 | 
			
		||||
            prev_offset = get_0(position) + get_0(size) + spacing
 | 
			
		||||
 | 
			
		||||
        set_1(position, get_1(midpoint))
 | 
			
		||||
        new_positions.append(position)
 | 
			
		||||
 | 
			
		||||
    # Center the nodes again.
 | 
			
		||||
    bbox_size = prev_offset - spacing
 | 
			
		||||
    bbox_size_2 = bbox_size * 0.5
 | 
			
		||||
    for node, position in itertools.izip(nodes, new_positions):
 | 
			
		||||
        # TODO: Here is some issue with offsetting the nodes. Some value
 | 
			
		||||
        # dependent on the spacing must be added here to not make the nodes
 | 
			
		||||
        # move horizontally/vertically although they have already been
 | 
			
		||||
        # aligned.
 | 
			
		||||
        set_0(position, get_0(midpoint) + get_0(position) - bbox_size_2 + spacing)
 | 
			
		||||
        node.position = position
 | 
			
		||||
 | 
			
		||||
def align_nodes_shortcut(mode, spacing):
 | 
			
		||||
    master = gv.GetMaster(0)
 | 
			
		||||
    if not master:
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    root = master.GetRoot()
 | 
			
		||||
    if not root:
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    nodes = graphnode.find_selected_nodes(root)
 | 
			
		||||
    if nodes:
 | 
			
		||||
        master.AddUndo()
 | 
			
		||||
        align_nodes(nodes, mode, spacing)
 | 
			
		||||
        c4d.EventAdd()
 | 
			
		||||
 | 
			
		||||
    return True
 | 
			
		||||
 | 
			
		||||
class XPAT_Options(c4dtools.helpers.Attributor):
 | 
			
		||||
    r"""
 | 
			
		||||
    This class organizes the options for the XPAT plugin, i.e.
 | 
			
		||||
    validating, loading and saving.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    defaults = {
 | 
			
		||||
        'hspace': 50,
 | 
			
		||||
        'vspace': 20,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def __init__(self, filename=None):
 | 
			
		||||
        super(XPAT_Options, self).__init__()
 | 
			
		||||
        self.load(filename)
 | 
			
		||||
 | 
			
		||||
    def load(self, filename=None):
 | 
			
		||||
        r"""
 | 
			
		||||
        Load the options from file pointed to by filename. If filename
 | 
			
		||||
        is None, it defaults to the filename defined in options in the
 | 
			
		||||
        global scope.
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        if filename is None:
 | 
			
		||||
            filename = settings.options_filename
 | 
			
		||||
 | 
			
		||||
        if os.path.isfile(filename):
 | 
			
		||||
            self.dict_ = self.defaults.copy()
 | 
			
		||||
            with open(filename, 'rb') as fp:
 | 
			
		||||
                self.dict_.update(json.load(fp))
 | 
			
		||||
        else:
 | 
			
		||||
            self.dict_ = self.defaults.copy()
 | 
			
		||||
            self.save()
 | 
			
		||||
 | 
			
		||||
    def save(self, filename=None):
 | 
			
		||||
        r"""
 | 
			
		||||
        Save the options defined in XPAT_Options instance to HD.
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        if filename is None:
 | 
			
		||||
            filename = settings.options_filename
 | 
			
		||||
 | 
			
		||||
        values = dict((k, v) for k, v in self.dict_.iteritems()
 | 
			
		||||
                      if k in self.defaults)
 | 
			
		||||
        with open(filename, 'wb') as fp:
 | 
			
		||||
            json.dump(values, fp)
 | 
			
		||||
 | 
			
		||||
class XPAT_OptionsDialog(c4d.gui.GeDialog):
 | 
			
		||||
    r"""
 | 
			
		||||
    This class implements the behavior of the XPAT options dialog,
 | 
			
		||||
    taking care of storing the options on the HD and loading them
 | 
			
		||||
    again on startup.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    # c4d.gui.GeDialog
 | 
			
		||||
 | 
			
		||||
    def CreateLayout(self):
 | 
			
		||||
        return self.LoadDialogResource(res.DLG_OPTIONS)
 | 
			
		||||
 | 
			
		||||
    def InitValues(self):
 | 
			
		||||
        self.SetLong(res.EDT_HSPACE, options.hspace)
 | 
			
		||||
        self.SetLong(res.EDT_VSPACE, options.vspace)
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
    def Command(self, id, msg):
 | 
			
		||||
        if id == res.BTN_SAVE:
 | 
			
		||||
            options.hspace = self.GetLong(res.EDT_HSPACE)
 | 
			
		||||
            options.vspace = self.GetLong(res.EDT_VSPACE)
 | 
			
		||||
            options.save()
 | 
			
		||||
            self.Close()
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
class XPAT_Command_OpenOptionsDialog(c4dtools.plugins.Command):
 | 
			
		||||
    r"""
 | 
			
		||||
    This Cinema 4D CommandData plugin opens the XPAT options dialog
 | 
			
		||||
    when being executed.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        super(XPAT_Command_OpenOptionsDialog, self).__init__()
 | 
			
		||||
        self._dialog = None
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def dialog(self):
 | 
			
		||||
        if not self._dialog:
 | 
			
		||||
            self._dialog = XPAT_OptionsDialog()
 | 
			
		||||
        return self._dialog
 | 
			
		||||
 | 
			
		||||
    # c4dtools.plugins.Command
 | 
			
		||||
 | 
			
		||||
    PLUGIN_ID = 1029621
 | 
			
		||||
    PLUGIN_NAME = res.string.XPAT_COMMAND_OPENOPTIONSDIALOG()
 | 
			
		||||
    PLUGIN_HELP = res.string.XPAT_COMMAND_OPENOPTIONSDIALOG_HELP()
 | 
			
		||||
 | 
			
		||||
    # c4d.gui.CommandData
 | 
			
		||||
 | 
			
		||||
    def Execute(self, doc):
 | 
			
		||||
        return self.dialog.Open(c4d.DLG_TYPE_MODAL)
 | 
			
		||||
 | 
			
		||||
class XPAT_Command_AlignHorizontal(c4dtools.plugins.Command):
 | 
			
		||||
 | 
			
		||||
    PLUGIN_ID = 1029538
 | 
			
		||||
    PLUGIN_NAME = res.string.XPAT_COMMAND_ALIGNHORIZONTAL()
 | 
			
		||||
    PLUGIN_ICON = res.file('xpresso-align-h.png')
 | 
			
		||||
    PLUGIN_HELP = res.string.XPAT_COMMAND_ALIGNHORIZONTAL_HELP()
 | 
			
		||||
 | 
			
		||||
    def Execute(self, doc):
 | 
			
		||||
        align_nodes_shortcut('horizontal', options.hspace)
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
class XPAT_Command_AlignVertical(c4dtools.plugins.Command):
 | 
			
		||||
 | 
			
		||||
    PLUGIN_ID = 1029539
 | 
			
		||||
    PLUGIN_NAME = res.string.XPAT_COMMAND_ALIGNVERTICAL()
 | 
			
		||||
    PLUGIN_ICON = res.file('xpresso-align-v.png')
 | 
			
		||||
    PLUGIN_HELP = res.string.XPAT_COMMAND_ALIGNVERTICAL_HELP()
 | 
			
		||||
 | 
			
		||||
    def Execute(self, doc):
 | 
			
		||||
        align_nodes_shortcut('vertical', options.vspace)
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
options = XPAT_Options()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    c4dtools.plugins.main()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								samples/QMake/complex.pro
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								samples/QMake/complex.pro
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
# This QMake file is complex, as it usese
 | 
			
		||||
# boolean operators and function calls
 | 
			
		||||
 | 
			
		||||
QT += core gui
 | 
			
		||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 | 
			
		||||
 | 
			
		||||
# We could use some OpenGL right now
 | 
			
		||||
contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) {
 | 
			
		||||
   QT += opengl
 | 
			
		||||
} else {
 | 
			
		||||
   DEFINES += QT_NO_OPENGL
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEMPLATE = app
 | 
			
		||||
win32 {
 | 
			
		||||
    TARGET = BlahApp
 | 
			
		||||
    RC_FILE = Resources/winres.rc
 | 
			
		||||
}
 | 
			
		||||
!win32 { TARGET = blahapp }
 | 
			
		||||
 | 
			
		||||
# Let's add a PRI file!
 | 
			
		||||
include(functions.pri)
 | 
			
		||||
 | 
			
		||||
SOURCES += file.cpp
 | 
			
		||||
 | 
			
		||||
HEADERS  += file.h
 | 
			
		||||
 | 
			
		||||
FORMS    += file.ui
 | 
			
		||||
 | 
			
		||||
RESOURCES += res.qrc
 | 
			
		||||
							
								
								
									
										8
									
								
								samples/QMake/functions.pri
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								samples/QMake/functions.pri
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
# QMake include file that calls some functions
 | 
			
		||||
# and does nothing else...
 | 
			
		||||
 | 
			
		||||
exists(.git/HEAD) {
 | 
			
		||||
    system(git rev-parse HEAD >rev.txt)
 | 
			
		||||
} else {
 | 
			
		||||
    system(echo ThisIsNotAGitRepo >rev.txt)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								samples/QMake/qmake.script!
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								samples/QMake/qmake.script!
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/usr/bin/qmake
 | 
			
		||||
message(This is QMake.)
 | 
			
		||||
							
								
								
									
										17
									
								
								samples/QMake/simple.pro
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								samples/QMake/simple.pro
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
# Simple QMake file
 | 
			
		||||
 | 
			
		||||
CONFIG += qt
 | 
			
		||||
QT += core gui
 | 
			
		||||
TEMPLATE = app
 | 
			
		||||
TARGET = simpleapp
 | 
			
		||||
 | 
			
		||||
SOURCES += file.cpp \
 | 
			
		||||
    file2.c \
 | 
			
		||||
    This/Is/Folder/file3.cpp
 | 
			
		||||
 | 
			
		||||
HEADERS += file.h \
 | 
			
		||||
    file2.h \
 | 
			
		||||
    This/Is/Folder/file3.h
 | 
			
		||||
 | 
			
		||||
FORMS += This/Is/Folder/file3.ui \
 | 
			
		||||
    Test.ui
 | 
			
		||||
							
								
								
									
										19
									
								
								samples/Ruby/filenames/.pryrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								samples/Ruby/filenames/.pryrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
Pry.config.commands.import Pry::ExtendedCommands::Experimental
 | 
			
		||||
 | 
			
		||||
Pry.config.pager = false
 | 
			
		||||
 | 
			
		||||
Pry.config.color = false
 | 
			
		||||
 | 
			
		||||
Pry.config.commands.alias_command "lM", "ls -M"
 | 
			
		||||
 | 
			
		||||
Pry.config.commands.command "add", "Add a list of numbers together" do |*args|
 | 
			
		||||
  output.puts "Result is: #{args.map(&:to_i).inject(&:+)}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Pry.config.history.should_save = false
 | 
			
		||||
 | 
			
		||||
Pry.config.prompt = [proc { "input> " },
 | 
			
		||||
                     proc { "     | " }]
 | 
			
		||||
 | 
			
		||||
# Disable pry-buggy-plug:
 | 
			
		||||
Pry.plugins["buggy-plug"].disable!
 | 
			
		||||
							
								
								
									
										1
									
								
								samples/STON/Array.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/STON/Array.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
[1, 2, 3]
 | 
			
		||||
							
								
								
									
										1
									
								
								samples/STON/Dictionary.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/STON/Dictionary.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{#a : 1, #b : 2}
 | 
			
		||||
							
								
								
									
										4
									
								
								samples/STON/Rectangle.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								samples/STON/Rectangle.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
Rectangle {
 | 
			
		||||
   #origin : Point [ -40, -15 ],
 | 
			
		||||
   #corner : Point [ 60, 35 ]
 | 
			
		||||
 }
 | 
			
		||||
							
								
								
									
										15
									
								
								samples/STON/TestDomainObject.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								samples/STON/TestDomainObject.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
TestDomainObject {
 | 
			
		||||
  #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ],
 | 
			
		||||
  #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ],
 | 
			
		||||
  #integer : 39581,
 | 
			
		||||
  #float : 73.84789359463944,
 | 
			
		||||
  #description : 'This is a test',
 | 
			
		||||
  #color : #green,
 | 
			
		||||
  #tags : [
 | 
			
		||||
    #two,
 | 
			
		||||
    #beta,
 | 
			
		||||
    #medium
 | 
			
		||||
  ],
 | 
			
		||||
  #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ],
 | 
			
		||||
  #boolean : false
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								samples/STON/ZNResponse.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								samples/STON/ZNResponse.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
ZnResponse {
 | 
			
		||||
   #headers : ZnHeaders {
 | 
			
		||||
     #headers : ZnMultiValueDictionary {
 | 
			
		||||
        'Date' : 'Fri, 04 May 2012 20:09:23 GMT',
 | 
			
		||||
        'Modification-Date' : 'Thu, 10 Feb 2011 08:32:30 GMT',
 | 
			
		||||
        'Content-Length' : '113',
 | 
			
		||||
        'Server' : 'Zinc HTTP Components 1.0',
 | 
			
		||||
        'Vary' : 'Accept-Encoding',
 | 
			
		||||
        'Connection' : 'close',
 | 
			
		||||
        'Content-Type' : 'text/html;charset=utf-8'
 | 
			
		||||
     }
 | 
			
		||||
   },
 | 
			
		||||
   #entity : ZnStringEntity {
 | 
			
		||||
     #contentType : ZnMimeType {
 | 
			
		||||
        #main : 'text',
 | 
			
		||||
        #sub : 'html',
 | 
			
		||||
        #parameters : {
 | 
			
		||||
            'charset' : 'utf-8'
 | 
			
		||||
        }
 | 
			
		||||
     },
 | 
			
		||||
     #contentLength : 113,
 | 
			
		||||
     #string : '<html>\n<head><title>Small</title></head>\n<body><h1>Small</h1><p>This is a small HTML document</p></body>\n</html>\n',
 | 
			
		||||
     #encoder : ZnUTF8Encoder { }
 | 
			
		||||
   },
 | 
			
		||||
   #statusLine : ZnStatusLine {
 | 
			
		||||
     #version : 'HTTP/1.1',
 | 
			
		||||
     #code : 200,
 | 
			
		||||
     #reason : 'OK'
 | 
			
		||||
   }
 | 
			
		||||
 }
 | 
			
		||||
							
								
								
									
										24
									
								
								samples/STON/methodProperties.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								samples/STON/methodProperties.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
{
 | 
			
		||||
	"class" : {
 | 
			
		||||
		 },
 | 
			
		||||
	"instance" : {
 | 
			
		||||
		"clientList:listElement:" : "dkh 03/20/2014 16:27",
 | 
			
		||||
		"copyObjectMenuAction:selectionIndex:" : "dkh 10/13/2013 10:20",
 | 
			
		||||
		"definitionForSelection:" : "dkh 10/13/2013 10:15",
 | 
			
		||||
		"editMenuActionSpec" : "dkh 10/13/2013 10:19",
 | 
			
		||||
		"itemSelected:listElement:selectedIndex:shiftPressed:" : "dkh 10/20/2013 11:06",
 | 
			
		||||
		"menuActionSpec:" : "dkh 10/19/2013 17:12",
 | 
			
		||||
		"repository:" : "dkh 10/19/2013 17:36",
 | 
			
		||||
		"theList" : "dkh 10/12/2013 15:51",
 | 
			
		||||
		"versionInfoBlock:" : "dkh 10/19/2013 17:08",
 | 
			
		||||
		"versionInfoDiffVsSelection:selectedIndex:" : "dkh 10/19/2013 17:48",
 | 
			
		||||
		"versionInfoDiffVsWorkingCopy:selectedIndex:" : "dkh 10/20/2013 12:36",
 | 
			
		||||
		"versionInfoSelect:selectedIndex:" : "dkh 10/12/2013 17:04",
 | 
			
		||||
		"versionInfos" : "dkh 10/19/2013 17:13",
 | 
			
		||||
		"versionSummaryIsClosing" : "dkh 10/20/2013 10:19",
 | 
			
		||||
		"windowIsClosing:" : "dkh 10/20/2013 10:39",
 | 
			
		||||
		"windowLabel" : "dkh 05/20/2014 11:00",
 | 
			
		||||
		"windowLocation" : "dkh 05/23/2014 10:17",
 | 
			
		||||
		"windowName" : "dkh 10/12/2013 16:00",
 | 
			
		||||
		"workingCopy" : "dkh 10/12/2013 16:16",
 | 
			
		||||
		"workingCopy:" : "dkh 10/12/2013 16:17" } }
 | 
			
		||||
							
								
								
									
										19
									
								
								samples/STON/properties.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								samples/STON/properties.ston
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
{
 | 
			
		||||
	"category" : "Topez-Server-Core",
 | 
			
		||||
	"classinstvars" : [
 | 
			
		||||
		 ],
 | 
			
		||||
	"classvars" : [
 | 
			
		||||
		 ],
 | 
			
		||||
	"commentStamp" : "",
 | 
			
		||||
	"instvars" : [
 | 
			
		||||
		"workingCopy",
 | 
			
		||||
		"repository",
 | 
			
		||||
		"versionInfos",
 | 
			
		||||
		"versionInfoBlock",
 | 
			
		||||
		"selectedVersionInfo",
 | 
			
		||||
		"versionInfoSummaryWindowId" ],
 | 
			
		||||
	"name" : "TDVersionInfoBrowser",
 | 
			
		||||
	"pools" : [
 | 
			
		||||
		 ],
 | 
			
		||||
	"super" : "TDAbstractMonticelloToolBuilder",
 | 
			
		||||
	"type" : "normal" }
 | 
			
		||||
							
								
								
									
										31
									
								
								samples/Slim/sample.slim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								samples/Slim/sample.slim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
doctype html
 | 
			
		||||
html
 | 
			
		||||
  head
 | 
			
		||||
    title Slim Examples
 | 
			
		||||
    meta name="keywords" content="template language"
 | 
			
		||||
    meta name="author" content=author
 | 
			
		||||
    javascript:
 | 
			
		||||
      alert('Slim supports embedded javascript!')
 | 
			
		||||
 | 
			
		||||
  body
 | 
			
		||||
    h1 Markup examples
 | 
			
		||||
 | 
			
		||||
    #content
 | 
			
		||||
      p This example shows you how a basic Slim file looks like.
 | 
			
		||||
 | 
			
		||||
      == yield
 | 
			
		||||
 | 
			
		||||
      - unless items.empty?
 | 
			
		||||
        table
 | 
			
		||||
          - for item in items do
 | 
			
		||||
            tr
 | 
			
		||||
              td.name = item.name
 | 
			
		||||
              td.price = item.price
 | 
			
		||||
      - else
 | 
			
		||||
        p
 | 
			
		||||
         | No items found.  Please add some inventory.
 | 
			
		||||
           Thank you!
 | 
			
		||||
 | 
			
		||||
    div id="footer"
 | 
			
		||||
      = render 'footer'
 | 
			
		||||
      | Copyright © #{year} #{author}
 | 
			
		||||
							
								
								
									
										75
									
								
								samples/Standard ML/Foo.ML
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								samples/Standard ML/Foo.ML
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
 | 
			
		||||
structure LazyBase:> LAZY_BASE =
 | 
			
		||||
   struct
 | 
			
		||||
      type 'a lazy = unit -> 'a
 | 
			
		||||
 | 
			
		||||
      exception Undefined
 | 
			
		||||
 | 
			
		||||
      fun delay f = f
 | 
			
		||||
 | 
			
		||||
      fun force f = f()
 | 
			
		||||
 | 
			
		||||
      val undefined = fn () => raise Undefined
 | 
			
		||||
   end
 | 
			
		||||
 | 
			
		||||
structure LazyMemoBase:> LAZY_BASE =
 | 
			
		||||
   struct 
 | 
			
		||||
 | 
			
		||||
      datatype 'a susp = NotYet of unit -> 'a
 | 
			
		||||
                       | Done of 'a
 | 
			
		||||
 | 
			
		||||
      type 'a lazy = unit -> 'a susp ref
 | 
			
		||||
 | 
			
		||||
      exception Undefined
 | 
			
		||||
 | 
			
		||||
      fun delay f = 
 | 
			
		||||
          let 
 | 
			
		||||
             val r = ref (NotYet f)
 | 
			
		||||
          in
 | 
			
		||||
             fn () => r
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
      fun force f = 
 | 
			
		||||
          case f() of
 | 
			
		||||
             ref (Done x) => x
 | 
			
		||||
           | r as ref (NotYet f') =>
 | 
			
		||||
             let
 | 
			
		||||
                val a = f'()
 | 
			
		||||
             in
 | 
			
		||||
                r := Done a
 | 
			
		||||
              ; a
 | 
			
		||||
             end
 | 
			
		||||
 | 
			
		||||
      val undefined = fn () => raise Undefined
 | 
			
		||||
   end
 | 
			
		||||
 | 
			
		||||
functor LazyFn(B: LAZY_BASE): LAZY' =
 | 
			
		||||
   struct
 | 
			
		||||
 | 
			
		||||
      open B
 | 
			
		||||
 | 
			
		||||
      fun inject x = delay (fn () => x)
 | 
			
		||||
 | 
			
		||||
      fun isUndefined x =
 | 
			
		||||
          (ignore (force x)
 | 
			
		||||
         ; false)
 | 
			
		||||
          handle Undefined => true
 | 
			
		||||
                              
 | 
			
		||||
      fun toString f x = if isUndefined x then "_|_" else f (force x)
 | 
			
		||||
 | 
			
		||||
      fun eqBy p (x,y) = p(force x,force y)
 | 
			
		||||
      fun eq (x,y) = eqBy op= (x,y)
 | 
			
		||||
      fun compare p (x,y) = p(force x,force y)
 | 
			
		||||
 | 
			
		||||
      structure Ops = 
 | 
			
		||||
         struct 
 | 
			
		||||
            val ! = force
 | 
			
		||||
            val ? = inject
 | 
			
		||||
         end
 | 
			
		||||
 | 
			
		||||
      fun map f x = delay (fn () => f (force x))
 | 
			
		||||
 | 
			
		||||
   end
 | 
			
		||||
 | 
			
		||||
structure Lazy' = LazyFn(LazyBase)
 | 
			
		||||
structure LazyMemo = LazyFn(LazyMemoBase)
 | 
			
		||||
							
								
								
									
										43
									
								
								samples/Text/ISO-2022-KR.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								samples/Text/ISO-2022-KR.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
$)C#
 | 
			
		||||
# Out-AnsiGraph.psm1
 | 
			
		||||
# Author:       xcud
 | 
			
		||||
# History:
 | 
			
		||||
#       v0.1 September 21, 2009 initial version
 | 
			
		||||
#
 | 
			
		||||
# PS Example> ps | select -first 5 | sort -property VM | 
 | 
			
		||||
#             Out-AnsiGraph ProcessName, VM
 | 
			
		||||
#                 AEADISRV  14508032
 | 
			
		||||
#                  audiodg  50757632
 | 
			
		||||
#                  conhost  73740288
 | 
			
		||||
# AppleMobileDeviceService  92061696
 | 
			
		||||
#                    btdna  126443520
 | 
			
		||||
#
 | 
			
		||||
function Out-AnsiGraph($Parameter1=$null) {
 | 
			
		||||
	BEGIN {
 | 
			
		||||
		$q = new-object Collections.queue
 | 
			
		||||
		$max = 0; $namewidth = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	PROCESS {
 | 
			
		||||
		if($_) {
 | 
			
		||||
			$name = $_.($Parameter1[0]);
 | 
			
		||||
			$val = $_.($Parameter1[1])
 | 
			
		||||
			if($max -lt $val) { $max = $val}		 
 | 
			
		||||
			if($namewidth -lt $name.length) { 
 | 
			
		||||
				$namewidth = $name.length }
 | 
			
		||||
			$q.enqueue(@($name, $val))			
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	END {
 | 
			
		||||
		$q | %{
 | 
			
		||||
			$graph = ""; 0..($_[1]/$max*20) | 
 | 
			
		||||
				%{ $graph += "" }
 | 
			
		||||
			$name = "{0,$namewidth}" -f $_[0]
 | 
			
		||||
			"$name $graph " + $_[1]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Export-ModuleMember Out-AnsiGraph
 | 
			
		||||
							
								
								
									
										703
									
								
								samples/Text/Visual_Battlers.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										703
									
								
								samples/Text/Visual_Battlers.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,703 @@
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# 
 | 
			
		||||
# <20><> Yanfly Engine Ace - Visual Battlers v1.01
 | 
			
		||||
# -- Last Updated: 2012.07.24
 | 
			
		||||
# -- Level: Easy
 | 
			
		||||
# -- Requires: n/a
 | 
			
		||||
#
 | 
			
		||||
# <20><> Modified by:
 | 
			
		||||
# -- Yami
 | 
			
		||||
# -- Kread-Ex
 | 
			
		||||
# -- Archeia_Nessiah
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
$imported = {} if $imported.nil?
 | 
			
		||||
$imported["YEA-VisualBattlers"] = true
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# <20><> Updates
 | 
			
		||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
# 2012.12.18 - Added preset views and able to change direction in-game.
 | 
			
		||||
# 2012.07.24 - Finished Script.
 | 
			
		||||
# 2012.01.05 - Started Script.
 | 
			
		||||
# 
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# <20><> Introduction
 | 
			
		||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
# This script provides a visual for all actors by default charsets. The actions
 | 
			
		||||
# and movements are alike Final Fantasy 1, only move forward and backward when 
 | 
			
		||||
# start and finish actions.
 | 
			
		||||
# 
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# <20><> Instructions
 | 
			
		||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
# To change the player direction in-game, use the snippet below in a script 
 | 
			
		||||
# call: 
 | 
			
		||||
# 
 | 
			
		||||
# $game_system.party_direction = n
 | 
			
		||||
#
 | 
			
		||||
# To install this script, open up your script editor and copy/paste this script
 | 
			
		||||
# to an open slot below <20><> Materials but above <20><> Main. Remember to save.
 | 
			
		||||
# 
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# <20><> Compatibility
 | 
			
		||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
 | 
			
		||||
# it will run with RPG Maker VX without adjusting.
 | 
			
		||||
# 
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
module YEA
 | 
			
		||||
  module VISUAL_BATTLERS
 | 
			
		||||
    
 | 
			
		||||
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 | 
			
		||||
    # - Party Location Setting -
 | 
			
		||||
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 | 
			
		||||
    # These settings are adjusted for Party Location. Each Actor will have
 | 
			
		||||
    # coordinates calculated by below formula. There are two samples coordinates
 | 
			
		||||
    # below, change PARTY_DIRECTION to the base index you want to use.
 | 
			
		||||
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 | 
			
		||||
    PARTY_DIRECTION = 6 # This direction is opposite from actual direction.
 | 
			
		||||
    
 | 
			
		||||
    PARTY_LOCATION_BASE_COORDINATES ={
 | 
			
		||||
    # Index => [base_x, base_y, mod_x, mod_y],
 | 
			
		||||
          2 => [   250,    290,    40,     0], #UP
 | 
			
		||||
          4 => [   150,    280,    20,   -20], #LEFT
 | 
			
		||||
          3 => [   460,    280,    30,   -10], #RIGHT
 | 
			
		||||
          6 => [   460,    230,    20,    20], #DEFAULT RIGHT
 | 
			
		||||
          8 => [   260,    230,    40,     0], #DOWN
 | 
			
		||||
    } # Do not remove this.
 | 
			
		||||
    
 | 
			
		||||
    PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x"
 | 
			
		||||
    PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y"
 | 
			
		||||
    
 | 
			
		||||
  end # VISUAL_BATTLERS
 | 
			
		||||
end # YEA
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
#  <20><>  Editting anything past this point may potentially result in causing
 | 
			
		||||
# computer damage, incontinence, explosion of user's head, coma, death, and/or
 | 
			
		||||
# halitosis so edit at your own risk.
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Direction
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
module Direction
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # self.correct
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def self.correct(direction)
 | 
			
		||||
    case direction
 | 
			
		||||
    when 1; return 4
 | 
			
		||||
    when 3; return 6
 | 
			
		||||
    when 7; return 4
 | 
			
		||||
    when 9; return 6
 | 
			
		||||
    else; return direction
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # self.opposite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def self.opposite(direction)
 | 
			
		||||
    case direction
 | 
			
		||||
    when 1; return 6
 | 
			
		||||
    when 2; return 8
 | 
			
		||||
    when 3; return 4
 | 
			
		||||
    when 4; return 6
 | 
			
		||||
    when 6; return 4
 | 
			
		||||
    when 7; return 6
 | 
			
		||||
    when 8; return 2
 | 
			
		||||
    when 9; return 4
 | 
			
		||||
    else; return direction
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Direction
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_System
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_System; attr_accessor :party_direction; end
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_BattleCharacter
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_BattleCharacter < Game_Character
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # initialize
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def initialize(actor)
 | 
			
		||||
    super()
 | 
			
		||||
    setup_actor(actor)
 | 
			
		||||
    @move_x_rate = 0
 | 
			
		||||
    @move_y_rate = 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # setup_actor
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def setup_actor(actor)
 | 
			
		||||
    @actor = actor
 | 
			
		||||
    @step_anime = true
 | 
			
		||||
    set_graphic(@actor.character_name, @actor.character_index)
 | 
			
		||||
    setup_coordinates
 | 
			
		||||
    dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
 | 
			
		||||
    direction = Direction.opposite(dr)
 | 
			
		||||
    set_direction(Direction.correct(direction))
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # sprite=
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def sprite=(sprite)
 | 
			
		||||
    @sprite = sprite
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # setup_coordinates
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def setup_coordinates
 | 
			
		||||
    location = ($game_system.party_direction ||
 | 
			
		||||
    YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
 | 
			
		||||
    base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0]
 | 
			
		||||
    base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1]
 | 
			
		||||
    mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2]
 | 
			
		||||
    mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3]
 | 
			
		||||
    @actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X)
 | 
			
		||||
    @actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y)
 | 
			
		||||
    @actor.origin_x = @actor.screen_x
 | 
			
		||||
    @actor.origin_y = @actor.screen_y
 | 
			
		||||
    @actor.create_move_to(screen_x, screen_y, 1)
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # index
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def index
 | 
			
		||||
    return @actor.index
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # screen_x
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_x
 | 
			
		||||
    return @actor.screen_x
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # screen_y
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_y
 | 
			
		||||
    return @actor.screen_y
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # screen_z
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_z
 | 
			
		||||
    return @actor.screen_z
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Game_BattleCharacter
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_Battler
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_Battler < Game_BattlerBase
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # public instance variables
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  attr_accessor :moved_back
 | 
			
		||||
  attr_accessor :origin_x
 | 
			
		||||
  attr_accessor :origin_y
 | 
			
		||||
  attr_accessor :screen_x
 | 
			
		||||
  attr_accessor :screen_y
 | 
			
		||||
  attr_accessor :started_turn
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: execute_damage
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias game_battler_execute_damage_vb execute_damage
 | 
			
		||||
  def execute_damage(user)
 | 
			
		||||
    game_battler_execute_damage_vb(user)
 | 
			
		||||
    if @result.hp_damage > 0
 | 
			
		||||
      move_backward(24, 6) unless @moved_back
 | 
			
		||||
      @moved_back = true
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # face_opposing_party
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def face_opposing_party
 | 
			
		||||
    direction = ($game_system.party_direction ||
 | 
			
		||||
    YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
 | 
			
		||||
    character.set_direction(Direction.correct(direction)) rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: face_coordinate
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def face_coordinate(destination_x, destination_y)
 | 
			
		||||
    x1 = Integer(@screen_x)
 | 
			
		||||
    x2 = Integer(destination_x)
 | 
			
		||||
    y1 = Graphics.height - Integer(@screen_y)
 | 
			
		||||
    y2 = Graphics.height - Integer(destination_y)
 | 
			
		||||
    return if x1 == x2 and y1 == y2
 | 
			
		||||
    #---
 | 
			
		||||
    angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI)
 | 
			
		||||
    if (0..225) === angle or (-225..0) === angle
 | 
			
		||||
      direction = 6
 | 
			
		||||
    elsif (226..675) === angle
 | 
			
		||||
      direction = 9
 | 
			
		||||
    elsif (676..1125) === angle
 | 
			
		||||
      direction = 8
 | 
			
		||||
    elsif (1126..1575) === angle
 | 
			
		||||
      direction = 7
 | 
			
		||||
    elsif (1576..1800) === angle or (-1800..-1576) === angle
 | 
			
		||||
      direction = 4
 | 
			
		||||
    elsif (-1575..-1126) === angle
 | 
			
		||||
      direction = 1
 | 
			
		||||
    elsif (-1125..-676) === angle
 | 
			
		||||
      direction = 2
 | 
			
		||||
    elsif (-675..-226) === angle
 | 
			
		||||
      direction = 3
 | 
			
		||||
    end
 | 
			
		||||
    #---
 | 
			
		||||
    character.set_direction(Direction.correct(direction)) rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # create_move_to
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def create_move_to(destination_x, destination_y, frames = 12)
 | 
			
		||||
    @destination_x = destination_x
 | 
			
		||||
    @destination_y = destination_y
 | 
			
		||||
    frames = [frames, 1].max
 | 
			
		||||
    @move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max
 | 
			
		||||
    @move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # update_move_to
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def update_move_to
 | 
			
		||||
    @move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
 | 
			
		||||
    @move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
 | 
			
		||||
    value = [(@screen_x - @destination_x).abs, @move_x_rate].min
 | 
			
		||||
    @screen_x += (@destination_x > @screen_x) ? value : -value
 | 
			
		||||
    value = [(@screen_y - @destination_y).abs, @move_y_rate].min
 | 
			
		||||
    @screen_y += (@destination_y > @screen_y) ? value : -value
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # move_forward
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def move_forward(distance = 24, frames = 12)
 | 
			
		||||
    direction = forward_direction
 | 
			
		||||
    move_direction(direction, distance, frames)
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # move_backward
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def move_backward(distance = 24, frames = 12)
 | 
			
		||||
    direction = Direction.opposite(forward_direction)
 | 
			
		||||
    move_direction(direction, distance, frames)
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # move_direction
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def move_direction(direction, distance = 24, frames = 12)
 | 
			
		||||
    case direction
 | 
			
		||||
    when 1; move_x = distance / -2; move_y = distance /  2
 | 
			
		||||
    when 2; move_x = distance *  0; move_y = distance *  1
 | 
			
		||||
    when 3; move_x = distance / -2; move_y = distance /  2
 | 
			
		||||
    when 4; move_x = distance * -1; move_y = distance *  0
 | 
			
		||||
    when 6; move_x = distance *  1; move_y = distance *  0
 | 
			
		||||
    when 7; move_x = distance / -2; move_y = distance / -2
 | 
			
		||||
    when 8; move_x = distance *  0; move_y = distance * -1
 | 
			
		||||
    when 9; move_x = distance /  2; move_y = distance / -2
 | 
			
		||||
    else; return
 | 
			
		||||
    end
 | 
			
		||||
    destination_x = @screen_x + move_x
 | 
			
		||||
    destination_y = @screen_y + move_y
 | 
			
		||||
    create_move_to(destination_x, destination_y, frames)
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # forward_direction
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def forward_direction
 | 
			
		||||
    return ($game_system.party_direction ||
 | 
			
		||||
    YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # move_origin
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def move_origin
 | 
			
		||||
    create_move_to(@origin_x, @origin_y)
 | 
			
		||||
    face_coordinate(@origin_x, @origin_y)
 | 
			
		||||
    @moved_back = false
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # moving?
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def moving?
 | 
			
		||||
    return false if dead? || !exist?
 | 
			
		||||
    return @move_x_rate != 0 || @move_y_rate != 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Game_Battler
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_Actor
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_Actor < Game_Battler
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # overwrite method: use_sprite?
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def use_sprite?
 | 
			
		||||
    return true
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: screen_x
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_x
 | 
			
		||||
    return @screen_x rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: screen_y
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_y
 | 
			
		||||
    return @screen_y rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: screen_z
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def screen_z
 | 
			
		||||
    return 100
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: sprite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def sprite
 | 
			
		||||
    index = $game_party.battle_members.index(self)
 | 
			
		||||
    return SceneManager.scene.spriteset.actor_sprites[index]
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: character
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def character
 | 
			
		||||
    return sprite.character_base
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # face_opposing_party
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def face_opposing_party
 | 
			
		||||
    dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
 | 
			
		||||
    direction = Direction.opposite(dr)
 | 
			
		||||
    character.set_direction(Direction.correct(direction)) rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # forward_direction
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def forward_direction
 | 
			
		||||
    return Direction.opposite(($game_system.party_direction ||
 | 
			
		||||
    YEA::VISUAL_BATTLERS::PARTY_DIRECTION))
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Game_Actor
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_Enemy
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_Enemy < Game_Battler
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: sprite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def sprite
 | 
			
		||||
    return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: character
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def character
 | 
			
		||||
    return sprite
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Game_Enemy
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Game_Troop
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Game_Troop < Game_Unit
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: setup
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias game_troop_setup_vb setup
 | 
			
		||||
  def setup(troop_id)
 | 
			
		||||
    game_troop_setup_vb(troop_id)
 | 
			
		||||
    set_coordinates
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: set_coordinates
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def set_coordinates
 | 
			
		||||
    for member in members
 | 
			
		||||
      member.origin_x = member.screen_x
 | 
			
		||||
      member.origin_y = member.screen_y
 | 
			
		||||
      member.create_move_to(member.screen_x, member.screen_y, 1)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Game_Troop
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Sprite_Battler
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Sprite_Battler < Sprite_Base
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # public instance_variable
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  attr_accessor :character_base
 | 
			
		||||
  attr_accessor :character_sprite
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: dispose
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias sprite_battler_dispose_vb dispose
 | 
			
		||||
  def dispose
 | 
			
		||||
    dispose_character_sprite
 | 
			
		||||
    sprite_battler_dispose_vb
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: dispose_character_sprite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def dispose_character_sprite
 | 
			
		||||
    @character_sprite.dispose unless @character_sprite.nil?
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: update
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias sprite_battler_update_vb update
 | 
			
		||||
  def update
 | 
			
		||||
    sprite_battler_update_vb
 | 
			
		||||
    return if @battler.nil?
 | 
			
		||||
    update_move_to
 | 
			
		||||
    update_character_base
 | 
			
		||||
    update_character_sprite
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: update_character_base
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def update_character_base
 | 
			
		||||
    return if @character_base.nil?
 | 
			
		||||
    @character_base.update
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: update_character_sprite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def update_character_sprite
 | 
			
		||||
    return if @character_sprite.nil?
 | 
			
		||||
    @character_sprite.update
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: update_move_to
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def update_move_to
 | 
			
		||||
    @battler.update_move_to
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: moving?
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def moving?
 | 
			
		||||
    return false if @battler.nil?
 | 
			
		||||
    return @battler.moving?
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Sprite_Battler
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Sprite_BattleCharacter
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Sprite_BattleCharacter < Sprite_Character
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # initialize
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def initialize(viewport, character = nil)
 | 
			
		||||
    super(viewport, character)
 | 
			
		||||
    character.sprite = self
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Sprite_BattleCharacter
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Spriteset_Battle
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Spriteset_Battle
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # public instance_variable
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  attr_accessor :actor_sprites
 | 
			
		||||
  attr_accessor :enemy_sprites
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # overwrite method: create_actors
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def create_actors
 | 
			
		||||
    total = $game_party.max_battle_members
 | 
			
		||||
    @current_party = $game_party.battle_members.clone
 | 
			
		||||
    @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
 | 
			
		||||
    for actor in $game_party.battle_members
 | 
			
		||||
      @actor_sprites[actor.index].battler = actor
 | 
			
		||||
      create_actor_sprite(actor)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: create_actor_sprite
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def create_actor_sprite(actor)
 | 
			
		||||
    character = Game_BattleCharacter.new(actor)
 | 
			
		||||
    character_sprite = Sprite_BattleCharacter.new(@viewport1, character)
 | 
			
		||||
    @actor_sprites[actor.index].character_base = character
 | 
			
		||||
    @actor_sprites[actor.index].character_sprite = character_sprite
 | 
			
		||||
    actor.face_opposing_party
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: update_actors
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias spriteset_battle_update_actors_vb update_actors
 | 
			
		||||
  def update_actors
 | 
			
		||||
    if @current_party != $game_party.battle_members
 | 
			
		||||
      dispose_actors
 | 
			
		||||
      create_actors
 | 
			
		||||
    end
 | 
			
		||||
    spriteset_battle_update_actors_vb
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: moving?
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def moving?
 | 
			
		||||
    return battler_sprites.any? {|sprite| sprite.moving? }
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Spriteset_Battle
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# ? <20><>  Scene_Battle
 | 
			
		||||
#==============================================================================
 | 
			
		||||
 | 
			
		||||
class Scene_Battle < Scene_Base
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # public instance variables
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  attr_accessor :spriteset
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: process_action_end
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias scene_battle_process_action_end_vb process_action_end
 | 
			
		||||
  def process_action_end
 | 
			
		||||
    start_battler_move_origin
 | 
			
		||||
    scene_battle_process_action_end_vb
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # alias method: execute_action
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  alias scene_battle_execute_action_vb execute_action
 | 
			
		||||
  def execute_action
 | 
			
		||||
    start_battler_move_forward
 | 
			
		||||
    scene_battle_execute_action_vb
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: start_battler_move_forward
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def start_battler_move_forward
 | 
			
		||||
    return if @subject.started_turn
 | 
			
		||||
    @subject.started_turn = true
 | 
			
		||||
    @subject.move_forward
 | 
			
		||||
    wait_for_moving
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: start_battler_move_origin
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def start_battler_move_origin
 | 
			
		||||
    @subject.started_turn = nil
 | 
			
		||||
    move_battlers_origin
 | 
			
		||||
    wait_for_moving
 | 
			
		||||
    @subject.face_opposing_party rescue 0
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: move_battlers_origin
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def move_battlers_origin
 | 
			
		||||
    for member in all_battle_members
 | 
			
		||||
      next if member.dead?
 | 
			
		||||
      next unless member.exist?
 | 
			
		||||
      member.move_origin
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  # new method: wait_for_moving
 | 
			
		||||
  #--------------------------------------------------------------------------
 | 
			
		||||
  def wait_for_moving
 | 
			
		||||
    update_for_wait
 | 
			
		||||
    update_for_wait while @spriteset.moving?
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
end # Scene_Battle
 | 
			
		||||
 | 
			
		||||
#==============================================================================
 | 
			
		||||
# 
 | 
			
		||||
#  <20><>  End of File
 | 
			
		||||
# 
 | 
			
		||||
#==============================================================================
 | 
			
		||||
							
								
								
									
										152
									
								
								samples/VCL/varnish2_default.vcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								samples/VCL/varnish2_default.vcl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,152 @@
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2006 Verdens Gang AS
 | 
			
		||||
 * Copyright (c) 2006-2008 Linpro AS
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 | 
			
		||||
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE
 | 
			
		||||
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
 | 
			
		||||
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 | 
			
		||||
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 | 
			
		||||
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 | 
			
		||||
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id$
 | 
			
		||||
 *
 | 
			
		||||
 * The default VCL code.
 | 
			
		||||
 *
 | 
			
		||||
 * NB! You do NOT need to copy & paste all of these functions into your
 | 
			
		||||
 * own vcl code, if you do not provide a definition of one of these
 | 
			
		||||
 * functions, the compiler will automatically fall back to the default
 | 
			
		||||
 * code from this file.
 | 
			
		||||
 *
 | 
			
		||||
 * This code will be prefixed with a backend declaration built from the
 | 
			
		||||
 * -b argument.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
sub vcl_recv {
 | 
			
		||||
    if (req.request != "GET" &&
 | 
			
		||||
      req.request != "HEAD" &&
 | 
			
		||||
      req.request != "PUT" &&
 | 
			
		||||
      req.request != "POST" &&
 | 
			
		||||
      req.request != "TRACE" &&
 | 
			
		||||
      req.request != "OPTIONS" &&
 | 
			
		||||
      req.request != "DELETE") {
 | 
			
		||||
        /* Non-RFC2616 or CONNECT which is weird. */
 | 
			
		||||
        return (pipe);
 | 
			
		||||
    }
 | 
			
		||||
    if (req.request != "GET" && req.request != "HEAD") {
 | 
			
		||||
        /* We only deal with GET and HEAD by default */
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    if (req.http.Authorization || req.http.Cookie) {
 | 
			
		||||
        /* Not cacheable by default */
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    return (lookup);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_pipe {
 | 
			
		||||
    # Note that only the first request to the backend will have
 | 
			
		||||
    # X-Forwarded-For set.  If you use X-Forwarded-For and want to
 | 
			
		||||
    # have it set for all requests, make sure to have:
 | 
			
		||||
    # set req.http.connection = "close";
 | 
			
		||||
    # here.  It is not set by default as it might break some broken web
 | 
			
		||||
    # applications, like IIS with NTLM authentication.
 | 
			
		||||
    return (pipe);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_pass {
 | 
			
		||||
    return (pass);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_hash {
 | 
			
		||||
    set req.hash += req.url;
 | 
			
		||||
    if (req.http.host) {
 | 
			
		||||
        set req.hash += req.http.host;
 | 
			
		||||
    } else {
 | 
			
		||||
        set req.hash += server.ip;
 | 
			
		||||
    }
 | 
			
		||||
    return (hash);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_hit {
 | 
			
		||||
    if (!obj.cacheable) {
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_miss {
 | 
			
		||||
    return (fetch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_fetch {
 | 
			
		||||
    if (!obj.cacheable) {
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    if (obj.http.Set-Cookie) {
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    set obj.prefetch =  -30s;
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_deliver {
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_discard {
 | 
			
		||||
    /* XXX: Do not redefine vcl_discard{}, it is not yet supported */
 | 
			
		||||
    return (discard);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_prefetch {
 | 
			
		||||
    /* XXX: Do not redefine vcl_prefetch{}, it is not yet supported */
 | 
			
		||||
    return (fetch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_timeout {
 | 
			
		||||
    /* XXX: Do not redefine vcl_timeout{}, it is not yet supported */
 | 
			
		||||
    return (discard);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_error {
 | 
			
		||||
    set obj.http.Content-Type = "text/html; charset=utf-8";
 | 
			
		||||
    synthetic {"
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 | 
			
		||||
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>"} obj.status " " obj.response {"</title>
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <h1>Error "} obj.status " " obj.response {"</h1>
 | 
			
		||||
    <p>"} obj.response {"</p>
 | 
			
		||||
    <h3>Guru Meditation:</h3>
 | 
			
		||||
    <p>XID: "} req.xid {"</p>
 | 
			
		||||
    <hr>
 | 
			
		||||
    <address>
 | 
			
		||||
       <a href="http://www.varnish-cache.org/">Varnish cache server</a>
 | 
			
		||||
    </address>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
"};
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										149
									
								
								samples/VCL/varnish3_default.vcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								samples/VCL/varnish3_default.vcl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,149 @@
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2006 Verdens Gang AS
 | 
			
		||||
 * Copyright (c) 2006-2011 Varnish Software AS
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 | 
			
		||||
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE
 | 
			
		||||
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
 | 
			
		||||
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 | 
			
		||||
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 | 
			
		||||
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 | 
			
		||||
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 * The default VCL code.
 | 
			
		||||
 *
 | 
			
		||||
 * NB! You do NOT need to copy & paste all of these functions into your
 | 
			
		||||
 * own vcl code, if you do not provide a definition of one of these
 | 
			
		||||
 * functions, the compiler will automatically fall back to the default
 | 
			
		||||
 * code from this file.
 | 
			
		||||
 *
 | 
			
		||||
 * This code will be prefixed with a backend declaration built from the
 | 
			
		||||
 * -b argument.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
sub vcl_recv {
 | 
			
		||||
    if (req.restarts == 0) {
 | 
			
		||||
	if (req.http.x-forwarded-for) {
 | 
			
		||||
	    set req.http.X-Forwarded-For =
 | 
			
		||||
		req.http.X-Forwarded-For + ", " + client.ip;
 | 
			
		||||
	} else {
 | 
			
		||||
	    set req.http.X-Forwarded-For = client.ip;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    if (req.request != "GET" &&
 | 
			
		||||
      req.request != "HEAD" &&
 | 
			
		||||
      req.request != "PUT" &&
 | 
			
		||||
      req.request != "POST" &&
 | 
			
		||||
      req.request != "TRACE" &&
 | 
			
		||||
      req.request != "OPTIONS" &&
 | 
			
		||||
      req.request != "DELETE") {
 | 
			
		||||
        /* Non-RFC2616 or CONNECT which is weird. */
 | 
			
		||||
        return (pipe);
 | 
			
		||||
    }
 | 
			
		||||
    if (req.request != "GET" && req.request != "HEAD") {
 | 
			
		||||
        /* We only deal with GET and HEAD by default */
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    if (req.http.Authorization || req.http.Cookie) {
 | 
			
		||||
        /* Not cacheable by default */
 | 
			
		||||
        return (pass);
 | 
			
		||||
    }
 | 
			
		||||
    return (lookup);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_pipe {
 | 
			
		||||
    # Note that only the first request to the backend will have
 | 
			
		||||
    # X-Forwarded-For set.  If you use X-Forwarded-For and want to
 | 
			
		||||
    # have it set for all requests, make sure to have:
 | 
			
		||||
    # set bereq.http.connection = "close";
 | 
			
		||||
    # here.  It is not set by default as it might break some broken web
 | 
			
		||||
    # applications, like IIS with NTLM authentication.
 | 
			
		||||
    return (pipe);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_pass {
 | 
			
		||||
    return (pass);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_hash {
 | 
			
		||||
    hash_data(req.url);
 | 
			
		||||
    if (req.http.host) {
 | 
			
		||||
        hash_data(req.http.host);
 | 
			
		||||
    } else {
 | 
			
		||||
        hash_data(server.ip);
 | 
			
		||||
    }
 | 
			
		||||
    return (hash);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_hit {
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_miss {
 | 
			
		||||
    return (fetch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_fetch {
 | 
			
		||||
    if (beresp.ttl <= 0s ||
 | 
			
		||||
        beresp.http.Set-Cookie ||
 | 
			
		||||
        beresp.http.Vary == "*") {
 | 
			
		||||
		/*
 | 
			
		||||
		 * Mark as "Hit-For-Pass" for the next 2 minutes
 | 
			
		||||
		 */
 | 
			
		||||
		set beresp.ttl = 120 s;
 | 
			
		||||
		return (hit_for_pass);
 | 
			
		||||
    }
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_deliver {
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_error {
 | 
			
		||||
    set obj.http.Content-Type = "text/html; charset=utf-8";
 | 
			
		||||
    set obj.http.Retry-After = "5";
 | 
			
		||||
    synthetic {"
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 | 
			
		||||
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>"} + obj.status + " " + obj.response + {"</title>
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <h1>Error "} + obj.status + " " + obj.response + {"</h1>
 | 
			
		||||
    <p>"} + obj.response + {"</p>
 | 
			
		||||
    <h3>Guru Meditation:</h3>
 | 
			
		||||
    <p>XID: "} + req.xid + {"</p>
 | 
			
		||||
    <hr>
 | 
			
		||||
    <p>Varnish cache server</p>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
"};
 | 
			
		||||
    return (deliver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_init {
 | 
			
		||||
	return (ok);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vcl_fini {
 | 
			
		||||
	return (ok);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								samples/XML/sample.nuspec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								samples/XML/sample.nuspec
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?xml version="1.0"?>
 | 
			
		||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 | 
			
		||||
  <metadata>
 | 
			
		||||
    <id>Sample</id>
 | 
			
		||||
    <title>Sample</title>
 | 
			
		||||
    <version>0.101.0</version>
 | 
			
		||||
    <authors>Hugh Bot</authors>
 | 
			
		||||
    <owners>Hugh Bot</owners>
 | 
			
		||||
    <summary>A package of nuget</summary>
 | 
			
		||||
    <description>
 | 
			
		||||
      It just works
 | 
			
		||||
    </description>
 | 
			
		||||
    <projectUrl>http://hubot.github.com</projectUrl>
 | 
			
		||||
    <copyright/>
 | 
			
		||||
    <licenseUrl>https://github.com/github/hubot/LICENSEmd</licenseUrl>
 | 
			
		||||
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
 | 
			
		||||
  </metadata>
 | 
			
		||||
  <files>
 | 
			
		||||
    <file src="tools\**" target="tools"/>
 | 
			
		||||
  </files>
 | 
			
		||||
</package>
 | 
			
		||||
							
								
								
									
										22
									
								
								samples/Xojo/App.xojo_code
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								samples/Xojo/App.xojo_code
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#tag Class
 | 
			
		||||
Protected Class App
 | 
			
		||||
Inherits Application
 | 
			
		||||
	#tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public
 | 
			
		||||
		#Tag Instance, Platform = Windows, Language = Default, Definition  = \"&Delete"
 | 
			
		||||
		#Tag Instance, Platform = Linux, Language = Default, Definition  = \"&Delete"
 | 
			
		||||
	#tag EndConstant
 | 
			
		||||
 | 
			
		||||
	#tag Constant, Name = kFileQuit, Type = String, Dynamic = False, Default = \"&Quit", Scope = Public
 | 
			
		||||
		#Tag Instance, Platform = Windows, Language = Default, Definition  = \"E&xit"
 | 
			
		||||
	#tag EndConstant
 | 
			
		||||
 | 
			
		||||
	#tag Constant, Name = kFileQuitShortcut, Type = String, Dynamic = False, Default = \"", Scope = Public
 | 
			
		||||
		#Tag Instance, Platform = Mac OS, Language = Default, Definition  = \"Cmd+Q"
 | 
			
		||||
		#Tag Instance, Platform = Linux, Language = Default, Definition  = \"Ctrl+Q"
 | 
			
		||||
	#tag EndConstant
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	#tag ViewBehavior
 | 
			
		||||
	#tag EndViewBehavior
 | 
			
		||||
End Class
 | 
			
		||||
#tag EndClass
 | 
			
		||||
							
								
								
									
										23
									
								
								samples/Xojo/BillingReport.xojo_report
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								samples/Xojo/BillingReport.xojo_report
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
#tag Report
 | 
			
		||||
Begin Report BillingReport
 | 
			
		||||
   Compatibility   =   ""
 | 
			
		||||
   Units           =   0
 | 
			
		||||
   Width           =   8.5
 | 
			
		||||
   Begin  PageHeader
 | 
			
		||||
      Type            =   1
 | 
			
		||||
      Height          =   1.0
 | 
			
		||||
   End
 | 
			
		||||
   Begin  Body
 | 
			
		||||
      Type            =   3
 | 
			
		||||
      Height          =   2.0
 | 
			
		||||
   End
 | 
			
		||||
   Begin  PageFooter
 | 
			
		||||
      Type            =   5
 | 
			
		||||
      Height          =   1.0
 | 
			
		||||
   End
 | 
			
		||||
End
 | 
			
		||||
#tag EndReport
 | 
			
		||||
 | 
			
		||||
#tag ReportCode
 | 
			
		||||
#tag EndReportCode
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										112
									
								
								samples/Xojo/MainMenuBar.xojo_menu
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								samples/Xojo/MainMenuBar.xojo_menu
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,112 @@
 | 
			
		||||
#tag Menu
 | 
			
		||||
Begin Menu MainMenuBar
 | 
			
		||||
   Begin MenuItem FileMenu
 | 
			
		||||
      SpecialMenu = 0
 | 
			
		||||
      Text = "&File"
 | 
			
		||||
      Index = -2147483648
 | 
			
		||||
      AutoEnable = True
 | 
			
		||||
      Visible = True
 | 
			
		||||
      Begin QuitMenuItem FileQuit
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "#App.kFileQuit"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "#App.kFileQuitShortcut"
 | 
			
		||||
         Shortcut = "#App.kFileQuitShortcut"
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
   End
 | 
			
		||||
   Begin MenuItem EditMenu
 | 
			
		||||
      SpecialMenu = 0
 | 
			
		||||
      Text = "&Edit"
 | 
			
		||||
      Index = -2147483648
 | 
			
		||||
      AutoEnable = True
 | 
			
		||||
      Visible = True
 | 
			
		||||
      Begin MenuItem EditUndo
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "&Undo"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "Z"
 | 
			
		||||
         Shortcut = "Cmd+Z"
 | 
			
		||||
         MenuModifier = True
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditSeparator1
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "-"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditCut
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "Cu&t"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "X"
 | 
			
		||||
         Shortcut = "Cmd+X"
 | 
			
		||||
         MenuModifier = True
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditCopy
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "&Copy"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "C"
 | 
			
		||||
         Shortcut = "Cmd+C"
 | 
			
		||||
         MenuModifier = True
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditPaste
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "&Paste"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "V"
 | 
			
		||||
         Shortcut = "Cmd+V"
 | 
			
		||||
         MenuModifier = True
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditClear
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "#App.kEditClear"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditSeparator2
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "-"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem EditSelectAll
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "Select &All"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         ShortcutKey = "A"
 | 
			
		||||
         Shortcut = "Cmd+A"
 | 
			
		||||
         MenuModifier = True
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin MenuItem UntitledSeparator
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "-"
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
      Begin AppleMenuItem AboutItem
 | 
			
		||||
         SpecialMenu = 0
 | 
			
		||||
         Text = "About This App..."
 | 
			
		||||
         Index = -2147483648
 | 
			
		||||
         AutoEnable = True
 | 
			
		||||
         Visible = True
 | 
			
		||||
      End
 | 
			
		||||
   End
 | 
			
		||||
End
 | 
			
		||||
#tag EndMenu
 | 
			
		||||
							
								
								
									
										14
									
								
								samples/Xojo/MyToolbar.xojo_toolbar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								samples/Xojo/MyToolbar.xojo_toolbar
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#tag Toolbar
 | 
			
		||||
Begin Toolbar MyToolbar
 | 
			
		||||
	Begin ToolButton FirstItem
 | 
			
		||||
		Caption = "First Item"
 | 
			
		||||
		HelpTag = ""
 | 
			
		||||
		Style = 0
 | 
			
		||||
	End
 | 
			
		||||
	Begin ToolButton SecondItem
 | 
			
		||||
		Caption = "Second Item"
 | 
			
		||||
		HelpTag = ""
 | 
			
		||||
		Style = 0
 | 
			
		||||
	End
 | 
			
		||||
End
 | 
			
		||||
#tag EndToolbar
 | 
			
		||||
							
								
								
									
										304
									
								
								samples/Xojo/Window1.xojo_window
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										304
									
								
								samples/Xojo/Window1.xojo_window
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,304 @@
 | 
			
		||||
#tag Window
 | 
			
		||||
Begin Window Window1
 | 
			
		||||
   BackColor       =   &cFFFFFF00
 | 
			
		||||
   Backdrop        =   0
 | 
			
		||||
   CloseButton     =   True
 | 
			
		||||
   Compatibility   =   ""
 | 
			
		||||
   Composite       =   False
 | 
			
		||||
   Frame           =   0
 | 
			
		||||
   FullScreen      =   False
 | 
			
		||||
   FullScreenButton=   False
 | 
			
		||||
   HasBackColor    =   False
 | 
			
		||||
   Height          =   400
 | 
			
		||||
   ImplicitInstance=   True
 | 
			
		||||
   LiveResize      =   True
 | 
			
		||||
   MacProcID       =   0
 | 
			
		||||
   MaxHeight       =   32000
 | 
			
		||||
   MaximizeButton  =   True
 | 
			
		||||
   MaxWidth        =   32000
 | 
			
		||||
   MenuBar         =   1153981589
 | 
			
		||||
   MenuBarVisible  =   True
 | 
			
		||||
   MinHeight       =   64
 | 
			
		||||
   MinimizeButton  =   True
 | 
			
		||||
   MinWidth        =   64
 | 
			
		||||
   Placement       =   0
 | 
			
		||||
   Resizeable      =   True
 | 
			
		||||
   Title           =   "Sample App"
 | 
			
		||||
   Visible         =   True
 | 
			
		||||
   Width           =   600
 | 
			
		||||
   Begin PushButton HelloWorldButton
 | 
			
		||||
      AutoDeactivate  =   True
 | 
			
		||||
      Bold            =   False
 | 
			
		||||
      ButtonStyle     =   "0"
 | 
			
		||||
      Cancel          =   False
 | 
			
		||||
      Caption         =   "Push Me"
 | 
			
		||||
      Default         =   True
 | 
			
		||||
      Enabled         =   True
 | 
			
		||||
      Height          =   20
 | 
			
		||||
      HelpTag         =   ""
 | 
			
		||||
      Index           =   -2147483648
 | 
			
		||||
      InitialParent   =   ""
 | 
			
		||||
      Italic          =   False
 | 
			
		||||
      Left            =   260
 | 
			
		||||
      LockBottom      =   False
 | 
			
		||||
      LockedInPosition=   False
 | 
			
		||||
      LockLeft        =   True
 | 
			
		||||
      LockRight       =   False
 | 
			
		||||
      LockTop         =   True
 | 
			
		||||
      Scope           =   0
 | 
			
		||||
      TabIndex        =   0
 | 
			
		||||
      TabPanelIndex   =   0
 | 
			
		||||
      TabStop         =   True
 | 
			
		||||
      TextFont        =   "System"
 | 
			
		||||
      TextSize        =   0.0
 | 
			
		||||
      TextUnit        =   0
 | 
			
		||||
      Top             =   32
 | 
			
		||||
      Underline       =   False
 | 
			
		||||
      Visible         =   True
 | 
			
		||||
      Width           =   80
 | 
			
		||||
   End
 | 
			
		||||
End
 | 
			
		||||
#tag EndWindow
 | 
			
		||||
 | 
			
		||||
#tag WindowCode
 | 
			
		||||
#tag EndWindowCode
 | 
			
		||||
 | 
			
		||||
#tag Events HelloWorldButton
 | 
			
		||||
	#tag Event
 | 
			
		||||
		Sub Action()
 | 
			
		||||
		  Dim total As Integer
 | 
			
		||||
		  
 | 
			
		||||
		  For i As Integer = 0 To 10
 | 
			
		||||
		    total = total + i
 | 
			
		||||
		  Next
 | 
			
		||||
		  
 | 
			
		||||
		  MsgBox "Hello World! " + Str(total)
 | 
			
		||||
		End Sub
 | 
			
		||||
	#tag EndEvent
 | 
			
		||||
#tag EndEvents
 | 
			
		||||
#tag ViewBehavior
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="BackColor"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="&hFFFFFF"
 | 
			
		||||
		Type="Color"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Backdrop"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		Type="Picture"
 | 
			
		||||
		EditorType="Picture"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="CloseButton"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Composite"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="False"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Frame"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="0"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
		EditorType="Enum"
 | 
			
		||||
		#tag EnumValues
 | 
			
		||||
			"0 - Document"
 | 
			
		||||
			"1 - Movable Modal"
 | 
			
		||||
			"2 - Modal Dialog"
 | 
			
		||||
			"3 - Floating Window"
 | 
			
		||||
			"4 - Plain Box"
 | 
			
		||||
			"5 - Shadowed Box"
 | 
			
		||||
			"6 - Rounded Window"
 | 
			
		||||
			"7 - Global Floating Window"
 | 
			
		||||
			"8 - Sheet Window"
 | 
			
		||||
			"9 - Metal Window"
 | 
			
		||||
			"10 - Drawer Window"
 | 
			
		||||
			"11 - Modeless Dialog"
 | 
			
		||||
		#tag EndEnumValues
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="FullScreen"
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="False"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="FullScreenButton"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="False"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="HasBackColor"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="False"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Height"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="400"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="ImplicitInstance"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Interfaces"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="ID"
 | 
			
		||||
		Type="String"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="LiveResize"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MacProcID"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="0"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MaxHeight"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="32000"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MaximizeButton"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MaxWidth"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="32000"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MenuBar"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		Type="MenuBar"
 | 
			
		||||
		EditorType="MenuBar"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MenuBarVisible"
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MinHeight"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="64"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MinimizeButton"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="MinWidth"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="64"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Name"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="ID"
 | 
			
		||||
		Type="String"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Placement"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="0"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
		EditorType="Enum"
 | 
			
		||||
		#tag EnumValues
 | 
			
		||||
			"0 - Default"
 | 
			
		||||
			"1 - Parent Window"
 | 
			
		||||
			"2 - Main Screen"
 | 
			
		||||
			"3 - Parent Window Screen"
 | 
			
		||||
			"4 - Stagger"
 | 
			
		||||
		#tag EndEnumValues
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Resizeable"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Super"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="ID"
 | 
			
		||||
		Type="String"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Title"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="Untitled"
 | 
			
		||||
		Type="String"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Visible"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Appearance"
 | 
			
		||||
		InitialValue="True"
 | 
			
		||||
		Type="Boolean"
 | 
			
		||||
		EditorType="Boolean"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
	#tag ViewProperty
 | 
			
		||||
		Name="Width"
 | 
			
		||||
		Visible=true
 | 
			
		||||
		Group="Position"
 | 
			
		||||
		InitialValue="600"
 | 
			
		||||
		Type="Integer"
 | 
			
		||||
	#tag EndViewProperty
 | 
			
		||||
#tag EndViewBehavior
 | 
			
		||||
							
								
								
									
										17
									
								
								samples/Xojo/database.xojo_script
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								samples/Xojo/database.xojo_script
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
Dim dbFile As FolderItem
 | 
			
		||||
Dim db As New SQLiteDatabase
 | 
			
		||||
dbFile = GetFolderItem("Employees.sqlite")
 | 
			
		||||
db.DatabaseFile = dbFile
 | 
			
		||||
If db.Connect Then
 | 
			
		||||
  db.SQLExecute("BEGIN TRANSACTION")
 | 
			
		||||
  db.SQLExecute ("INSERT INTO Employees (Name,Job,YearJoined) VALUES "_
 | 
			
		||||
    +"('Dr.Strangelove','Advisor',1962)")
 | 
			
		||||
  If db.Error then
 | 
			
		||||
    MsgBox("Error: " + db.ErrorMessage)
 | 
			
		||||
    db.Rollback
 | 
			
		||||
  Else
 | 
			
		||||
    db.Commit
 | 
			
		||||
  End If
 | 
			
		||||
Else
 | 
			
		||||
  MsgBox("The database couldn't be opened. Error: " + db.ErrorMessage)
 | 
			
		||||
End If
 | 
			
		||||
							
								
								
									
										28
									
								
								samples/Zephir/filenames/exception.zep.c
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								samples/Zephir/filenames/exception.zep.c
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_CONFIG_H
 | 
			
		||||
#include "../../ext_config.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <php.h>
 | 
			
		||||
#include "../../php_ext.h"
 | 
			
		||||
#include "../../ext.h"
 | 
			
		||||
 | 
			
		||||
#include <Zend/zend_operators.h>
 | 
			
		||||
#include <Zend/zend_exceptions.h>
 | 
			
		||||
#include <Zend/zend_interfaces.h>
 | 
			
		||||
 | 
			
		||||
#include "kernel/main.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test\Router\Exception
 | 
			
		||||
 *
 | 
			
		||||
 * Exceptions generated by the router
 | 
			
		||||
 */
 | 
			
		||||
ZEPHIR_INIT_CLASS(Test_Router_Exception) {
 | 
			
		||||
 | 
			
		||||
    ZEPHIR_REGISTER_CLASS_EX(Test\\Router, Exception, test, router_exception, zend_exception_get_default(TSRMLS_C), NULL, 0);
 | 
			
		||||
 | 
			
		||||
    return SUCCESS;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								samples/Zephir/filenames/exception.zep.h
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								samples/Zephir/filenames/exception.zep.h
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
 | 
			
		||||
extern zend_class_entry *test_router_exception_ce;
 | 
			
		||||
 | 
			
		||||
ZEPHIR_INIT_CLASS(Test_Router_Exception);
 | 
			
		||||
							
								
								
									
										8
									
								
								samples/Zephir/filenames/exception.zep.php
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								samples/Zephir/filenames/exception.zep.php
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Test\Router;
 | 
			
		||||
 | 
			
		||||
class Exception extends \Exception
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -102,11 +102,21 @@ class TestBlob < Test::Unit::TestCase
 | 
			
		||||
 | 
			
		||||
  def test_encoding
 | 
			
		||||
    assert_equal "ISO-8859-2", blob("Text/README").encoding
 | 
			
		||||
    assert_equal "ISO-8859-2", blob("Text/README").ruby_encoding
 | 
			
		||||
    assert_equal "ISO-8859-1", blob("Text/dump.sql").encoding
 | 
			
		||||
    assert_equal "ISO-8859-1", blob("Text/dump.sql").ruby_encoding
 | 
			
		||||
    assert_equal "UTF-8", blob("Text/foo.txt").encoding
 | 
			
		||||
    assert_equal "UTF-8", blob("Text/foo.txt").ruby_encoding
 | 
			
		||||
    assert_equal "UTF-16LE", blob("Text/utf16le.txt").encoding
 | 
			
		||||
    assert_equal "UTF-16LE", blob("Text/utf16le.txt").ruby_encoding
 | 
			
		||||
    assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").encoding
 | 
			
		||||
    assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").ruby_encoding
 | 
			
		||||
    assert_equal "ISO-2022-KR", blob("Text/ISO-2022-KR.txt").encoding
 | 
			
		||||
    assert_equal "binary", blob("Text/ISO-2022-KR.txt").ruby_encoding
 | 
			
		||||
    assert_nil blob("Binary/dog.o").encoding
 | 
			
		||||
 | 
			
		||||
    assert_equal "windows-1252", blob("Text/Visual_Battlers.rb").encoding
 | 
			
		||||
    assert_equal "Windows-1252", blob("Text/Visual_Battlers.rb").ruby_encoding
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_binary
 | 
			
		||||
@@ -237,6 +247,13 @@ class TestBlob < Test::Unit::TestCase
 | 
			
		||||
    # Generated VCR
 | 
			
		||||
    assert blob("YAML/vcr_cassette.yml").generated?
 | 
			
		||||
 | 
			
		||||
    # Generated by Zephir
 | 
			
		||||
    assert blob("Zephir/filenames/exception.zep.c").generated?
 | 
			
		||||
    assert blob("Zephir/filenames/exception.zep.h").generated?
 | 
			
		||||
    assert blob("Zephir/filenames/exception.zep.php").generated?
 | 
			
		||||
    assert !blob("Zephir/Router.zep").generated?
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    assert Linguist::Generated.generated?("node_modules/grunt/lib/grunt.js", nil)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -261,6 +278,10 @@ class TestBlob < Test::Unit::TestCase
 | 
			
		||||
    # 'thirdparty' directory
 | 
			
		||||
    assert blob("thirdparty/lib/main.c").vendored?
 | 
			
		||||
    
 | 
			
		||||
    # 'extern(al)' directory
 | 
			
		||||
    assert blob("extern/util/__init__.py").vendored?
 | 
			
		||||
    assert blob("external/jquery.min.js").vendored?
 | 
			
		||||
 | 
			
		||||
    # C deps
 | 
			
		||||
    assert blob("deps/http_parser/http_parser.c").vendored?
 | 
			
		||||
    assert blob("deps/v8/src/v8.h").vendored?
 | 
			
		||||
@@ -365,6 +386,10 @@ class TestBlob < Test::Unit::TestCase
 | 
			
		||||
    # NuGet Packages
 | 
			
		||||
    assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
 | 
			
		||||
 | 
			
		||||
    # Html5shiv
 | 
			
		||||
    assert blob("Scripts/html5shiv.js").vendored?
 | 
			
		||||
    assert blob("Scripts/html5shiv.min.js").vendored?
 | 
			
		||||
 | 
			
		||||
    # Test fixtures
 | 
			
		||||
    assert blob("test/fixtures/random.rkt").vendored?
 | 
			
		||||
    assert blob("Test/fixtures/random.rkt").vendored?
 | 
			
		||||
@@ -385,6 +410,11 @@ class TestBlob < Test::Unit::TestCase
 | 
			
		||||
    assert blob("subproject/gradlew").vendored?
 | 
			
		||||
    assert blob("subproject/gradlew.bat").vendored?
 | 
			
		||||
    assert blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
 | 
			
		||||
 | 
			
		||||
    # Octicons
 | 
			
		||||
    assert blob("octicons.css").vendored?
 | 
			
		||||
    assert blob("public/octicons.min.css").vendored?
 | 
			
		||||
    assert blob("public/octicons/sprockets-octicons.scss").vendored?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_language
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user