summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2012-07-18 11:46:41 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2012-07-18 11:46:41 +0200
commita1582d7856bc385b7bad492d8fc3f02e2b9f4d94 (patch)
tree3abdb3a7d6aa00edca62fc5b36cf9a9a8242b245
parenta4b8b094da5525354cb8a927761385825236c5a1 (diff)
downloadcoderay-a1582d7856bc385b7bad492d8fc3f02e2b9f4d94.tar.gz
remove etc folder
-rw-r--r--.gitignore1
-rw-r--r--etc/ansi-color/256colors2.pl63
-rw-r--r--etc/ansi-color/colortable16.sh48
-rw-r--r--etc/check-coderay-gem-stats.sh1
-rw-r--r--etc/check-diffs.rb27
-rw-r--r--etc/coderay-complete.tmproj27
-rw-r--r--etc/coderay-lib.tmproj164
-rw-r--r--etc/coderay.local.tmproj135
-rw-r--r--etc/compare-token-variants.rb33
-rw-r--r--etc/grafix/coderay-favicon.pngbin1973 -> 0 bytes
-rw-r--r--etc/grafix/coderay.icobin2238 -> 0 bytes
-rw-r--r--etc/grafix/languages_over_time.rb28
-rw-r--r--etc/grafix/logo.cdrbin25226 -> 0 bytes
-rw-r--r--etc/grafix/pie_graph.rb243
-rw-r--r--etc/grafix/ruby-chan-coderay-small.cptbin236098 -> 0 bytes
-rw-r--r--etc/grafix/ruby-chan-coderay-small.pngbin37179 -> 0 bytes
-rw-r--r--etc/grafix/ruby-chan-coderay.cptbin753588 -> 0 bytes
-rw-r--r--etc/grafix/ruby-doc-chan.cptbin14375 -> 0 bytes
-rw-r--r--etc/grafix/ruby-doc-chan.gifbin5872 -> 0 bytes
-rw-r--r--etc/grafix/rubychan-blue-top.cptbin168556 -> 0 bytes
-rw-r--r--etc/grafix/rubychan-blue.cptbin470285 -> 0 bytes
-rw-r--r--etc/highlighter-rating.textile39
-rw-r--r--etc/language_report.textile59
-rw-r--r--etc/output_report.textile34
-rw-r--r--etc/raydebug.vim43
-rw-r--r--etc/simple_regexp_scanner.rb449
-rw-r--r--etc/speedup/current.rb132
-rw-r--r--etc/speedup/direct-stream.rb208
-rw-r--r--etc/todo/example.applescript12997
-rw-r--r--etc/todo/example.lua8289
-rw-r--r--etc/todo/example.lua.zipbin48755 -> 0 bytes
-rwxr-xr-xetc/todo/latex.demiurgo.rb79
-rw-r--r--etc/todo/latex.murphy.rb44
-rw-r--r--etc/todo/scanners.zipbin18380 -> 0 bytes
-rw-r--r--etc/todo/scanners/applescript-sebastian.rb219
-rw-r--r--etc/todo/scanners/avrasm.rb153
-rw-r--r--etc/todo/scanners/bash-Anh Ky Huynh.rb131
-rw-r--r--etc/todo/scanners/bash.rb124
-rw-r--r--etc/todo/scanners/clojure-libs.in.clj6820
-rw-r--r--etc/todo/scanners/coderay_lua_lexar.patch193
-rw-r--r--etc/todo/scanners/csharp.rb156
-rw-r--r--etc/todo/scanners/css.rb170
-rw-r--r--etc/todo/scanners/javascript.rb199
-rw-r--r--etc/todo/scanners/lisp.rb102
-rw-r--r--etc/todo/scanners/paste-333 (DIFF).rb88
-rw-r--r--etc/todo/scanners/paste-693 (IO).rb134
-rw-r--r--etc/todo/scanners/php-constants.txt248
-rw-r--r--etc/todo/scanners/php.rb282
-rw-r--r--etc/todo/scanners/php_builtin_functions.txt5075
-rw-r--r--etc/todo/scanners/php_builtin_functions_core.txt526
-rw-r--r--etc/todo/scanners/ruby-inside-regexp-detection.rb455
-rw-r--r--etc/todo/scanners/scheme.rb136
-rw-r--r--etc/todo/scanners/sql.Josh Goebel.rb138
-rw-r--r--etc/todo/scanners/sql.Keith Pitt.rb142
-rw-r--r--etc/todo/scanners/sql.Keith.rb143
-rw-r--r--etc/todo/scanners/vhdl.rb132
-rw-r--r--etc/todo/scanners/yaml.rb105
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/checkpoints/index.html11
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=D;O=A17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=M;O=A17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=N;O=D17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=S;O=A17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventories/index.html11
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventory17
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/patches/index.html18
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/prefs/index.html16
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/_darcs/pristine/index.html13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=A14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=D14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=A14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=D14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=A14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=D14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=A14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=D14
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=D;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=M;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=N;O=D12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=S;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/latex.rb79
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=D;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=M;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=N;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=S;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript.rb199
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript/index.html12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=D12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=D12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=D12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=A12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=D12
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/index.html13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=D;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=M;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=N;O=D13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=S;O=A13
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/test_javascript_scanner.rb104
-rwxr-xr-xetc/todo/www.demiurgo.org/darcs/coderay/test/test_latex_encoder.rb103
-rw-r--r--etc/token_class_hierarchy.rb22
116 files changed, 1 insertions, 40244 deletions
diff --git a/.gitignore b/.gitignore
index a000699..c03ec75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ bench/test.div.html
diff.html
etc/CodeRay.tmproj
*.swp
+etc \ No newline at end of file
diff --git a/etc/ansi-color/256colors2.pl b/etc/ansi-color/256colors2.pl
deleted file mode 100644
index c97c2be..0000000
--- a/etc/ansi-color/256colors2.pl
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/perl
-# Author: Todd Larason <jtl@molehill.org>
-# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
-
-# use the resources for colors 0-15 - usually more-or-less a
-# reproduction of the standard ANSI colors, but possibly more
-# pleasing shades
-
-# colors 16-231 are a 6x6x6 color cube
-for ($red = 0; $red < 6; $red++) {
- for ($green = 0; $green < 6; $green++) {
- for ($blue = 0; $blue < 6; $blue++) {
- printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
- 16 + ($red * 36) + ($green * 6) + $blue,
- ($red ? ($red * 40 + 55) : 0),
- ($green ? ($green * 40 + 55) : 0),
- ($blue ? ($blue * 40 + 55) : 0));
- }
- }
-}
-
-# colors 232-255 are a grayscale ramp, intentionally leaving out
-# black and white
-for ($gray = 0; $gray < 24; $gray++) {
- $level = ($gray * 10) + 8;
- printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
- 232 + $gray, $level, $level, $level);
-}
-
-
-# display the colors
-
-# first the system ones:
-print "System colors:\n";
-for ($color = 0; $color < 8; $color++) {
- print "\x1b[48;5;${color}m ";
-}
-print "\x1b[0m\n";
-for ($color = 8; $color < 16; $color++) {
- print "\x1b[48;5;${color}m ";
-}
-print "\x1b[0m\n\n";
-
-# now the color cube
-print "Color cube, 6x6x6:\n";
-for ($green = 0; $green < 6; $green++) {
- for ($red = 0; $red < 6; $red++) {
- for ($blue = 0; $blue < 6; $blue++) {
- $color = 16 + ($red * 36) + ($green * 6) + $blue;
- print "\x1b[48;5;${color}m ";
- }
- print "\x1b[0m ";
- }
- print "\n";
-}
-
-
-# now the grayscale ramp
-print "Grayscale ramp:\n";
-for ($color = 232; $color < 256; $color++) {
- print "\x1b[48;5;${color}m ";
-}
-print "\x1b[0m\n";
diff --git a/etc/ansi-color/colortable16.sh b/etc/ansi-color/colortable16.sh
deleted file mode 100644
index 6281628..0000000
--- a/etc/ansi-color/colortable16.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-#
-# Description:
-#
-# Prints a color table of 8bg * 8fg * 2 states (regular/bold)
-#
-# Copyright:
-#
-# (C) 2009 Wolfgang Frisch <xororand@unfoog.de>
-#
-# License:
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-echo
-echo Table for 16-color terminal escape sequences.
-echo Replace ESC with \\033 in bash.
-echo
-echo "Background | Foreground colors"
-echo "---------------------------------------------------------------------"
-for((bg=40;bg<=47;bg++)); do
- for((bold=0;bold<=1;bold++)) do
- echo -en "\033[0m"" ESC[${bg}m | "
- for((fg=30;fg<=37;fg++)); do
- if [ $bold == "0" ]; then
- echo -en "\033[${bg}m\033[${fg}m [${fg}m "
- else
- echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m"
- fi
- done
- echo -e "\033[0m"
- done
- echo "--------------------------------------------------------------------- "
-done
-
-echo
-echo
diff --git a/etc/check-coderay-gem-stats.sh b/etc/check-coderay-gem-stats.sh
deleted file mode 100644
index a889e40..0000000
--- a/etc/check-coderay-gem-stats.sh
+++ /dev/null
@@ -1 +0,0 @@
-curl http://gems.rubyforge.org/stats.html 2>/dev/null | grep -n ">coderay<"
diff --git a/etc/check-diffs.rb b/etc/check-diffs.rb
deleted file mode 100644
index 8bc66ca..0000000
--- a/etc/check-diffs.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-DIFF_PART = /
-^ ([\d,]+c[\d,]+) \n # change
-( (?: < .* \n )+ ) # old
----\n
-( (?: > .* \n )+ ) # new
-/x
-
-class String
- def undiff!
- gsub!(/^./, '')
- end
-end
-
-for diff in Dir['*.debug.diff']
- puts diff
- diff = File.read diff
- diff.scan(/#{DIFF_PART}|(.+)/o) do |change, old, new, error|
- raise error if error
- old.undiff!
- new.undiff!
-
- new.gsub!('inline_delimiter', 'delimiter')
- unless new == old
- raise "\n>>>\n#{new}\n<<<#{old}\n"
- end
- end
-end \ No newline at end of file
diff --git a/etc/coderay-complete.tmproj b/etc/coderay-complete.tmproj
deleted file mode 100644
index 2597bf4..0000000
--- a/etc/coderay-complete.tmproj
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>documents</key>
- <array>
- <dict>
- <key>expanded</key>
- <true/>
- <key>name</key>
- <string>coderay</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>..</string>
- </dict>
- </array>
- <key>fileHierarchyDrawerWidth</key>
- <integer>312</integer>
- <key>metaData</key>
- <dict/>
- <key>showFileHierarchyDrawer</key>
- <true/>
- <key>windowFrame</key>
- <string>{{1, 4}, {952, 774}}</string>
-</dict>
-</plist>
diff --git a/etc/coderay-lib.tmproj b/etc/coderay-lib.tmproj
deleted file mode 100644
index 0059e82..0000000
--- a/etc/coderay-lib.tmproj
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>documents</key>
- <array>
- <dict>
- <key>name</key>
- <string>lib</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../lib</string>
- </dict>
- <dict>
- <key>name</key>
- <string>bin</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../bin</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../diff</string>
- <key>lastUsed</key>
- <date>2011-04-20T01:01:25Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../test/scanners/diff.diff</string>
- <key>lastUsed</key>
- <date>2011-04-20T00:07:56Z</date>
- <key>selected</key>
- <true/>
- </dict>
- <dict>
- <key>filename</key>
- <string>../Changes.textile</string>
- <key>lastUsed</key>
- <date>2011-04-17T14:00:09Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../FOLDERS</string>
- <key>lastUsed</key>
- <date>2010-05-12T09:03:46Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../TODO</string>
- <key>lastUsed</key>
- <date>2010-06-27T05:41:28Z</date>
- </dict>
- <dict>
- <key>name</key>
- <string>etc</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle|log|aux))$</string>
- <key>sourceDirectory</key>
- <string></string>
- </dict>
- <dict>
- <key>name</key>
- <string>gem_server</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../gem_server</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../IDEA</string>
- <key>lastUsed</key>
- <date>2010-03-31T03:59:05Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../LICENSE</string>
- <key>lastUsed</key>
- <date>2010-09-19T16:21:59Z</date>
- </dict>
- <dict>
- <key>name</key>
- <string>rake_helpers</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../rake_helpers</string>
- </dict>
- <dict>
- <key>name</key>
- <string>rake_tasks</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../rake_tasks</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../Rakefile</string>
- <key>lastUsed</key>
- <date>2010-11-21T14:08:49Z</date>
- </dict>
- <dict>
- <key>name</key>
- <string>executable</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|vendor/plugins|index|doc|public/images|_darcs|_MTN|\{arch\}|blib|coverage|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle|log|aux|gem))$</string>
- <key>sourceDirectory</key>
- <string>../test/executable</string>
- </dict>
- <dict>
- <key>name</key>
- <string>functional</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../test/functional</string>
- </dict>
- <dict>
- <key>children</key>
- <array>
- <dict>
- <key>filename</key>
- <string>../test/scanners/coderay_suite.rb</string>
- <key>lastUsed</key>
- <date>2011-03-01T00:15:35Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../test/scanners/suite.rb</string>
- <key>lastUsed</key>
- <date>2011-03-01T00:06:06Z</date>
- </dict>
- </array>
- <key>name</key>
- <string>scanners</string>
- </dict>
- <dict>
- <key>name</key>
- <string>unit</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|vendor/plugins|index|doc|public/images|_darcs|_MTN|\{arch\}|blib|coverage|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle|log|aux|gem))$</string>
- <key>sourceDirectory</key>
- <string>../test/unit</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../bench/bench.rb</string>
- <key>lastUsed</key>
- <date>2011-04-17T14:00:13Z</date>
- </dict>
- </array>
- <key>fileHierarchyDrawerWidth</key>
- <integer>204</integer>
- <key>metaData</key>
- <dict/>
- <key>showFileHierarchyDrawer</key>
- <true/>
- <key>windowFrame</key>
- <string>{{214, 4}, {1066, 774}}</string>
-</dict>
-</plist>
diff --git a/etc/coderay.local.tmproj b/etc/coderay.local.tmproj
deleted file mode 100644
index 2bab8dc..0000000
--- a/etc/coderay.local.tmproj
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>documents</key>
- <array>
- <dict>
- <key>name</key>
- <string>lib</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../lib</string>
- </dict>
- <dict>
- <key>name</key>
- <string>bin</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../bin</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../FOLDERS</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../ftp.yaml</string>
- </dict>
- <dict>
- <key>name</key>
- <string>etc</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle|log|aux))$</string>
- <key>sourceDirectory</key>
- <string></string>
- </dict>
- <dict>
- <key>name</key>
- <string>gem_server</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../gem_server</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../IDEA</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../LICENSE</string>
- </dict>
- <dict>
- <key>name</key>
- <string>pkg</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../pkg</string>
- </dict>
- <dict>
- <key>name</key>
- <string>rake_helpers</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../rake_helpers</string>
- </dict>
- <dict>
- <key>expanded</key>
- <true/>
- <key>name</key>
- <string>rake_tasks</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../rake_tasks</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../Rakefile</string>
- <key>lastUsed</key>
- <date>2009-02-17T22:35:06Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../diff</string>
- <key>lastUsed</key>
- <date>2009-02-20T17:38:28Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../TODO</string>
- <key>lastUsed</key>
- <date>2008-11-06T18:26:56Z</date>
- </dict>
- <dict>
- <key>name</key>
- <string>functional</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string>../test/functional</string>
- </dict>
- <dict>
- <key>filename</key>
- <string>../test/scanners/coderay_suite.rb</string>
- <key>lastUsed</key>
- <date>2009-02-16T04:31:36Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../test/scanners/suite.rb</string>
- <key>lastUsed</key>
- <date>2008-08-04T21:50:01Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../bench/bench.rb</string>
- <key>lastUsed</key>
- <date>2009-02-16T04:36:24Z</date>
- </dict>
- </array>
- <key>fileHierarchyDrawerWidth</key>
- <integer>200</integer>
- <key>metaData</key>
- <dict/>
- <key>showFileHierarchyDrawer</key>
- <true/>
- <key>windowFrame</key>
- <string>{{0, 4}, {1070, 774}}</string>
-</dict>
-</plist>
diff --git a/etc/compare-token-variants.rb b/etc/compare-token-variants.rb
deleted file mode 100644
index a4edd83..0000000
--- a/etc/compare-token-variants.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require "benchmark"
-require "strscan"
-
-TESTS = 2_000_000
-S = 'begin ' * TESTS
-r = /begin /
-
-len = nil
-Benchmark.bm 20 do |results|
- results.report 'string' do
- s = StringScanner.new S
- a = []
- while matched = s.scan(r)
- a << [matched, :test]
- end
- end
- results.report 'length' do
- s = StringScanner.new S
- a = []
- while len = s.skip(r)
- a << [len, :test]
- end
- end
- results.report 'two arrays' do
- s = StringScanner.new S
- a = []
- b = []
- while matched = s.scan(r)
- a << len
- b << :test
- end
- end
-end \ No newline at end of file
diff --git a/etc/grafix/coderay-favicon.png b/etc/grafix/coderay-favicon.png
deleted file mode 100644
index f855521..0000000
--- a/etc/grafix/coderay-favicon.png
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/coderay.ico b/etc/grafix/coderay.ico
deleted file mode 100644
index 1469b39..0000000
--- a/etc/grafix/coderay.ico
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/languages_over_time.rb b/etc/grafix/languages_over_time.rb
deleted file mode 100644
index bcebfcc..0000000
--- a/etc/grafix/languages_over_time.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-require 'rubygems'
-require 'gruff'
-
-g = Gruff::Line.new
-g.title = 'Supported Languages in CodeRay'
-g.hide_dots = true
-
-data, labels = [0], {}
-repo_creation = Date.parse `svn info -r1`[/Last Changed Date: ([-\d]+)/,1]
-index = 1
-$stdout.sync = true
-for day in repo_creation..Date.today
- if day.mday == 1 # only check on 1st day of the month
- labels[index] = day.year.to_s if day.month == 1
- index += 1
- data << `svn ls lib/coderay/scanners -r{#{day}} | \\
- grep '^[[:alpha:]]\\w\\+.rb' | wc -l`.to_i
- print day, "\r"
- end
-end
-puts
-
-g.data 'CodeRay', data
-g.labels = labels
-
-FILE = 'test/scanners/languages_over_time.png'
-g.write FILE
-`open #{FILE}`
diff --git a/etc/grafix/logo.cdr b/etc/grafix/logo.cdr
deleted file mode 100644
index 6dc8ff9..0000000
--- a/etc/grafix/logo.cdr
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/pie_graph.rb b/etc/grafix/pie_graph.rb
deleted file mode 100644
index f34a68f..0000000
--- a/etc/grafix/pie_graph.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-require 'rubygems'
-require 'gruff'
-
-g = Gruff::Pie.new
-g.title = 'CodeRay Scanner tests'
-
-data = {}
-other = 0
-DATA.read.scan(/>> Testing (.*?) scanner <<.*?^Finished in ([\d.]+)s/m) do |lang, secs|
- secs = secs.to_f
- if secs > 2
- data[lang] = secs
- else
- p lang
- other += secs
- end
-end
-
-g.add_color '#ff9966'
-g.add_color '#889977'
-g.add_color '#dd77aa'
-g.add_color '#bbddaa'
-g.add_color '#aa8888'
-g.add_color '#77dd99'
-g.add_color '#555555'
-g.add_color '#eecccc'
-data.sort_by { |k, v| v }.reverse_each do |lang, secs|
- g.data lang, secs
-end
-
-g.data 'other', other if other > 0
-p other
-
-FILE = 'test/scanners/tests_pie.png'
-g.write FILE
-`open #{FILE}`
-
-__END__
-~/ruby/coderay norandom=1 rake test:scanners
-(in /Users/murphy/ruby/coderay)
-Loaded suite CodeRay::Scanners
-Started
-
- >> Testing C scanner <<
-
-Loading examples in test/scanners/c/*.in.c...7 examples found.
- elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- empty 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- error 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- error2 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- open-string 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- ruby 2297.4K: incremental, shuffled, complete, identity, highlighting, finished in 5.62s ( 115 Ktok/s).
- strange 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 110 Ktok/s).
-Finished in 15.59s.
-.
- >> Testing C++ scanner <<
-
-Loading examples in test/scanners/cpp/*.in.cpp...4 examples found.
- elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- eventmachine 180.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.24s ( 133 Ktok/s).
- pleac 57.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 137 Ktok/s).
- wedekind 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
-Finished in 1.75s.
-.
- >> Testing CSS scanner <<
-
-Loading examples in test/scanners/css/*.in.css...5 examples found.
- ignos-draconis 28.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 127 Ktok/s).
- redmine 22.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.06s ( 125 Ktok/s).
- S5 7.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 131 Ktok/s).
- standard 0.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- yui 380.1K: incremental, shuffled, complete, identity, highlighting, finished in 1.07s ( 96 Ktok/s).
-Finished in 7.88s.
-.
- >> Testing CodeRay Token Dump scanner <<
-
-Loading examples in test/scanners/debug/*.in.raydebug...2 examples found.
- class 1.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 119 Ktok/s).
- kate 8.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 125 Ktok/s).
-Finished in 1.72s.
-.
- >> Testing Delphi scanner <<
-
-Loading examples in test/scanners/delphi/*.in.pas...2 examples found.
- pluto 278.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.81s ( 93 Ktok/s).
- ytools 64.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.36s ( 64 Ktok/s).
-Finished in 3.64s.
-.
- >> Testing diff output scanner <<
-
-Loading examples in test/scanners/diff/*.in.diff...2 examples found.
-coderay200vs250 66.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.05s ( 188 Ktok/s).
- example 0.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
-Finished in 0.69s.
-.
- >> Testing Groovy scanner <<
-
-Loading examples in test/scanners/groovy/*.in.groovy...4 examples found.
- pleac 381.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.87s ( 88 Ktok/s).
- raistlin77 14.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.03s ( 124 Ktok/s).
- strange 0.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- strings 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 120 Ktok/s).
-Finished in 4.60s.
-.
- >> Testing HTML scanner <<
-
-Loading examples in test/scanners/html/*.in.html...3 examples found.
- ampersand 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- coderay-output 123.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.32s ( 137 Ktok/s).
- tolkien 12.3K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 144 Ktok/s).
-Finished in 2.20s.
-.
- >> Testing Java scanner <<
-
-Loading examples in test/scanners/java/*.in.java...1 example found.
- jruby 1854.9K: incremental, shuffled, complete, identity, highlighting, finished in 3.62s ( 120 Ktok/s).
-Finished in 7.98s.
-.
- >> Testing JavaScript scanner <<
-
-Loading examples in test/scanners/javascript/*.in.js...5 examples found.
- prototype 126.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.35s ( 122 Ktok/s).
-script.aculo.us 225.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.59s ( 126 Ktok/s).
- sun-spider 916.0K: incremental, shuffled, complete, identity, highlighting, finished in 1.82s ( 110 Ktok/s).
- trace-test 151.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.41s ( 133 Ktok/s).
- xml 0.1K: incremental, shuffled, ticket ?, identity, highlighting, finished in 0.00s.
- KNOWN ISSUE: JavaScript scanner is confused by nested XML literals.
- No ticket yet. Visit http://odd-eyed-code.org/projects/coderay/issues/new.
-Finished in 10.07s.
-.
- >> Testing JSON scanner <<
-
-Loading examples in test/scanners/json/*.in.json...4 examples found.
- big 9.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 166 Ktok/s).
- big2 7.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 173 Ktok/s).
- example 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- json-lib 1.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 163 Ktok/s).
-Finished in 3.85s.
-.
- >> Testing Nitro XHTML scanner <<
-
-Loading examples in test/scanners/nitro/*.in.xhtml...1 example found.
- tags 2.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 109 Ktok/s).
-Finished in 1.74s.
-.
- >> Testing PHP scanner <<
-
-Loading examples in test/scanners/php/*.in.php...7 examples found.
- class 1.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 112 Ktok/s).
- elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
-html+php_faulty 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- labels 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- pleac 145.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.59s ( 63 Ktok/s).
- strings 9.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 119 Ktok/s).
- test 16.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.03s ( 114 Ktok/s).
-Finished in 5.18s.
-.
- >> Testing Python scanner <<
-
-Loading examples in test/scanners/python/*.in.py...6 examples found.
- import 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 135 Ktok/s).
- literals 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- pleac 297.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.60s ( 133 Ktok/s).
- pygments 953.6K: incremental, shuffled, complete, identity, highlighting, finished in 2.55s ( 118 Ktok/s).
- python3 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- unistring 394.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.99s ( 69 Ktok/s).
-Finished in 11.30s.
-.
- >> Testing HTML ERB Template scanner <<
-
-Loading examples in test/scanners/rhtml/*.in.rhtml...1 example found.
- day 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
-Finished in 0.91s.
-.
- >> Testing Ruby scanner <<
-
-Loading examples in test/scanners/ruby/*.in.rb...26 examples found.
- 1 18.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 112 Ktok/s).
- besetzung 1.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 103 Ktok/s).
- class 1.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 106 Ktok/s).
- comment 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- diffed 0.9K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- evil 15.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.06s ( 99 Ktok/s).
- example 100.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.21s ( 109 Ktok/s).
- jarh 11.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.04s ( 110 Ktok/s).
- nested-heredoc 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- open-heredoc 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- open-inline 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- open-string 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
- operators 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- pleac 156.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.37s ( 110 Ktok/s).
- quotes 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- rails 2634.1K: incremental, shuffled, complete, identity, highlighting, finished in 5.61s ( 94 Ktok/s).
- regexp 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- ruby19 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- sidebarize 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 35 Ktok/s).
- simple 0.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- strange 17.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.10s ( 91 Ktok/s).
- test-fitter 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- tk-calc 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- undef 0.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- unicode 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- zero 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
-Finished in 33.82s.
-.
- >> Testing Scheme scanner <<
-
-Loading examples in test/scanners/scheme/*.in.scm...2 examples found.
- pleac 143.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.27s ( 141 Ktok/s).
- strange 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 129 Ktok/s).
-Finished in 1.91s.
-.
- >> Testing SQL scanner <<
-
-Loading examples in test/scanners/sql/*.in.sql...4 examples found.
- create_tables 3.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 142 Ktok/s).
- maintenance 1.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- reference 2.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 145 Ktok/s).
- selects 1.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 140 Ktok/s).
-Finished in 2.22s.
-.
- >> Testing XML scanner <<
-
-Loading examples in test/scanners/xml/*.in.xml...1 example found.
- kate 3.9K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 148 Ktok/s).
-Finished in 0.92s.
-.
- >> Testing YAML scanner <<
-
-Loading examples in test/scanners/yaml/*.in.yml...8 examples found.
- basic 24.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 121 Ktok/s).
- database 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- faq 16.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 123 Ktok/s).
- gemspec 3.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 115 Ktok/s).
- latex_entities 48.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.08s ( 143 Ktok/s).
- multiline 0.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
- threshold 22.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 113 Ktok/s).
- website 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 109 Ktok/s).
-Finished in 5.33s.
-.
-Finished in 123.310808 seconds.
-
-20 tests, 0 assertions, 0 failures, 0 errors
diff --git a/etc/grafix/ruby-chan-coderay-small.cpt b/etc/grafix/ruby-chan-coderay-small.cpt
deleted file mode 100644
index f6f6d78..0000000
--- a/etc/grafix/ruby-chan-coderay-small.cpt
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/ruby-chan-coderay-small.png b/etc/grafix/ruby-chan-coderay-small.png
deleted file mode 100644
index 2602789..0000000
--- a/etc/grafix/ruby-chan-coderay-small.png
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/ruby-chan-coderay.cpt b/etc/grafix/ruby-chan-coderay.cpt
deleted file mode 100644
index 1e0f33b..0000000
--- a/etc/grafix/ruby-chan-coderay.cpt
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/ruby-doc-chan.cpt b/etc/grafix/ruby-doc-chan.cpt
deleted file mode 100644
index e85c4ff..0000000
--- a/etc/grafix/ruby-doc-chan.cpt
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/ruby-doc-chan.gif b/etc/grafix/ruby-doc-chan.gif
deleted file mode 100644
index 8b9127c..0000000
--- a/etc/grafix/ruby-doc-chan.gif
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/rubychan-blue-top.cpt b/etc/grafix/rubychan-blue-top.cpt
deleted file mode 100644
index e3711b5..0000000
--- a/etc/grafix/rubychan-blue-top.cpt
+++ /dev/null
Binary files differ
diff --git a/etc/grafix/rubychan-blue.cpt b/etc/grafix/rubychan-blue.cpt
deleted file mode 100644
index a1e4c03..0000000
--- a/etc/grafix/rubychan-blue.cpt
+++ /dev/null
Binary files differ
diff --git a/etc/highlighter-rating.textile b/etc/highlighter-rating.textile
deleted file mode 100644
index ece3e26..0000000
--- a/etc/highlighter-rating.textile
+++ /dev/null
@@ -1,39 +0,0 @@
-h1=. Star Ratings for Syntax Highlighter Language Support (Draft)
-
-p={font-style: italic}. murphy 2008-11-06, updated 2008-12-25
-
-h2. Abstract
-
-A proposal for a simple, 6-level star rating to estimate a syntax highlighters' support of a given language.
-
-h2. Levels
-
-I propose five levels, which can be represented with 0 to 5 out of 5 stars:
-
-|_=. Name |_=. Level |_. Stars |
-|>. No support |=. 0 | ☆☆☆☆☆ |
-|>. Poor support |=. 1 | ★☆☆☆☆ |
-|>. Basic support |=. 2 | ★★☆☆☆ |
-|>. Good support |=. 3 | ★★★☆☆ |
-|>. Very good support |=. 4 | ★★★★☆ |
-|>. Perfect support |=. 5 | ★★★★★ |
-
-h3. Definition
-
-Each rating has an associated support percentage and a short description.
-
-|_<. Name |_. Stars |_>. % |_<. Description |
-| No support | ☆☆☆☆☆ |>. 0 | Missing, broken, or useless. |
-| Poor support | ★☆☆☆☆ |>. 70 | Highlights average code, fails on complex code, hangs up, buggy. |
-| Basic support | ★★☆☆☆ |>. 90 | Good highlighting for typical code, problems with complex code. |
-| Good support | ★★★☆☆ |>. 98 | Solid highlighting for most code, some problems with very complex code. |
-| Very good support | ★★★★☆ |>. 99 | Perfect highlighting even for complex code, only small problems with edge cases. |
-| Perfect support | ★★★★★ |>. 100 | Complete highlighting, can be used as reference. |
-
-h2. Rating Process
-
-The star ratings are defined above. It is completely up to the author of a scanner to rate their work.
-
-However, they should be careful not to overrate a scanner/lexer. Ratings of 2 and up should only be granted for tested code. A rating of 3 should not be given without a review of another person who knows the language very well. A rating of 5 is very rare for complex languages; such scanners should be bug free, feature complete, and absolutely reliable. A rating of 4 is typically the goal for a developer.
-
-
diff --git a/etc/language_report.textile b/etc/language_report.textile
deleted file mode 100644
index 613f480..0000000
--- a/etc/language_report.textile
+++ /dev/null
@@ -1,59 +0,0 @@
-h1. CodeRay Missing Languages Report
-
-This is a list of input formats for highlighters, comparing Pygments with
-CodeRay.
-
-h2. Lexers / Scanners
-
-h3. Supported by both
-
-* C
-* Delphi/Pascal
-* HTML
-* RHTML
-* Ruby
-* XML
-* JavaScript
-* CSS
-* PHP
-* Diff
-* SQL
-
-
-h3. Only in CodeRay
-
-* Raydebug
-* Nitro-XHTML
-
-h3. Only in Pygments, but soon in CodeRay
-
-h3. Soon only in CodeRay
-
-* IO
-* YAML
-
-h3. Only in Pygments
-
-* Boo
-* Brainfuck
-* C++
-* C#
-* Smarty
-* Django
-* Ini
-* IRC
-* Lua
-* Makefile
-* Perl
-* Python
-* VisualBasic
-* TeX
-* Python Console (pycon)
-* Ruby Console (irb)
-
-h3. Missing totally
-
-* Haskell
-* BBCode
-* Wikicode
-* JSON \ No newline at end of file
diff --git a/etc/output_report.textile b/etc/output_report.textile
deleted file mode 100644
index 2d8d5a2..0000000
--- a/etc/output_report.textile
+++ /dev/null
@@ -1,34 +0,0 @@
-h1. CodeRay Missing Outputs Report
-
-This is a list of output formats for highlighters, comparing Pygments with
-CodeRay.
-
-h2. Formatters / Encoders
-
-h3. Supported by both
-
-* HTML
-* Tokens (named raw in Pygments, raydebug or debug in CodeRay)
-* Text
-
-h3. Only in CodeRay
-
-* Statistic and Counter
-* Span, Div, Page (HTML variants)
-* XML
-* YAML
-
-h3. Only in Pygments, but soon in CodeRay
-
-h3. Soon only in CodeRay
-
-h3. Only in Pygments
-
-* LaTeX
-* ANSI Console (very useful!)
-* BBCode
-
-h3. Missing totally
-
-* PDF
-* RTF (do we need this?) \ No newline at end of file
diff --git a/etc/raydebug.vim b/etc/raydebug.vim
deleted file mode 100644
index 2a1a4da..0000000
--- a/etc/raydebug.vim
+++ /dev/null
@@ -1,43 +0,0 @@
-" vim syntax file
-" Language: BBCode
-" Maintainer: Kornelius Kalnbach <murphy@rubychan.de>
-" Last Change: 2004 Dec 12
-
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
- finish
-endif
-
-syn case ignore
-
-
-syn match rayKind /\w\+(\@=/
-syn match rayRegion /\w\+<\@=/
-
-syn match rayRegionParen /[<>]/
-
-syn region rayText matchgroup=rayParen start='(' end=')' skip=/\\./
-
-" Define the default highlighting.
-" For version 5.7 and earlier: only when not done already
-" For version 5.8 and later: only when an item doesn't have highlighting yet
-if version >= 508 || !exists("did_raydebug_syn_inits")
- if version < 508
- let did_raydebug_syn_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
-
- hi link rayKind Type
- hi link rayRegion Statement
- hi link rayRegionParen Statement
-
- hi link rayText Constant
- hi link rayTextParen Operator
-
- delcommand HiLink
-endif
diff --git a/etc/simple_regexp_scanner.rb b/etc/simple_regexp_scanner.rb
deleted file mode 100644
index e89460e..0000000
--- a/etc/simple_regexp_scanner.rb
+++ /dev/null
@@ -1,449 +0,0 @@
-# SimpleRegexpScanner is a scanner for simple regular expressions.
-#
-# Written by murphy (Kornelius Kalnbach), September 2008.
-#
-# Released under LGPL, see http://www.gnu.org/licenses/lgpl.html.
-
-require 'strscan'
-
-# A very simple scanner that can parse a subset of regular expressions. It can parse:
-# - Literals: A (including empty words)
-# - Groups: (A)
-# - Concatenations: AB
-# - Alternatives: A|B
-# - Options: (A)? (for groups only!)
-#
-# Usage:
-# srs = SimpleRegexpScanner.new('(A)?(B|C)')
-# p srs.list #=> ['AB', 'AC', 'B', 'C']
-class SimpleRegexpScanner < StringScanner
-
- # Returns an Array of all possible strings that would fit the given regexp.
- def list
- scan_union.uniq
- end
-
-protected
- def scan_group # :nodoc:
- scan(/\(/) or return
- options = scan_union
- scan(/\)/) or raise ') expected at end of group'
- options << '' if scan(/\?/)
- options
- end
-
- def scan_union # :nodoc:
- options = scan_concatenation
- options += scan_union if scan(/\|/)
- options.uniq
- end
-
- def scan_concatenation # :nodoc:
- options = scan_group || [scan(/[^(|)?]*/)]
- if check(/[^|)]/)
- suffixes = scan_concatenation
- options.map! do |option|
- suffixes.map { |suffix| option + suffix }
- end.flatten!
- end
- options
- end
-
-end
-
-if $0 == __FILE__
- $VERBOSE = true
- eval DATA.read, nil, $0, __LINE__ + 4
-end
-
-__END__
-require 'test/unit'
-
-class SimpleRegexpScannerTest < Test::Unit::TestCase
-
- def assert_scans_list regexp, list
- assert_equal list, SimpleRegexpScanner.new(regexp).list
- end
-
- def assert_scans_list_size regexp, size
- assert_equal size, SimpleRegexpScanner.new(regexp).list.size
- end
-
- def test_simple
- assert_scans_list '', ['']
- assert_scans_list '()', ['']
- assert_scans_list '|', ['']
- assert_scans_list 'A', ['A']
- assert_scans_list 'A|B', ['A', 'B']
- assert_scans_list '(A)', ['A']
- assert_scans_list '(A)B', ['AB']
- assert_scans_list 'A(B)', ['AB']
- end
-
- def test_complex
- assert_scans_list 'A|', ['A', '']
- assert_scans_list '|A', ['', 'A']
- assert_scans_list '(((|(((|))))|)|)', ['']
- assert_scans_list '(A|B)', ['A', 'B']
- assert_scans_list '(A)?', ['A', '']
- assert_scans_list '(A|B)?', ['A', 'B', '']
- assert_scans_list 'A(B)?', ['AB', 'A']
- assert_scans_list '(A(B(C|D))?)?', ['ABC', 'ABD', 'A', '']
- end
-
- def test_deep_recusion
- n = 1_000
- assert_nothing_raised do
- assert_scans_list '(' * n + ')' * n, ['']
- end
- n = 10_000
- assert_raise SystemStackError do
- assert_scans_list '(' * n + ')' * n, ['']
- end
- end
-
- JAVA_BUILTIN_TYPES = <<-TYPES.delete(" \n")
- (R(GBImageFilter|MI(S(ocketFactory|e(curity(Manager|Exception)|rver(SocketFactor
- y|Impl(_Stub)?)?))|C(onnect(ion(Impl(_Stub)?)?|or(Server)?)|l(ientSocketFactory|
- assLoader(Spi)?))|IIOPServerImpl|JRMPServerImpl|FailureHandler)|SA(MultiPrimePri
- vateCrtKey(Spec)?|OtherPrimeInfo|P(ublicKey(Spec)?|rivate(CrtKey(Spec)?|Key(Spec
- )?))|Key(GenParameterSpec)?)|o(otPane(Container|UI)|und(Rectangle2D|ingMode)|w(M
- apper|Set(Reader|MetaData(Impl)?|Internal|Event|W(arning|riter)|Listener)?)|le(R
- esult|Status|NotFoundException|Info(NotFoundException)?|Unresolved(List)?|List)?
- |bot)|dn|C(2ParameterSpec|5ParameterSpec)|u(n(nable|time(M(XBean|BeanException)|
- OperationsException|Permission|E(rrorException|xception))?)|leBasedCollator)|TFE
- ditorKit|e(s(caleOp|o(urceBundle|l(utionSyntax|ve(Result|r)))|ult(Set(MetaData)?
- )?|ponseCache)|nder(ingHints|Context|e(dImage(Factory)?|r)|ableImage(Op|Producer
- )?)|c(tang(ularShape|le(2D)?)|eiver)|tention(Policy)?|jectedExecution(Handler|Ex
- ception)|p(licateScaleFilter|aintManager)|entrant(ReadWriteLock|Lock)|verbType|q
- u(iredModelMBean|estingUserName)|f(er(ence(UriSchemesSupported|able|Queue)?|ralE
- xception)|lect(ionException|Permission)|resh(able|FailedException)|Addr)?|lation
- (S(upport(MBean)?|ervice(MBean|NotRegisteredException)?)|Not(ification|FoundExce
- ption)|Type(Support|NotFoundException)?|Exception)?|a(d(er|OnlyBufferException|a
- ble(ByteChannel)?|WriteLock)|lmC(hoiceCallback|allback))|gi(st(erableService|ry(
- Handler)?)|on)|mote(Ref|S(tub|erver)|Call|Object(InvocationHandler)?|Exception)?
- )|a(ster(Op|FormatException)?|ndom(Access(File)?)?))|G(uard(edObject)?|ener(ic(S
- ignatureFormatError|Declaration|ArrayType)|al(SecurityException|Path))|ZIP(Input
- Stream|OutputStream)|lyph(Metrics|JustificationInfo|V(iew|ector))|a(theringByteC
- hannel|ugeMonitor(MBean)?|pContent|rbageCollectorMXBean)|r(id(Bag(Constraints|La
- yout)|Layout)|oup|egorianCalendar|a(yFilter|dientPaint|phic(s(2D|Config(uration|
- Template)|Device|Environment)?|Attribute))))|X(ML(GregorianCalendar|Constants|De
- coder|ParseException|Encoder|Formatter)|id|Path(Constants|Ex(ception|pression(Ex
- ception)?)|VariableResolver|F(unction(Resolver|Exception)?|actory(ConfigurationE
- xception)?))?|50(9(C(RL(Selector|Entry)?|ert(ificate|Selector))|TrustManager|E(n
- codedKeySpec|xten(sion|dedKeyManager))|KeyManager)|0Pri(ncipal|vateCredential))|
- ml(Reader|Writer)|A(Resource|Connection|DataSource|Exception))|M(GF1ParameterSpe
- c|Bean(Registration(Exception)?|Server(Builder|Notification(Filter)?|Connection|
- InvocationHandler|Delegate(MBean)?|Permission|F(orwarder|actory))?|NotificationI
- nfo|ConstructorInfo|TrustPermission|Info|OperationInfo|P(ermission|arameterInfo)
- |Exception|FeatureInfo|AttributeInfo)|i(ssing(ResourceException|Format(WidthExce
- ption|ArgumentException))|nimalHTMLWriter|di(Message|System|Channel|Device(Provi
- der)?|UnavailableException|Event|File(Reader|Format|Writer))|xer(Provider)?|meTy
- peParseException)|o(nitor(MBean|SettingException|Notification)?|d(ifi(cationItem
- |er)|elMBean(Notification(Broadcaster|Info)|ConstructorInfo|Info(Support)?|Opera
- tionInfo|AttributeInfo)?)|use(Motion(Listener|Adapter)|In(put(Listener|Adapter)|
- fo)|DragGestureRecognizer|Event|Wheel(Event|Listener)|Listener|Adapter))|u(table
- (ComboBoxModel|TreeNode|AttributeSet)|lti(RootPaneUI|castSocket|Menu(BarUI|ItemU
- I)|ButtonUI|S(croll(BarUI|PaneUI)|p(innerUI|litPaneUI)|eparatorUI|liderUI)|Co(lo
- rChooserUI|mboBoxUI)|T(ool(BarUI|TipUI)|extUI|ab(le(HeaderUI|UI)|bedPaneUI)|reeU
- I)|InternalFrameUI|ple(Master|DocumentHandling)|OptionPaneUI|D(oc(Print(Service|
- Job))?|esktop(IconUI|PaneUI))|P(ixelPackedSampleModel|opupMenuUI|anelUI|rogressB
- arUI)|ViewportUI|FileChooserUI|L(istUI|ookAndFeel|abelUI)))|e(ssage(Digest(Spi)?
- |Format)|nu(Bar(UI)?|S(hortcut|electionManager)|Co(ntainer|mponent)|Item(UI)?|Dr
- agMouse(Event|Listener)|E(vent|lement)|Key(Event|Listener)|Listener)?|t(hod(Desc
- riptor)?|a(Message|EventListener|l(R(ootPaneUI|adioButtonUI)|MenuBarUI|B(orders|
- uttonUI)|S(croll(B(utton|arUI)|PaneUI)|plitPaneUI|eparatorUI|liderUI)|C(heckBox(
- Icon|UI)|omboBox(Button|Icon|UI|Editor))|T(heme|o(ol(BarUI|TipUI)|ggleButtonUI)|
- extFieldUI|abbedPaneUI|reeUI)|I(nternalFrame(TitlePane|UI)|conFactory)|DesktopIc
- onUI|P(opupMenuSeparatorUI|rogressBarUI)|FileChooserUI|L(ookAndFeel|abelUI))))|d
- ia(Size(Name)?|Name|Tra(y|cker)|PrintableArea)?|m(ory(M(XBean|anagerMXBean)|Hand
- ler|NotificationInfo|CacheImage(InputStream|OutputStream)|Type|ImageSource|Usage
- |PoolMXBean)|ber))|a(skFormatter|n(ifest|age(ReferralControl|rFactoryParameters|
- ment(Permission|Factory)))|c(Spi)?|t(h(Context)?|ch(Result|er)|teBorder)|p(pedBy
- teBuffer)?|lformed(InputException|ObjectNameException|URLException|Parameterized
- TypeException|LinkException)|rshal(Exception|ledObject))|Let(MBean)?)|B(yte(Buff
- er|Channel|Order|LookupTable|Array(InputStream|OutputStream))?|MPImageWriteParam
- |i(n(d(ing|Exception)|aryRefAddr)|tSet|di|g(Integer|Decimal))|o(o(k|lean(Control
- )?)|undedRangeModel|rder(UIResource|Factory|Layout)?|x(View|Layout)?)|u(tton(Gro
- up|Model|UI)?|ffer(Strategy|Capabilities|ed(Reader|I(nputStream|mage(Op|Filter)?
- )|OutputStream|Writer)|OverflowException|UnderflowException)?)|e(velBorder|an(s|
- Context(Membership(Event|Listener)|S(upport|ervice(s(Support|Listener)?|Revoked(
- Event|Listener)|Provider(BeanInfo)?|AvailableEvent))|C(hild(Support|ComponentPro
- xy)?|ontainerProxy)|Proxy|Event)?|Info|Descriptor))|lo(ck(ingQueue|View)|b)|a(s(
- ic(R(ootPaneUI|adioButton(MenuItemUI|UI))|GraphicsUtils|Menu(BarUI|ItemUI|UI)|B(
- orders|utton(UI|Listener))|S(croll(BarUI|PaneUI)|troke|p(innerUI|litPane(Divider
- |UI))|eparatorUI|liderUI)|HTML|C(heckBox(MenuItemUI|UI)|o(ntrol|lorChooserUI|mbo
- (Box(Renderer|UI|Editor)|Popup)))|T(o(ol(Bar(SeparatorUI|UI)|TipUI)|ggleButtonUI
- )|ext(UI|PaneUI|FieldUI|AreaUI)|ab(le(HeaderUI|UI)|bedPaneUI)|reeUI)|I(nternalFr
- ame(TitlePane|UI)|conFactory)|OptionPaneUI|D(irectoryModel|esktop(IconUI|PaneUI)
- )|P(opupMenu(SeparatorUI|UI)|ermission|a(sswordFieldUI|nelUI)|rogressBarUI)|Edit
- orPaneUI|ViewportUI|F(ileChooserUI|ormattedTextFieldUI)|L(istUI|ookAndFeel|abelU
- I)|A(ttribute(s)?|rrowButton))|eRowSet)|nd(CombineOp|edSampleModel)|ckingStoreEx
- ception|tchUpdateException|d(BinaryOpValueExpException|StringOperationException|
- PaddingException|LocationException|AttributeValueExpException))|r(okenBarrierExc
- eption|eakIterator))|S(slRMI(ServerSocketFactory|ClientSocketFactory)|h(ort(Mess
- age|Buffer(Exception)?|LookupTable)?|eetCollate|ape(GraphicAttribute)?)|y(s(tem(
- Color|FlavorMap)?|exMessage)|n(c(hronousQueue|Resolver|Provider(Exception)?|Fa(c
- tory(Exception)?|iledException))|th(GraphicsUtils|Style(Factory)?|Con(stants|tex
- t)|esizer|Painter|LookAndFeel)))|c(he(duled(ThreadPoolExecutor|ExecutorService|F
- uture)|ma(ViolationException|Factory(Loader)?)?)|a(nner|tteringByteChannel)|roll
- (BarUI|Pane(Constants|UI|Layout|Adjustable)?|able|bar))|t(yle(Sheet|d(Document|E
- ditorKit)|Con(stants|text))?|ub(NotFoundException|Delegate)?|a(ndardMBean|ck(Tra
- ceElement|OverflowError)?|te(Edit(able)?|Factory|ment)|rtTlsRe(sponse|quest))|r(
- i(ng(Re(fAddr|ader)|Monitor(MBean)?|Bu(ilder|ffer(InputStream)?)|Selection|C(har
- acterIterator|ontent)|Tokenizer|IndexOutOfBoundsException|ValueExp|Writer)?|ctMa
- th)|oke|uct|eam(Result|Source|Handler|CorruptedException|Tokenizer|PrintService(
- Factory)?)))|i(ngle(SelectionModel|PixelPackedSampleModel)|ze(Requirements|Seque
- nce|2DSyntax|LimitExceededException)|des|gn(e(dObject|r)|ature(Spi|Exception)?)|
- mple(BeanInfo|T(ype|imeZone)|D(oc|ateFormat)|Formatter|AttributeSet))|SL(S(ocket
- (Factory)?|e(ssion(Binding(Event|Listener)|Context)?|rverSocket(Factory)?))|Hand
- shakeException|Context(Spi)?|P(e(erUnverifiedException|rmission)|rotocolExceptio
- n)|E(ngine(Result)?|xception)|KeyException)|o(cket(SecurityException|Handler|Cha
- nnel|TimeoutException|Impl(Factory)?|Options|Permission|Exception|Factory|Addres
- s)?|u(ndbank(Re(source|ader))?|rce(DataLine|Locator)?)|ft(Reference|BevelBorder)
- |rt(ResponseControl|ingFocusTraversalPolicy|Control|ed(Map|Set)|Key))|u(pp(orted
- ValuesAttribute|ressWarnings)|bject(D(omainCombiner|elegationPermission))?)|p(in
- ner(Model|NumberModel|DateModel|UI|ListModel)|litPaneUI|ring(Layout)?)|e(c(ur(it
- y(Manager|Permission|Exception)?|e(Random(Spi)?|C(lassLoader|acheResponse)))|ret
- Key(Spec|Factory(Spi)?)?)|t(OfIntegerSyntax)?|paratorUI|verity|quence(InputStrea
- m|r)?|lect(ionKey|or(Provider)?|ableChannel)|a(ledObject|rch(Result|Controls))|r
- (ial(Ref|Blob|izable(Permission)?|Struct|Clob|Datalink|JavaObject|Exception|Arra
- y)|v(ice(Registry|NotFoundException|U(navailableException|I(Factory)?)|Permissio
- n)|er(R(untimeException|ef)|Socket(Channel|Factory)?|NotActiveException|CloneExc
- eption|E(rror|xception))))|gment|maphore)|keleton(MismatchException|NotFoundExce
- ption)?|wing(Constants|Utilities|PropertyChangeSupport)|liderUI|a(sl(Server(Fact
- ory)?|Client(Factory)?|Exception)?|vepoint|mpleModel)|QL(Input(Impl)?|Output(Imp
- l)?|Data|Permission|Exception|Warning)|AX(Result|Source|TransformerFactory|Parse
- r(Factory)?))|H(yperlink(Event|Listener)|ttp(sURLConnection|RetryException|URLCo
- nnection)|i(erarchy(Bounds(Listener|Adapter)|Event|Listener)|ghlighter)|ostnameV
- erifier|TML(Document|EditorKit|FrameHyperlinkEvent|Writer)?|eadlessException|a(s
- (h(Map|table|Set|DocAttributeSet|Print(RequestAttributeSet|ServiceAttributeSet|J
- obAttributeSet)|AttributeSet)|Controls)|nd(shakeCompleted(Event|Listener)|ler)))
- |N(o(RouteToHostException|n(ReadableChannelException|invertibleTransformExceptio
- n|WritableChannelException)|t(BoundException|ification(Result|Broadcaster(Suppor
- t)?|Emitter|Filter(Support)?|Listener)?|SerializableException|Yet(BoundException
- |ConnectedException)|Co(ntextException|mpliantMBeanException)|OwnerException|Act
- iveException)|Such(MethodE(rror|xception)|ObjectException|P(addingException|rovi
- derException)|ElementException|FieldE(rror|xception)|A(ttributeException|lgorith
- mException))|deChange(Event|Listener)|C(onnectionPendingException|lassDefFoundEr
- ror)|InitialContextException|PermissionException)|u(ll(Cipher|PointerException)|
- m(ericShaper|ber(Of(InterveningJobs|Documents)|Up(Supported)?|Format(ter|Excepti
- on)?)?))|e(t(Permission|workInterface)|gativeArraySizeException)|a(vigationFilte
- r|m(ing(Manager|SecurityException|E(numeration|vent|xception(Event)?)|Listener)?
- |e(spaceC(hangeListener|ontext)|NotFoundException|C(lassPair|allback)|Parser|Alr
- eadyBoundException)?)))|C(h(oice(Callback|Format)?|eck(sum|ed(InputStream|Output
- Stream)|box(Group|MenuItem)?)|a(n(nel(s)?|ge(dCharSetException|Event|Listener))|
- r(set(Decoder|Provider|Encoder)?|Buffer|Sequence|ConversionException|acter(Codin
- gException|Iterator)?|Array(Reader|Writer)))|romaticity)|R(C32|L(Selector|Except
- ion)?)|yclicBarrier|MMException|ipher(Spi|InputStream|OutputStream)?|SS|o(n(s(tr
- uctor|oleHandler)|nect(ion(P(oolDataSource|endingException)|Event(Listener)?)?|I
- OException|Exception)|current(M(odificationException|ap)|HashMap|LinkedQueue)|t(
- e(nt(Model|Handler(Factory)?)|xt(NotEmptyException|ualRenderedImageFactory)?)|ai
- ner(OrderFocusTraversalPolicy|Event|Listener|Adapter)?|rol(lerEventListener|Fact
- ory)?)|dition|volveOp|fi(rmationCallback|guration(Exception)?))|okieHandler|d(in
- gErrorAction|e(S(igner|ource)|r(Result|MalfunctionError)))|unt(erMonitor(MBean)?
- |DownLatch)|p(yOnWriteArray(Set|List)|ies(Supported)?)|l(or(Model|S(upported|pac
- e|electionModel)|C(hooser(ComponentFactory|UI)|onvertOp)|Type|UIResource)?|l(ect
- ion(s|CertStoreParameters)?|at(ion(ElementIterator|Key)|or)))|m(p(il(er|ationMXB
- ean)|o(site(Name|Context|Type|Data(Support)?|View)?|nent(SampleModel|ColorModel|
- InputMap(UIResource)?|Orientation|UI|Event|View|Listener|Adapter)?|und(Border|Na
- me|Control|Edit))|letionService|ara(tor|ble)|ression)|municationException|bo(Box
- (Model|UI|Editor)|Popup)))|u(stomizer|r(sor|rency)|bicCurve2D)|e(ll(RendererPane
- |Editor(Listener)?)|rt(ificate(NotYetValidException|ParsingException|E(ncodingEx
- ception|x(ception|piredException))|Factory(Spi)?)?|S(tore(Spi|Parameters|Excepti
- on)?|elector)|Path(Builder(Result|Spi|Exception)?|TrustManagerParameters|Paramet
- ers|Validator(Result|Spi|Exception)?)?))|l(ip(board(Owner)?)?|o(se(d(ByInterrupt
- Exception|SelectorException|ChannelException)|able)|ne(NotSupportedException|abl
- e)|b)|ass(NotFoundException|C(ircularityError|astException)|De(sc|finition)|F(il
- eTransformer|ormatError)|Load(ingMXBean|er(Repository)?))?)|a(n(not(RedoExceptio
- n|UndoException|ProceedException)|cel(l(edKeyException|ationException)|ablePrint
- Job)|vas)|che(Re(sponse|quest)|dRowSet)|l(endar|l(able(Statement)?|back(Handler)
- ?))|r(dLayout|et(Event|Listener)?))|r(opImageFilter|edential(NotFoundException|E
- x(ception|piredException))))|T(hr(owable|ead(Group|MXBean|Info|Death|PoolExecuto
- r|Factory|Local)?)|ype(s|NotPresentException|InfoProvider|Variable)?|i(tledBorde
- r|e|leObserver|me(stamp|outException|Zone|Unit|r(MBean|Notification|Task|AlarmCl
- ockNotification)?|LimitExceededException)?)|oo(ManyListenersException|l(BarUI|Ti
- p(Manager|UI)|kit))|e(xt(Measurer|Syntax|HitInfo|Component|urePaint|InputCallbac
- k|OutputCallback|UI|Event|Field|L(istener|ayout)|A(ction|ttribute|rea))|mplates(
- Handler)?)|a(rget(edNotification|DataLine)?|gElement|b(S(top|et)|ular(Type|Data(
- Support)?)|Expander|le(Model(Event|Listener)?|HeaderUI|C(olumn(Model(Event|Liste
- ner)?)?|ell(Renderer|Editor))|UI|View)|ableView|bedPaneUI))|r(ust(Manager(Factor
- y(Spi)?)?|Anchor)|ee(M(odel(Event|Listener)?|ap)|Se(t|lection(Model|Event|Listen
- er))|Node|Cell(Renderer|Editor)|UI|Path|Expansion(Event|Listener)|WillExpandList
- ener)|a(ns(parency|f(orm(er(Handler|ConfigurationException|Exception|Factory(Con
- figurationError)?)?|Attribute)|er(Handler|able))|action(R(olledbackException|equ
- iredException)|alWriter)|mitter)|ck)))|I(n(s(t(an(ce(NotFoundException|AlreadyEx
- istsException)|tiationE(rror|xception))|rument(ation)?)|ufficientResourcesExcept
- ion|ets(UIResource)?)|herit(ed|ableThreadLocal)|comp(leteAnnotationException|ati
- bleClassChangeError)|t(Buffer|e(r(na(tionalFormatter|l(Error|Frame(UI|Event|Focu
- sTraversalPolicy|Listener|Adapter)))|rupt(ibleChannel|ed(NamingException|IOExcep
- tion|Exception)))|ger(Syntax)?)|rospect(ionException|or))|itial(Context(Factory(
- Builder)?)?|DirContext|LdapContext)|dex(ColorModel|edProperty(ChangeEvent|Descri
- ptor)|OutOfBoundsException)|put(M(ismatchException|ethod(Requests|Highlight|Cont
- ext|Descriptor|Event|Listener)?|ap(UIResource)?)|S(tream(Reader)?|ubset)|Context
- |Event|Verifier)|et(SocketAddress|4Address|Address|6Address)|v(ocation(Handler|T
- argetException|Event)|alid(R(ole(InfoException|ValueException)|elation(ServiceEx
- ception|TypeException|IdException))|M(idiDataException|arkException)|Search(Cont
- rolsException|FilterException)|NameException|ClassException|T(argetObjectTypeExc
- eption|ransactionException)|O(penTypeException|bjectException)|DnDOperationExcep
- tion|P(arameter(SpecException|Exception)|r(opertiesFormatException|eferencesForm
- atException))|Key(SpecException|Exception)|A(ctivityException|ttribute(sExceptio
- n|IdentifierException|ValueException)|pplicationException|lgorithmParameterExcep
- tion)))|flater(InputStream)?|lineView)|con(UIResource|View)?|te(ra(tor|ble)|m(Se
- lectable|Event|Listener))|dentity(Scope|HashMap)?|CC_(ColorSpace|Profile(RGB|Gra
- y)?)|IO(Re(ad(UpdateListener|ProgressListener|WarningListener)|gistry)|Metadata(
- Node|Controller|Format(Impl)?)?|ByteBuffer|ServiceProvider|I(nvalidTreeException
- |mage)|Param(Controller)?|Exception|Write(ProgressListener|WarningListener))|OEx
- ception|vParameterSpec|llegal(MonitorStateException|Block(ingModeException|SizeE
- xception)|S(tateException|electorException)|C(harsetNameException|omponentStateE
- xception|lassFormatException)|ThreadStateException|PathStateException|Format(Co(
- nversionException|dePointException)|PrecisionException|Exception|FlagsException|
- WidthException)|A(ccessE(rror|xception)|rgumentException))|mag(ingOpException|e(
- Read(er(Spi|WriterSpi)?|Param)|GraphicAttribute|C(onsumer|apabilities)|T(ypeSpec
- ifier|ranscoder(Spi)?)|I(nputStream(Spi|Impl)?|con|O)|O(utputStream(Spi|Impl)?|b
- server)|Producer|View|Filter|Write(Param|r(Spi)?))?))|Z(ip(InputStream|OutputStr
- eam|E(ntry|xception)|File)|oneView)|O(ceanTheme|ut(put(Stream(Writer)?|DeviceAss
- igned|Keys)|OfMemoryError)|p(tion(PaneUI|alDataException)?|e(n(MBean(Constructor
- Info(Support)?|Info(Support)?|OperationInfo(Support)?|ParameterInfo(Support)?|At
- tributeInfo(Support)?)|Type|DataException)|rati(ngSystemMXBean|on(sException|Not
- SupportedException)?)))|ver(la(yLayout|ppingFileLockException)|ride)|wner|rienta
- tionRequested|b(serv(er|able)|j(ID|ect(Stream(C(onstants|lass)|Exception|Field)|
- Name|ChangeListener|In(stance|put(Stream|Validation)?)|Output(Stream)?|View|Fact
- ory(Builder)?)?))|AEPParameterSpec)|D(GC|ynamicMBean|nDConstants|i(splayMode|cti
- onary|alog|r(StateFactory|Context|ect(oryManager|ColorModel)|ObjectFactory)|gest
- (InputStream|OutputStream|Exception)|mension(2D|UIResource)?)|SA(P(ublicKey(Spec
- )?|aram(s|eterSpec)|rivateKey(Spec)?)|Key(PairGenerator)?)|H(GenParameterSpec|P(
- ublicKey(Spec)?|arameterSpec|rivateKey(Spec)?)|Key)|o(c(ument(Builder(Factory)?|
- Name|ed|Parser|Event|Filter|Listener)?|PrintJob|Flavor|Attribute(Set)?)?|uble(Bu
- ffer)?|mainCombiner)|u(plicateFormatFlagsException|ration)|TD(Constants)?|e(s(cr
- iptor(Support|Access)?|t(ination|roy(able|FailedException))|ignMode|ktop(Manager
- |IconUI|PaneUI))|cimalFormat(Symbols)?|precated|f(later(OutputStream)?|ault(M(ut
- ableTreeNode|e(nuLayout|talTheme))|B(oundedRangeModel|uttonModel)|S(tyledDocumen
- t|ingleSelectionModel)|Highlighter|C(o(lorSelectionModel|mboBoxModel)|ellEditor|
- aret)|T(extUI|able(Model|C(olumnModel|ellRenderer))|ree(Model|SelectionModel|Cel
- l(Renderer|Editor)))|DesktopManager|PersistenceDelegate|EditorKit|KeyboardFocusM
- anager|Fo(cus(Manager|TraversalPolicy)|rmatter(Factory)?)|L(ist(Model|SelectionM
- odel|CellRenderer)|oaderRepository)))|l(egationPermission|ay(ed|Queue))|bugGraph
- ics)|OM(Result|Source|Locator)|ES(edeKeySpec|KeySpec)|at(e(Time(Syntax|At(C(ompl
- eted|reation)|Processing))|Format(ter|Symbols)?)?|a(Buffer(Byte|Short|Int|Double
- |UShort|Float)?|type(Con(stants|figurationException)|Factory)|Source|Truncation|
- Input(Stream)?|Output(Stream)?|gram(Socket(Impl(Factory)?)?|Channel|Packet)|F(or
- matException|lavor)|baseMetaData|Line))|r(iver(Manager|PropertyInfo)?|opTarget(C
- ontext|Dr(opEvent|agEvent)|Event|Listener|Adapter)?|ag(Gesture(Recognizer|Event|
- Listener)|Source(MotionListener|Context|Dr(opEvent|agEvent)|Event|Listener|Adapt
- er)?)))|U(R(I(Resolver|Syntax(Exception)?|Exception)?|L(StreamHandler(Factory)?|
- C(onnection|lassLoader)|Decoder|Encoder)?)|n(s(olicitedNotification(Event|Listen
- er)?|upported(C(harsetException|lassVersionError|allbackException)|OperationExce
- ption|EncodingException|FlavorException|LookAndFeelException|A(ddressTypeExcepti
- on|udioFileException))|atisfiedLinkError)|icastRemoteObject|d(o(Manager|ableEdit
- (Support|Event|Listener)?)|eclaredThrowableException)|expectedException|known(Gr
- oupException|ServiceException|HostException|ObjectException|Error|Format(Convers
- ionException|FlagsException))|re(solved(Permission|AddressException)|coverable(E
- ntryException|KeyException)|ferenced)|m(odifiable(SetException|ClassException)|a
- (ppableCharacterException|rshalException)))|til(ities|Delegate)?|TFDataFormatExc
- eption|I(Resource|Manager|D(efaults)?)|UID)|J(R(ootPane|adioButton(MenuItem)?)|M
- (RuntimeException|X(Serv(iceURL|erErrorException)|Connect(ionNotification|or(Ser
- ver(MBean|Provider|Factory)?|Provider|Factory)?)|Pr(incipal|oviderException)|Aut
- henticator)|enu(Bar|Item)?|Exception)|Button|S(croll(Bar|Pane)|p(inner|litPane)|
- eparator|lider)|o(in(RowSet|able)|b(Me(ssageFromOperator|diaSheets(Supported|Com
- pleted)?)|S(heets|tate(Reason(s)?)?)|HoldUntil|Name|Impressions(Supported|Comple
- ted)?|OriginatingUserName|Priority(Supported)?|KOctets(Supported|Processed)?|Att
- ributes))|dbcRowSet|C(heckBox(MenuItem)?|o(lorChooser|m(ponent|boBox)))|T(o(ol(B
- ar|Tip)|ggleButton)|ext(Component|Pane|Field|Area)|ab(le(Header)?|bedPane)|ree)|
- InternalFrame|OptionPane|D(ialog|esktopPane)|P(opupMenu|EG(HuffmanTable|Image(Re
- adParam|WriteParam)|QTable)|a(sswordField|nel)|rogressBar)|EditorPane|ar(InputSt
- ream|OutputStream|URLConnection|E(ntry|xception)|File)|Viewport|F(ileChooser|orm
- attedTextField|rame)|Window|L(ist|a(yeredPane|bel))|Applet)|P(hantomReference|BE
- (ParameterSpec|Key(Spec)?)|i(pe(d(Reader|InputStream|OutputStream|Writer))?|xel(
- Grabber|InterleavedSampleModel))|S(SParameterSpec|ource)|o(sition|int(2D|erInfo)
- ?|oledConnection|pup(Menu(UI|Event|Listener)?|Factory)?|l(ygon|icy(Node|Qualifie
- rInfo)?)|rt(UnreachableException|ableRemoteObject(Delegate)?)?)|u(shback(Reader|
- InputStream)|blicKey)|er(sisten(ceDelegate|tMBean)|mission(s|Collection)?)|DLOve
- rrideSupported|lain(Document|View)|a(ssword(Callback|View|Authentication)|nel(UI
- )?|ck(200|edColorModel|age)|t(hIterator|ch|tern(SyntaxException)?)|int(Context|E
- vent)?|per|r(se(Position|Exception|r(ConfigurationException|Delegator)?)|tialRes
- ultException|a(graphView|meter(MetaData|Block|izedType|Descriptor)))|ge(sPerMinu
- te(Color)?|Ranges|dResults(ResponseControl|Control)|able|Format|Attributes))|K(C
- S8EncodedKeySpec|IX(BuilderParameters|CertPath(BuilderResult|Checker|ValidatorRe
- sult)|Parameters))|r(i(n(cipal|t(RequestAttribute(Set)?|Graphics|S(tream|ervice(
- Lookup|Attribute(Set|Event|Listener)?)?)|er(Resolution|Graphics|M(oreInfo(Manufa
- cturer)?|essageFromOperator|akeAndModel)|State(Reason(s)?)?|Name|I(sAcceptingJob
- s|nfo|OException)|URI|Job|Exception|Location|AbortException)|Job(Event|Listener|
- A(ttribute(Set|Event|Listener)?|dapter))?|E(vent|xception)|able|Quality|Writer))
- |ority(BlockingQueue|Queue)|v(ileged(ExceptionAction|Action(Exception)?)|ate(MLe
- t|C(lassLoader|redentialPermission)|Key)))|o(cess(Builder)?|t(ocolException|ecti
- onDomain)|pert(y(ResourceBundle|Change(Support|Event|Listener(Proxy)?)|Descripto
- r|Permission|Editor(Manager|Support)?|VetoException)|ies)|vider(Exception)?|file
- DataException|gress(Monitor(InputStream)?|BarUI)|xy(Selector)?)|e(sentationDirec
- tion|dicate|paredStatement|ference(s(Factory)?|Change(Event|Listener)))))|E(n(c(
- ode(dKeySpec|r)|ryptedPrivateKeyInfo)|tity|um(Map|S(yntax|et)|Con(stantNotPresen
- tException|trol)|eration)?)|tchedBorder|ditorKit|C(GenParameterSpec|P(oint|ublic
- Key(Spec)?|arameterSpec|rivateKey(Spec)?)|Key|Field(F(2m|p))?)|OFException|vent(
- SetDescriptor|Handler|Context|Object|DirContext|Queue|Listener(Proxy|List)?)?|l(
- ement(Type|Iterator)?|lip(se2D|ticCurve))|rror(Manager|Listener)?|x(c(hanger|ept
- ion(InInitializerError|Listener)?)|te(ndedRe(sponse|quest)|rnalizable)|p(ortExce
- ption|andVetoException|ression)|e(cut(ionException|or(s|Service|CompletionServic
- e)?)|mptionMechanism(Spi|Exception)?))|mpty(Border|StackException))|V(MID|i(sibi
- lity|ew(port(UI|Layout)|Factory)?|rtualMachineError)|o(i(ceStatus|d)|latileImage
- )|e(ctor|toableChange(Support|Listener(Proxy)?)|rifyError)|a(l(idator(Handler)?|
- ue(Handler(MultiFormat)?|Exp))|riableHeightLayoutCache))|Ke(y(Rep|Generator(Spi)
- ?|Manage(r(Factory(Spi)?)?|mentException)|S(t(ore(BuilderParameters|Spi|Exceptio
- n)?|roke)|pec)|Pair(Generator(Spi)?)?|E(vent(Dispatcher|PostProcessor)?|xception
- )|Factory(Spi)?|map|boardFocusManager|Listener|A(dapter|lreadyExistsException|gr
- eement(Spi)?))?|r(nel|beros(Ticket|Principal|Key)))|Q(Name|u(e(ue(dJobCount)?|ry
- (E(val|xp))?)|adCurve2D))|F(i(nishings|delity|eld(Position|View)?|l(ter(Reader|I
- nputStream|ed(RowSet|ImageSource)|OutputStream|Writer)?|e(Reader|nameFilter|Syst
- emView|Handler|N(otFoundException|ameMap)|C(h(ooserUI|annel)|acheImage(InputStre
- am|OutputStream))|I(nputStream|mage(InputStream|OutputStream))|OutputStream|D(ia
- log|escriptor)|Permission|View|Filter|Writer|Lock(InterruptionException)?)?)|xed
- HeightLayoutCache)|o(nt(RenderContext|Metrics|UIResource|FormatException)?|cus(M
- anager|TraversalPolicy|Event|Listener|Adapter)|rm(SubmitEvent|at(t(er(ClosedExce
- ption)?|able(Flags)?)|ConversionProvider|FlagsConversionMismatchException)?|View
- ))|uture(Task)?|eatureDescriptor|l(o(w(View|Layout)|at(Buffer|Control)?)|ushable
- |a(tteningPathIterator|vor(Map|Table|E(vent|xception)|Listener)))|a(ctoryConfigu
- rationError|iledLoginException)|rame)|W(i(ndow(StateListener|Constants|Event|Foc
- usListener|Listener|Adapter)?|ldcardType)|e(ak(Reference|HashMap)|bRowSet)|r(it(
- e(r|AbortedException)|able(R(enderedImage|aster)|ByteChannel))|appedPlainView))|
- L(i(st(ResourceBundle|Model|Selection(Model|Event|Listener)|CellRenderer|Iterato
- r|enerNotFoundException|Data(Event|Listener)|UI|View)?|n(e(Metrics|B(order|reakM
- easurer)|2D|Number(Reader|InputStream)|UnavailableException|Event|Listener)?|k(R
- ef|ed(BlockingQueue|Hash(Map|Set)|List)|Exception|ageError|LoopException))|mitEx
- ceededException)|o(ng(Buffer)?|c(k(Support)?|a(teRegistry|le))|ok(up(Table|Op)|A
- ndFeel)|aderHandler|g(Record|Manager|in(Module|Context|Exception)|Stream|g(ing(M
- XBean|Permission)|er)))|dap(ReferralException|Name|Context)|e(vel|ase)|DAPCertSt
- oreParameters|a(stOwnerException|y(out(Manager(2)?|Queue|FocusTraversalPolicy)|e
- redHighlighter)|nguageCallback|bel(UI|View)?))|A(s(sertionError|ync(hronousClose
- Exception|BoxView))|n(notat(ion(TypeMismatchException|FormatError)?|edElement)|c
- estor(Event|Listener))|c(c(ount(NotFoundException|Ex(ception|piredException)|Loc
- kedException)|ess(ible(R(ole|e(sourceBundle|lation(Set)?))|Bundle|S(t(ate(Set)?|
- reamable)|election)|Hyper(text|link)|Co(ntext|mponent)|T(ext(Sequence)?|able(Mod
- elChange)?)|Icon|Object|E(ditableText|xtended(Component|T(ext|able)))|Value|KeyB
- inding|A(ction|ttributeSequence))?|Control(Context|Exception|ler)|Exception))|ti
- (on(Map(UIResource)?|Event|Listener)?|v(ity(RequiredException|CompletedException
- )|eEvent|at(ion(Group(_Stub|ID|Desc)?|Monitor|System|I(nstantiator|D)|Desc|Excep
- tion)|or|eFailedException|able)))|l(NotFoundException|Entry)?)|t(tribute(s|Modif
- icationException|Set(Utilities)?|d(String|CharacterIterator)|NotFoundException|C
- hangeNotification(Filter)?|InUseException|Exception|ValueExp|List)?|omic(Referen
- ce(FieldUpdater|Array)?|MarkableReference|Boolean|StampedReference|Integer(Field
- Updater|Array)?|Long(FieldUpdater|Array)?))|d(just(able|ment(Event|Listener))|le
- r32)|u(t(h(orizeCallback|enticat(ion(NotSupportedException|Exception)|or)|P(ermi
- ssion|rovider))|oscroll)|dio(System|Clip|InputStream|Permission|F(ile(Reader|For
- mat|Writer)|ormat)))|pp(ConfigurationEntry|endable|let(Stub|Context|Initializer)
- ?)|ffineTransform(Op)?|l(phaComposite|lPermission|ready(BoundException|Connected
- Exception)|gorithmParameter(s(Spi)?|Generator(Spi)?|Spec))|r(c2D|ithmeticExcepti
- on|ea(AveragingScaleFilter)?|ray(s|BlockingQueue|StoreException|Type|IndexOutOfB
- oundsException|List)?)|bstract(M(ethodError|ap)|B(order|utton)|S(pinnerModel|e(t
- |quentialList|lect(ionKey|or|ableChannel)))|C(ol(orChooserPanel|lection)|ellEdit
- or)|TableModel|InterruptibleChannel|Document|UndoableEdit|Preferences|ExecutorSe
- rvice|Queue(dSynchronizer)?|Writer|L(ist(Model)?|ayoutCache)|Action)|WT(Permissi
- on|E(vent(Multicaster|Listener(Proxy)?)?|rror|xception)|KeyStroke)))
- TYPES
-
- def test_very_long
- assert_scans_list_size JAVA_BUILTIN_TYPES, 2389
- assert_scans_list_size JAVA_BUILTIN_TYPES + '?', 2389 + 1
- assert_scans_list_size JAVA_BUILTIN_TYPES + '(A|B)', 2389 * 2
- assert_scans_list_size JAVA_BUILTIN_TYPES + '?(A|B)', (2389 + 1) * 2
- end
-
-end
diff --git a/etc/speedup/current.rb b/etc/speedup/current.rb
deleted file mode 100644
index e98d0e2..0000000
--- a/etc/speedup/current.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-require 'strscan'
-require 'benchmark'
-
-class Scanner < StringScanner
-
- def initialize code
- super code
- @tokens = Tokens.new
- end
-
- def tokenize
- scan_tokens @tokens
- @tokens
- end
-
-protected
-
- def scan_tokens tokens
- until eos?
- if matched = scan(/\s+/)
- tokens << [matched, :space]
- elsif matched = scan(/!/)
- tokens << [matched, :not_going_to_happen]
- elsif matched = scan(/=/) #/
- tokens << [matched, :not_going_to_happen]
- elsif matched = scan(/%/)
- tokens << [matched, :not_going_to_happen]
- elsif matched = scan(/\w+/)
- tokens << [matched, :word]
- elsif matched = scan(/[,.]/)
- tokens << [matched, :op]
- elsif scan(/\(/)
- tokens << [:open, :par]
- elsif scan(/\)/)
- tokens << [:close, :par]
- else
- raise
- end
- end
- end
-
-end
-
-
-class Tokens < Array
-end
-
-
-class Encoder
-
- def encode_tokens tokens
- @out = ''
- compile tokens
- @out
- end
-
-protected
-
- if RUBY_VERSION >= '1.9' || defined?(JRUBY_VERSION)
- def compile tokens
- for text, kind in tokens
- token text, kind
- end
- end
- else
- def compile tokens
- tokens.each(&method(:token).to_proc)
- end
- end
-
- def token content, kind
- encoded_token =
- case content
- when ::String
- text_token content, kind
- when :open
- open kind
- when :close
- close kind
- when ::Symbol
- block_token content, kind
- else
- raise 'Unknown token content type: %p' % [content]
- end
- @out << encoded_token
- end
-
- def text_token text, kind
- if kind == :space
- text
- else
- text.gsub!(/[)\\]/, '\\\\\0') # escape ) and \
- "#{kind}(#{text})"
- end
- end
-
- def block_token action, kind
- case action
- when :open
- open kind
- when :close
- close kind
- end
- end
-
- def open kind
- "#{kind}<"
- end
-
- def close kind
- '>'
- end
-end
-
-N = (10 ** (ARGV.first || 5).to_i)
-code = " alpha, beta, (gamma).\n" * N
-scanner = Scanner.new code
-encoder = Encoder.new
-
-tokens = nil
-time_scanning = Benchmark.realtime do
- tokens = scanner.tokenize
-end
-puts 'Scanning: %0.2fs -- %0.0f kTok/s' % [time_scanning, tokens.size / time_scanning / 1000]
-
-time_encoding = Benchmark.realtime do
- out = encoder.encode_tokens(tokens).size
-end
-puts 'Encoding: %0.2fs -- %0.0f kTok/s' % [time_encoding, tokens.size / time_encoding / 1000]
-
-time = time_scanning + time_encoding
-puts 'Together: %0.2fs -- %0.0f kTok/s' % [time, tokens.size / time / 1000]
diff --git a/etc/speedup/direct-stream.rb b/etc/speedup/direct-stream.rb
deleted file mode 100644
index a32c2a7..0000000
--- a/etc/speedup/direct-stream.rb
+++ /dev/null
@@ -1,208 +0,0 @@
-require 'strscan'
-require 'benchmark'
-require 'thread'
-
-class Scanner < StringScanner
-
- def initialize code
- super code
- end
-
- def tokenize encoder = Tokens.new
- scan_tokens encoder
- encoder
- end
-
-protected
-
- def scan_tokens encoder
- until eos?
- if matched = scan(/\s+/)
- encoder.text_token matched, :space
- elsif matched = scan(/!/)
- encoder.text_token matched, :not_going_to_happen
- elsif matched = scan(/=/) #/
- encoder.text_token matched, :not_going_to_happen
- elsif matched = scan(/%/)
- encoder.text_token matched, :not_going_to_happen
- elsif matched = scan(/\w+/)
- encoder.text_token matched, :word
- elsif matched = scan(/[,.]/)
- encoder.text_token matched, :op
- elsif scan(/\(/)
- encoder.begin_group :par
- elsif scan(/\)/)
- encoder.end_group :par
- else
- raise
- end
- end
- end
-
-end
-
-
-class Tokens < Array
- alias token push
- alias text_token push
- alias block_token push
- def begin_group kind; push :begin_group, kind end
- def end_group kind; push :end_group, kind end
-end
-
-class TokensQueue < Queue
- def text_token text, kind
- push [text, kind]
- end
- def begin_group kind
- push [:begin_group, kind]
- end
- def end_group kind
- push [:end_group, kind]
- end
-end
-
-
-class Encoder
-
- def setup
- @out = ''
- @opened = []
- end
-
- def finish
- while kind = @opened.pop
- close kind
- end
- @out
- end
-
- def encode_tokens tokens
- setup
- compile tokens
- finish
- end
-
- def encode_stream scanner
- setup
- scanner.tokenize self
- finish
- end
-
- def encode_queue scanner
- setup
- queue = TokensQueue.new
- Thread.new do
- scanner.tokenize queue
- queue << nil # end
- end.join
- Thread.new do
- while value = queue.pop
- token(*value)
- end
- end.join
- finish
- end
-
- def token content, kind
- if content.is_a? ::String
- text_token content, kind
- elsif content.is_a? ::Symbol
- block_token content, kind
- else
- raise 'Unknown token content type: %p' % [content]
- end
- end
-
- def text_token text, kind
- @out <<
- if kind == :space
- text
- else
- text.gsub!(/[)\\]/, '\\\\\0') # escape ) and \
- "#{kind}(#{text})"
- end
- end
-
- def block_token action, kind
- case action
- when :begin_group
- begin_group kind
- when :end_group
- end_group kind
- else
- raise
- end
- end
-
- def begin_group kind
- @opened << kind
- @out << "#{kind}<"
- end
-
- def end_group kind
- @opened.pop
- @out << '>'
- end
-
-protected
-
- def compile tokens
- content = nil
- for item in tokens
- if content
- case content
- when ::String
- text_token content, item
- content = nil
- when :begin_group
- begin_group item
- content = nil
- when :end_group
- end_group item
- content = nil
- when ::Symbol
- block_token content, item
- content = nil
- else
- raise
- end
- else
- content = item
- end
- end
- raise if content
- end
-
-end
-
-N = (10 ** (ARGV.first || 5).to_i)
-code = " alpha, beta, (gamma).\n" * N
-scanner = Scanner.new code
-encoder = Encoder.new
-
-# tokens = nil
-# time_scanning = Benchmark.realtime do
-# tokens = scanner.tokenize
-# end
-# puts 'Scanning: %0.2fs -- %0.0f kTok/s' % [time_scanning, tokens.size / 2 / time_scanning / 1000]
-#
-# time_encoding = Benchmark.realtime do
-# encoder.encode_tokens tokens
-# end
-# puts 'Encoding: %0.2fs -- %0.0f kTok/s' % [time_encoding, tokens.size / 2 / time_encoding / 1000]
-#
-# time = time_scanning + time_encoding
-# puts 'Together: %0.2fs -- %0.0f kTok/s' % [time, tokens.size / 2 / time / 1000]
-# scanner.reset
-
-time = Benchmark.realtime do
- encoder.encode_stream scanner
-end
-puts 'Direct Streaming: %0.2fs -- %0.0f kTok/s' % [time, (N * 11 + 1) / time / 1000]
-
-scanner.reset
-time = Benchmark.realtime do
- encoder.encode_queue scanner
-end
-puts 'Queue: %0.2fs -- %0.0f kTok/s' % [time, (N * 11 + 1) / time / 1000]
diff --git a/etc/todo/example.applescript b/etc/todo/example.applescript
deleted file mode 100644
index 8153e0d..0000000
--- a/etc/todo/example.applescript
+++ /dev/null
@@ -1,12997 +0,0 @@
-(**
- * filename: MailNotification.applescript
- * created : Tue Feb 11 14:24:40 2003
- * LastEditDate Was "Mon Jun 30 11:25:23 2003"
- *
- *)
-
-(* recipientAddress is a list of Addresses to send to
- * messageSubject is the subject of the spam message
- * messageBody is the body of the spam message
- *)
-on sendemail(emailer, vcardPath, recipientAddress, messageSubject, messageBody)
-
- (* Part that does all of the work, this works for Mail *)
- if (emailer is equal to "com.apple.mail") then
- tell application "Mail"
- -- Properties can be specified in a record when creating the message or
- -- afterwards by setting individual property values.
- set newMessage to make new outgoing message with properties {subject:messageSubject, content:messageBody}
- tell newMessage
- -- Default is false. Determines whether the compose window will
- -- show on the screen or whether it will happen in the background.
- set visible to false
-
- repeat with emailAddress in recipientAddress
- make new bcc recipient at end of bcc recipients with properties {address:emailAddress}
- end repeat
- tell content
- -- Position must be specified for attachments
- make new attachment with properties {file name:vcardPath} at after the last paragraph
- end tell
- end tell
- -- send the message
- send newMessage
- end tell
- else
- if (emailer is equal to "com.microsoft.entourage") then
- (* lots of stuff for entourage here *)
- end if
- end if
-end sendemail
-
--- sendemail("com.apple.mail", "/tmp/foo.vcf", "dude@apple.com", "messageSubject", "messageBody")
-(**
- * filename: SharingInvite.applescript
- *
- *)
-
-(* recipientAddress is a list of Addresses to send to
- * messageSubject is the subject of the invite message
- * messageBody is the body of the invite message
- *)
-on sendemail(emailer, recipientAddress, messageSubject, messageBody)
-
- (* Part that does all of the work, this works for Mail *)
- if (emailer is equal to "com.apple.mail") then
- tell application "Mail"
- -- Properties can be specified in a record when creating the message or
- -- afterwards by setting individual property values.
- set newMessage to make new outgoing message with properties {subject:messageSubject, content:messageBody}
- tell newMessage
- -- Default is false. Determines whether the compose window will
- -- show on the screen or whether it will happen in the background.
- set visible to true
-
- repeat with emailAddress in recipientAddress
- make new bcc recipient at end of bcc recipients with properties {address:emailAddress}
- end repeat
- end tell
- -- send the message
- -- send newMessage
- end tell
- else
- if (emailer is equal to "com.microsoft.entourage") then
- (* lots of stuff for entourage here *)
- end if
- end if
-end sendemail
-
--- sendemail("com.apple.mail", "dude@apple.com", "messageSubject", "messageBody")
-beep
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Wil je Big Bang " & game_name & " voor Mac OS X spelen? (Laat het me weten als je het spel niet hebt en ik stuur het je met een klik op de muis.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wanneer je klaar bent om te spelen, open je mijn spelsleutel die je meteen van mij zult ontvangen."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Laten we Big Bang " & game_name & " voor Mac OS X spelen. Ik denk niet dat je het spel hebt, dus daarom stuur ik het je hierbij!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Laat het me weten wanneer je klaar bent om te spelen, dan nodig ik je uit voor een spel."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Eudora" set newMessage to make new message at end of mailbox "Out" tell newMessage set subject to theSubject set body to theBody & return & return set field "to" to theRecipients attach to newMessage documents {oldPath as alias} end tell activate return true end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Une partie de Big Bang " & game_name & " pour Mac OS X ? (Si tu n'as pas ce jeu, dis-le moi et je te l'envoie d'un simple clic !)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Pour jouer, il suffit d'ouvrir le fichier que je vais t'envoyer."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Faisons une partie de Big Bang " & game_name & " pour Mac OS X. Comme tu n'as pas ce jeu, je te l'envoie !" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Dis-moi quand tu veux jouer et je t'inviterai pour une partie."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Willst Du Big Bang " & game_name & " auf einem Mac OS X spielen? (Wenn Du das Spiel nicht besitzt, gib mir Bescheid. Ich kann es mit einem Klick senden.)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Wenn Du spielbereit bist, verwende einfach meinen Spieleschluessel, den ich Dir gleich sende."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Lass uns Big Bang " & game_name & " for Mac OS X spielen. Ich glaube, dass Du es nicht hast. Hier ist es." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Wenn Du spielbereit bist, gebe mir Bescheid, und ich lade Dich zu einem Spiel ein."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Vuoi giocare a Big Bang " & game_name & " per Mac OS X? (Se non ce l'hai, fammelo sapere e te lo mando in un clic!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Quando sei pronto per giocare, apri la chiave della partita che ti mando."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Giochiamo a Big Bang " & game_name & " per Mac OS X. Non mi sembra che tu ce l'abbia, quindi te lo mando!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Quando sei pronto per giocare, fammelo sapere."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Want to play Big Bang " & game_name & " for Mac OS X? (If you don't have it, let me know and I can send it with one click!)" as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "When you're ready to play, simply open my game key which I'm sending to you next."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Let's play Big Bang " & game_name & " for Mac OS X. I don't think you have it, so, here it is!" as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "When you're ready to play, let me know and I'll invite you to a game."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-(* The calling application will define the following variables for you: * * oldPath - A Mac OS 9 styled full path name to the attachment file * unixPath - A Unix-styled full path name * theRecipients - A comma-separated list of email addresses to send to * theSubject - String which contained the subject * theBody - String which contains the body of the email *) tell application "Mail" activate set this_message to make new compose message at beginning of every compose message with properties {subject:theSubject,content:theBody} tell this_message set content to return & return & content make new recipient at end of recipients with properties {display name:theRecipients} tell content make new text attachment with properties {file name:unixPath} at before the first word of the first paragraph end tell end tell set content of this_message to the content of this_message make new message editor at beginning of message editors set compose message of message editor 1 to this_message return true end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-set theBody to the clipboard as Unicode text
-
-tell application "Mail"
-
- set newMessage to make new outgoing message with properties {subject:theSubject, content:return}
- tell newMessage
- set visible to true
- make new to recipient at end of to recipients with properties {name:theRecipients}
- tell content
- make new attachment with properties {file name:unixPath} at after the last paragraph
- make new text at after the last paragraph with data (return & return & theBody)
- end tell
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Microsoft Entourage"
-
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-(* The calling application will define the following variables for you:
- *
- * oldPath - A Mac OS 9 styled full path name to the attachment file
- * unixPath - A Unix-styled full path name
- * theRecipients - A comma-separated list of email addresses to send to
- * theSubject - String which contained the subject
- * theBody - String which contains the body of the email
- *)
-
-tell application "Outlook Express"
- set newMessage to make new draft window with properties {recipient:theRecipients, subject:theSubject, content:theBody & return & return}
- tell newMessage
- make new file with properties {name:oldPath}
- end tell
-
- activate
-
- return true
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Quieres jugar a Big Bang " & game_name & " para Mac OS X? Si no lo tienes, te lo hago llegar con un simple clic." as string)
-
- set chat_message to chat_message & chat_string
-
- set chat_message to chat_message & "Para empezar a jugar, abre el archivo de llave de partida que te paso."
-
- repeat with j from 1 to the number of services
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
- end repeat
-
- return false
-end tell
-tell application "iChat"
-
- activate
-
- set chat_message to {}
-
- set chat_string to ("Juguemos a Big Bang " & game_name & " para Mac OS X. Creo que no lo tienes. Te lo paso." as string)
-
-
- set chat_message to chat_message & chat_string
- set chat_message to chat_message & "Cuando quieras jugar me lo dices y te invito a una partida."
-
- repeat with j from 1 to the number of services
-
- repeat with i from 1 to the number of accounts of item j of services
-
- if (id of item i of accounts of item j of services as string) is equal to target_id then
-
- set user_status to status of item i of accounts of item j of services
- set user_idle to idle time of item i of accounts of item j of services
-
- if user_status is available and user_idle is 0 then
-
- repeat with k from 1 to the number of items of chat_message
- send item k of chat_message to item i of accounts of item j of services
- end repeat
-
- --send ("Big Bang " & game_name & "" as string) to item i of accounts of item j of services
-
- set frontmost to true
-
- return true
-
- end if
- end if
-
- end repeat
-
- end repeat
-
- return false
-end tell
-
--- First we initialize a few variables
--- TODO remove the unused ones
-set myEvList to {}
-set myTaskList to {}
-set theTextList to ""
-set theError to 0
-set theImfile to ""
-set theDocRef to 0
-set theImFileName to ""
-set gEntourageWasRunning to true
-set gMinimunPBar to 0.005
-set gProgression to 0
-set gNTasks to 0
-set gNEvents to 0
-
--- Creating a new calendar in iCal
-
-tell application "iCal"
- activate
- make new calendar with properties {title:"Entourage"}
- delay (0.5)
-end tell
-
--- Getting the events from Entourage (not there is no way to choose which Entourage in this one)
-try
- if (theError of me is equal to 0) then
- tell application "Microsoft Entourage"
- --log "Entourage import, start getting events " & (current date)
- activate
-
- set myEEvents to get every event
- set my gNEvents to count (myEEvents)
- set myTasks to tasks where its completed is equal to false
- set my gNTasks to count (myTasks)
-
- if my gNTasks is not equal to 0 then
- set entIncrement to (round ((count myEEvents) / 40) rounding up)
- else
- set entIncrement to (round ((count myEEvents) / 80) rounding up)
- end if
- set progEntIdx to 0
-
- repeat with aEEvent in myEEvents
- set tmpVal to {}
- -- append raw properties to the list as list of records have their own syntax
- set tmpVal to tmpVal & (get subject of aEEvent as Unicode text)
-
- set begDate to (get start time of aEEvent)
- set endDate to (get end time of aEEvent)
- set addFlag to (get all day event of aEEvent)
- if addFlag is equal to false then
- if (endDate - begDate) > 24 * hours then
- set addFlag to true
- set time of begDate to 0
- set time of endDate to 0
- set dday to day of endDate
- set day of endDate to dday + 1
- end if
- end if
- set tmpVal to tmpVal & addFlag
- set tmpVal to tmpVal & begDate
- set tmpVal to tmpVal & endDate
-
- set tmpVal to tmpVal & (get recurring of aEEvent)
- set tmpVal to tmpVal & (get recurrence of aEEvent)
- set tmpVal to tmpVal & (get location of aEEvent as Unicode text)
- set tmpVal to tmpVal & (get content of aEEvent as Unicode text)
- set (myEvList of me) to (myEvList of me) & tmpVal
- set progEntIdx to progEntIdx + 1
- if progEntIdx is equal to entIncrement then
- set progEntIdx to 0
- end if
- end repeat
-
- --log "Entourage import, start getting tasks " & (current date)
- if (my gNTasks) is not equal to 0 then
- --if count task is not equal to 0 then
- set my gProgression to 0.3
- set entIncrement to (round ((my gNTasks) / 40) rounding up)
-
- set progEntIdx to 0
-
- repeat with aTask in myTasks
- set tmpVal to {}
- set tmpVal to tmpVal & (get the name of aTask as Unicode text)
- set tmpVal to tmpVal & (get the due date of aTask)
- set tmpPri to the priority of aTask
- if tmpPri is equal to highest then
- set tmpVal to tmpVal & 1
- else if tmpPri is equal to high then
- set tmpVal to tmpVal & 4
- else if tmpPri is equal to low then
- set tmpVal to tmpVal & 7
- else if tmpPri is equal to lowest then
- set tmpVal to tmpVal & 7
- else
- set tmpVal to tmpVal & 0
- end if
- set tmpVal to tmpVal & (get content of aTask as Unicode text)
-
- set (myTaskList of me) to (myTaskList of me) & tmpVal
- set progEntIdx to progEntIdx + 1
-
- if progEntIdx is equal to entIncrement then
- set progEntIdx to 0
- end if
- end repeat
- end if
- end tell
- end if
-
- --correct the recurrences
- set parsidx to 0
- repeat my gNEvents times
- set entRule to (item (parsidx + 6) of (myEvList of me))
- if (entRule) is not equal to "" then
- set offUntil to offset of "UNTIL=" in entRule
- if offUntil is not equal to 0 then
- set icalRule to text 1 through (offUntil + 5) of entRule
- set remainText to (text (offUntil + 6) through (length of (entRule)) of entRule)
- set endPos to offset of ";" in remainText
- set untilDateStr to (text 1 through (endPos - 1) of remainText) as string
- set untilYear to (items 1 through 4 of untilDateStr) as string
- set untilMonth to (items 5 through 6 of untilDateStr) as string
- set untilDay to (items 7 through 8 of untilDateStr) as string
-
- set untilDate to current date
- set day of untilDate to untilDay
- set year of untilDate to untilYear
-
- if untilMonth is equal to "01" then
- set month of untilDate to January
- else if untilMonth is equal to "02" then
- set month of untilDate to February
- else if untilMonth is equal to "03" then
- set month of untilDate to March
- else if untilMonth is equal to "04" then
- set month of untilDate to April
- else if untilMonth is equal to "05" then
- set month of untilDate to May
- else if untilMonth is equal to "06" then
- set month of untilDate to June
- else if untilMonth is equal to "07" then
- set month of untilDate to July
- else if untilMonth is equal to "08" then
- set month of untilDate to August
- else if untilMonth is equal to "09" then
- set month of untilDate to September
- else if untilMonth is equal to "10" then
- set month of untilDate to October
- else if untilMonth is equal to "11" then
- set month of untilDate to November
- else if untilMonth is equal to "12" then
- set month of untilDate to December
- end if
-
- set newUntilDate to untilDate + 1 * days
- set newUntiDateStr to ((year of newUntilDate) as string)
- if (month of newUntilDate) as string is equal to "January" then
- set newUntiDateStr to newUntiDateStr & "01"
- else if (month of newUntilDate) as string is equal to "February" then
- set newUntiDateStr to newUntiDateStr & "02"
- else if (month of newUntilDate) as string is equal to "March" then
- set newUntiDateStr to newUntiDateStr & "03"
- else if (month of newUntilDate) as string is equal to "April" then
- set newUntiDateStr to newUntiDateStr & "04"
- else if (month of newUntilDate) as string is equal to "May" then
- set newUntiDateStr to newUntiDateStr & "05"
- else if (month of newUntilDate) as string is equal to "June" then
- set newUntiDateStr to newUntiDateStr & "06"
- else if (month of newUntilDate) as string is equal to "July" then
- set newUntiDateStr to newUntiDateStr & "07"
- else if (month of newUntilDate) as string is equal to "August" then
- set newUntiDateStr to newUntiDateStr & "08"
- else if (month of newUntilDate) as string is equal to "September" then
- set newUntiDateStr to newUntiDateStr & "09"
- else if (month of newUntilDate) as string is equal to "October" then
- set newUntiDateStr to newUntiDateStr & "10"
- else if (month of newUntilDate) as string is equal to "November" then
- set newUntiDateStr to newUntiDateStr & "11"
- else if (month of newUntilDate) as string is equal to "December" then
- set newUntiDateStr to newUntiDateStr & "12"
- end if
-
- if day of newUntilDate < 10 then
- set newUntiDateStr to newUntiDateStr & "0" & day of newUntilDate
- else
- set newUntiDateStr to newUntiDateStr & day of newUntilDate
- end if
- set icalRule to icalRule & newUntiDateStr & (items 9 through (length of untilDateStr) of untilDateStr) as string
- set icalRule to icalRule & (text endPos through (length of (remainText)) of remainText)
- set (item (parsidx + 6) of (myEvList of me)) to icalRule
- end if
- end if
- set parsidx to parsidx + 8
- end repeat
- -- put the events in iCal
-
- tell application "iCal"
- set my gProgression to 0.5
- set progression to my gProgression
- activate
- log "Entourage import, storing events in iCal " & (current date)
- set parsidx to 0
- set numEvents to (count (myEvList of me)) / 8
-
- if my gNTasks is not equal to 0 then
- set entIncrement to (round ((my gNEvents) / 50) rounding up)
- else
- set entIncrement to (round ((my gNEvents) / 100) rounding up)
- end if
-
- set progEntIdx to 0
-
- repeat numEvents times
- set evtSummary to (item (parsidx + 1) of (myEvList of me)) as Unicode text
- set evtStartDate to item (parsidx + 3) of (myEvList of me)
- set evtLocation to (item (parsidx + 7) of (myEvList of me))
- set evtNotes to (item (parsidx + 8) of (myEvList of me))
- set isAD to (item (parsidx + 2) of (myEvList of me)) as boolean
-
- if isAD is equal to true then
- set evtADD to true
- set evtEndDate to item (parsidx + 4) of (myEvList of me)
- if ((item (parsidx + 5) of (myEvList of me)) is equal to true) then
- set evtRecRule to (item (parsidx + 6) of (myEvList of me))
- --my translateReccurenceRule
- set myNewADEvent to make new event at the end of events of last calendar
- tell myNewADEvent
- set summary to evtSummary
- set start date to evtStartDate
- set end date to evtEndDate - 1
- set allday event to true
- set recurrence to evtRecRule
- set description to evtNotes
- set location to evtLocation
- end tell
- else
- set myNewADEvent to make new event at the end of events of last calendar
- tell myNewADEvent
- set summary to evtSummary
- set start date to evtStartDate
- set end date to evtEndDate - 1
- set allday event to true
- set description to evtNotes
- set location to evtLocation
- end tell
- end if
- else
- set evtEndDate to item (parsidx + 4) of (myEvList of me)
- if ((item (parsidx + 5) of (myEvList of me)) is equal to true) then
- set evtRecRule to (item (parsidx + 6) of (myEvList of me))
- -- my translateReccurenceRule
- make new event with properties {summary:evtSummary, start date:evtStartDate, end date:evtEndDate, recurrence:evtRecRule, location:evtLocation, description:evtNotes} at the end of events of last calendar
- else
- make new event with properties {summary:evtSummary, start date:evtStartDate, end date:evtEndDate, location:evtLocation, description:evtNotes} at the end of events of last calendar
- end if
- end if
-
-
- set parsidx to parsidx + 8
- set progEntIdx to progEntIdx + 1
-
- if progEntIdx is equal to entIncrement then
- set progEntIdx to 0
- set my gProgression to ((my gProgression) + gMinimunPBar)
- set progression to my gProgression
- end if
- end repeat
- -- log "Entourage import : end of events" & (current date)
- if my gNTasks is not equal to 0 then
- set my gProgression to 0.75
- set progression to my gProgression
- set parsjdx to 0
- set entIncrement to (round ((my gNTasks) / 50) rounding up)
- set progEntIdx to 0
- repeat my gNTasks times
- set tdSummary to (item (parsjdx + 1) of (myTaskList of me)) as Unicode text
- -- set tdPriority to no priority -- (item (parsjdx + 3) of (myTaskList of me)) as integer
- set msPriority to (item (parsjdx + 3) of (myTaskList of me)) as integer
- set tdContent to (item (parsjdx + 4) of (myTaskList of me)) as Unicode text
- if msPriority is equal to 1 then
- set tdPriority to high priority
- else if msPriority is equal to 4 then
- set tdPriority to medium priority
- else if msPriority is equal to 7 then
- set tdPriority to low priority
- else if msPriority is equal to 0 then
- set tdPriority to no priority
- end if
- set tdDueDate to item (parsjdx + 2) of (myTaskList of me)
- set yearPosDueDate to year of tdDueDate
- --Entourage marks ToDo with no due date to 1904
- if yearPosDueDate is not equal to 1904 then
- make new todo with properties {summary:tdSummary, priority:tdPriority, due date:tdDueDate, description:tdContent} at the end of todos of last calendar
- else
- make new todo with properties {summary:tdSummary, priority:tdPriority, description:tdContent} at the end of todos of last calendar
- end if
- set parsjdx to parsjdx + 4
- set progEntIdx to progEntIdx + 1
-
- if progEntIdx is equal to entIncrement then
- set progEntIdx to 0
- set my gProgression to ((my gProgression) + gMinimunPBar)
- set progression to my gProgression
- end if
- end repeat
- end if
- set progression to 1
- delay 0.9
- end tell
-on error errorMessageVariable
- log errorMessageVariable
- if errorMessageVariable is equal to "Cancel Operation" then
- tell application "iCal"
- log "Operation cancelled"
- end tell
- end if
-end try
-
---tell application "iCal"
--- dismiss progress
---end tell
-
--- reput Entourage to its initial state
---if (gEntourageWasRunning of me) is equal to false then
-tell application "Microsoft Entourage" to quit
---end if
-
-on translateReccurenceRule(entRule)
- set icalRule to entRule
-
- set offUntil to offset of "UNTIL=" in entRule
- if offUntil is not equal to 0 then
- set icalRule to text 1 through (offUntil + 5) of entRule
- set remainText to (text (offUntil + 6) through (length of (entRule)) of entRule)
- set endPos to offset of ";" in remainText
- set untilDateStr to (text 1 through (endPos - 1) of remainText) as string
- log untilDateStr
- set untilYear to (items 1 through 4 of untilDateStr) as string
- set untilMonth to (items 5 through 6 of untilDateStr) as string
- set untilDay to (items 7 through 8 of untilDateStr) as string
- set untilDate to date (untilMonth & "/" & untilDay & "/ " & untilYear)
- set newUntilDate to untilDate + 1 * days
- set newUntiDateStr to ((year of newUntilDate) as string)
- if (month of newUntilDate) as string is equal to "January" then
- set newUntiDateStr to newUntiDateStr & "01"
- else if (month of newUntilDate) as string is equal to "February" then
- set newUntiDateStr to newUntiDateStr & "02"
- else if (month of newUntilDate) as string is equal to "March" then
- set newUntiDateStr to newUntiDateStr & "03"
- else if (month of newUntilDate) as string is equal to "April" then
- set newUntiDateStr to newUntiDateStr & "04"
- else if (month of newUntilDate) as string is equal to "May" then
- set newUntiDateStr to newUntiDateStr & "05"
- else if (month of newUntilDate) as string is equal to "June" then
- set newUntiDateStr to newUntiDateStr & "06"
- else if (month of newUntilDate) as string is equal to "July" then
- set newUntiDateStr to newUntiDateStr & "07"
- else if (month of newUntilDate) as string is equal to "August" then
- set newUntiDateStr to newUntiDateStr & "08"
- else if (month of newUntilDate) as string is equal to "September" then
- set newUntiDateStr to newUntiDateStr & "09"
- else if (month of newUntilDate) as string is equal to "October" then
- set newUntiDateStr to newUntiDateStr & "10"
- else if (month of newUntilDate) as string is equal to "November" then
- set newUntiDateStr to newUntiDateStr & "11"
- else if (month of newUntilDate) as string is equal to "December" then
- set newUntiDateStr to newUntiDateStr & "12"
- end if
-
- if day of newUntilDate < 10 then
- set newUntiDateStr to newUntiDateStr & "0" & day of newUntilDate
- else
- set newUntiDateStr to newUntiDateStr & day of newUntilDate
- end if
- set icalRule to icalRule & newUntiDateStr & (items 9 through (length of untilDateStr) of untilDateStr) as string
- set icalRule to icalRule & (text endPos through (length of (remainText)) of remainText)
- end if
-
- return icalRule
-end translateReccurenceRule
-
-on getValueForCalRecRule(aRecRule, aRuleName)
- set ruleOffset to offset of aRuleName in aRecRule
- if ruleOffset is not equal to 0 then
- if (character (ruleOffset + (count of aRuleName)) of aRecRule) is equal to "=" then
- set remainStr to text (ruleOffset + (count of aRuleName) + 1) through (count of aRecRule) of aRecRule
- set endPos to offset of ";" in remainStr
- set result to text 1 through (endPos - 1) of remainStr
- return result
- else
- return ""
- end if
- else
- return ""
- end if
-end getValueForCalRecRule
-
--- Mail.applescript
--- iCal
-
-on show_mail_sbrs(subjectLine, messageText, myrecipients)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- repeat with i from (count of myrecipients) to 1 by -1
- tell mymail to make new to recipient at beginning of to recipients with properties {address:(item i of myrecipients)}
- end repeat
- set visible of mymail to true
- activate
- end tell
-end show_mail_sbrs
-
-on show_mail_sbr(subjectLine, messageText, myrecipient)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- set visible of mymail to true
- activate
- end tell
-end show_mail_sbr
-
-on send_mail_sb(subjectLine, messageText)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- set visible of mymail to true
- activate
- end tell
-end send_mail_sb
-
-on send_mail_sbr(subjectLine, messageText, myrecipient)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- send mymail
- end tell
-end send_mail_sbr
-
-on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
- set pfile to POSIX file invitationPath
- set myfile to pfile as alias
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- tell mymail
- tell content
- make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
- end tell
- end tell
- send mymail
- end tell
-end send_mail_sbrp
-
-on send_mail_sbp(subjectLine, messageText, invitationPath)
- set pfile to POSIX file invitationPath
- set myfile to pfile as alias
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail
- tell content
- make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
- end tell
- end tell
- set visible of mymail to true
- activate
- end tell
-end send_mail_sbp
-
-tell application "Mail" activate set mysubject to $1 set mybody to $2 set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:mysubject, content:mybody}) set visible of mymail to true end tell
-tell application "Mail" set mysubject to $1 set mybody to $2 set myrecipient to $3 set mymail to (make new outgoing message at the beginning of outgoing messages with properties { subject:mysubject, content:mybody}) tell mymail to make new to recipient at beginning of to recipients with properties {name:myrecipient} send mymail end tell
-tell application "Mail" set mysubject to $1 set mybody to $2 set myrecipient to $3 set pfile to $4 set myfile to pfile as alias set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:mysubject, content:mybody}) tell mymail to make new to recipient at beginning of to recipients with properties {name:myrecipient} tell mymail tell content make new attachment with properties {file name:myfile} at after the last word of the the last paragraph end tell end tell send mymail end tell
--- Mail.applescript
--- iCal
-
-on show_mail_sbrs(subjectLine, messageText, myrecipients)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- repeat with i from (count of myrecipients) to 1 by -1
- tell mymail to make new to recipient at beginning of to recipients with properties {address:(item i of myrecipients)}
- end repeat
- set visible of mymail to true
- activate
- end tell
-end show_mail_sbrs
-
-on show_mail_sbr(subjectLine, messageText, myrecipient)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- set visible of mymail to true
- activate
- end tell
-end show_mail_sbr
-
-on send_mail_sb(subjectLine, messageText)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- set visible of mymail to true
- activate
- end tell
-end send_mail_sb
-
-on send_mail_sbr(subjectLine, messageText, myrecipient)
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- send mymail
- end tell
-end send_mail_sbr
-
-on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
- set pfile to POSIX file invitationPath
- set myfile to pfile as alias
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
- tell mymail
- tell content
- make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
- end tell
- end tell
- send mymail
- end tell
-end send_mail_sbrp
-
-on send_mail_sbp(subjectLine, messageText, invitationPath)
- set pfile to POSIX file invitationPath
- set myfile to pfile as alias
- tell application "Mail"
- set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
- tell mymail
- tell content
- make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
- end tell
- end tell
- set visible of mymail to true
- activate
- end tell
-end send_mail_sbp
-
-tell application "Mail" activate set mysubject to $1 set mybody to $2 set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:mysubject, content:mybody}) set visible of mymail to true end tell
-tell application "Mail" set mysubject to $1 set mybody to $2 set myrecipient to $3 set mymail to (make new outgoing message at the beginning of outgoing messages with properties { subject:mysubject, content:mybody}) tell mymail to make new to recipient at beginning of to recipients with properties {name:myrecipient} send mymail end tell
-tell application "Mail" set mysubject to $1 set mybody to $2 set myrecipient to $3 set pfile to $4 set myfile to pfile as alias set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:mysubject, content:mybody}) tell mymail to make new to recipient at beginning of to recipients with properties {name:myrecipient} tell mymail tell content make new attachment with properties {file name:myfile} at after the last word of the the last paragraph end tell end tell send mymail end tell
-on activate_iterm(shellCommand)
- tell application "iTerm"
- make new terminal
- tell the first terminal
- activate current session
- launch session "Default Session"
- tell the last session
- write text shellCommand
- end tell
- end tell
- activate
- end tell
-end activate_iterm
-on activate_terminal(shellCommand)
- tell application "Finder"
- if exists process "Terminal" then
- tell application "Terminal"
- activate
- do script shellCommand
- end tell
- else
- tell application "Terminal"
- activate
- do script shellCommand in window 0
- end tell
- end if
- end tell
-end activate_terminal
-tell application "Mail"
- set composeWindow to make new outgoing message with properties {subject:"SelfTest message", content:"This is a test message for SelfTest.", visible:true}
- close composeWindow without saving
-end tell
--- dynamicCall publish("[[QTExpNameOut]]")
-
-on publish(attachedFilePath)
- tell application "Mail"
- set new_message to make new outgoing message
- tell new_message
- set visible to true
- make new to recipient at end of to recipients
- tell content
- make new attachment with properties {file name:attachedFilePath} at after the last paragraph
- end tell
- end tell
- activate
- end tell
-end publish
--- ${TM_NEW_FILE_BASENAME}.applescript
---
--- Created by ${TM_USERNAME} on ${TM_DATE}.
--- Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
---
-
-on open dropped_items
-
- -- do something useful
-
-end open
--- ${TM_NEW_FILE_BASENAME}.applescript
---
--- Created by ${TM_USERNAME} on ${TM_DATE}.
--- Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
---
-
-on adding folder items to this_folder after receiving added_items
-
- -- do something useful
-
-end adding folder items to
-
-
-
-on removing folder items from this_folder after losing removed_items
-
- -- do something useful
-
-end removing folder items from
-
-
-
-on opening folder this_folder
-
- -- do something useful
-
-end opening folder
-
-
-
-on moving folder window for this_folder from original_bounds
-
- -- do something useful
-
-end moving folder window for
-
-
-
-on closing folder window for this_folder
-
- -- do something useful
-
-end closing folder window for
--- ${TM_NEW_FILE_BASENAME}.applescript
---
--- Created by ${TM_USERNAME} on ${TM_DATE}.
--- Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
---
--- Place in ~/Library/Application Support/Quicksilver/Actions/
---
-
-using terms from application "Quicksilver"
- on process text the_text
-
- -- do something useful
-
- end process text
-end using terms from
--- ${TM_NEW_FILE_BASENAME}.applescript
---
--- Created by ${TM_USERNAME} on ${TM_DATE}.
--- Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
---
-
-on run
-
- -- do something useful
-
-end run
--- ${TM_NEW_FILE_BASENAME}.applescript
---
--- Created by ${TM_USERNAME} on ${TM_DATE}.
--- Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
---
-
-on run argv
-
- -- do something useful
-
-end run
------------------------------------------------------------------------------
--- Name: docs/mac/M5build.applescript
--- Purpose: Automatic build of projects with CodeWarrior 5
--- Author: Gilles Depeyrot
--- Modified by:
--- Created: 06.10.2001
--- RCS-ID: $Id: M5build.applescript,v 1.3 2001/12/02 20:02:17 GD Exp $
--- Copyright: (c) 2001 Gilles Depeyrot
--- Licence: wxWindows licence
------------------------------------------------------------------------------
---
--- This AppleScript automatically recurses through the selected folder looking for
--- and building CodeWarrior projects.
--- To use this script, simply open it with the 'Script Editor' and run it.
---
-
---
--- Suffix used to recognize CodeWarrior project files
---
-property gProjectSuffix : "M5.mcp"
-
---
--- Values used to create the log file
---
-property gEol : "
-"
-property gSeparator : "-------------------------------------------------------------------------------" & gEol
-
---
--- Project and build success count
---
-set theProjectCount to 0
-set theProjectSuccessCount to 0
-
---
--- Default log file name
---
-set theDate to (day of (current date)) & "/" & GetMonthIndex(current date) & "/" & (year of (current date))
-set theLogFileName to "build-" & theDate & ".log"
-
---
--- Ask the user to select the wxWindows samples folder
---
-set theFolder to choose folder with prompt "Select the folder in which to build the projects"
-
---
--- Ask the user to choose the build log file
---
-set theLogFile to choose file name with prompt "Save the build log file" default name theLogFileName
-
---
--- Open the log file to record the build log
---
-set theLogFileRef to open for access theLogFile with write permission
-
---
--- Write log file header
---
-write gSeparator starting at 0 to theLogFileRef
-write "Build log" & gEol to theLogFileRef
-write gSeparator to theLogFileRef
-write "start on " & ((current date) as string) & gEol to theLogFileRef
-write gSeparator to theLogFileRef
-write "building projects in '" & (theFolder as string) & "'" & gEol to theLogFileRef
-write gSeparator to theLogFileRef
-
---
--- Build or Rebuild targets?
---
-set theText to "Build or rebuild projects?"
-set theBuild to button returned of (display dialog theText buttons {"Cancel", "Build", "Rebuild"} default button "Rebuild" with icon note)
-if theBuild is not equal to "Cancel" then
- --
- -- Build which targets?
- --
- set theText to theBuild & " Classic or Carbon targets?"
- set theType to button returned of (display dialog theText buttons {"Cancel", "Classic", "Carbon"} default button "Carbon" with icon note)
- if theType is not equal to "Cancel" then
- --
- -- Build Debug or Release targets?
- --
- set theText to theBuild & " " & theType & " Debug or " & theType & " Release targets?"
- set theOption to button returned of (display dialog theText buttons {"Cancel", "Release", "Debug"} default button "Debug" with icon note)
- if theOption is not equal to "Cancel" then
- set theTarget to theType & " " & theOption
-
- write "building project targets '" & theTarget & "'" & gEol to theLogFileRef
- write gSeparator to theLogFileRef
-
- BuildProjects(theLogFileRef, theFolder, theTarget, theBuild is equal to "Rebuild")
-
- end if
- end if
-end if
-
---
--- Write log file footer
---
-write "successful build of " & theProjectSuccessCount & " projects out of " & theProjectCount & gEol to theLogFileRef
-write gSeparator to theLogFileRef
-write "end on " & ((current date) as string) & gEol to theLogFileRef
-write gSeparator to theLogFileRef
---
--- Close the log file
---
-close access theLogFileRef
-
---
--- BuildProjects
---
-on BuildProjects(inLogFileRef, inFolder, inTarget, inRebuild)
- global theProjectCount, theProjectSuccessCount
-
- tell application "Finder" to update inFolder
-
- try
- tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
- on error
- set theProject to ""
- end try
-
- if theProject is not "" then
- set theProjectCount to theProjectCount + 1
-
- write "building project '" & theProject & "'" & gEol to inLogFileRef
-
- tell application "CodeWarrior IDE 4.0.4"
- --
- -- Open the project in CodeWarrior
- --
- open theProject
- --
- -- Change to the requested target
- --
- Set Current Target inTarget
- --
- -- Remove object code if rebuild requested
- --
- if inRebuild then
- Remove Binaries
- end if
- --
- -- Build/Rebuild the selected target
- --
- set theBuildInfo to Make Project with ExternalEditor
- --
- -- Close the project
- --
- Close Project
- end tell
- --
- -- Report errors to build log file
- --
- write gEol to inLogFileRef
- ReportBuildInfo(inLogFileRef, theBuildInfo)
- write gSeparator to inLogFileRef
- end if
-
- tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
- repeat with theFolder in theSubFolders
- BuildProjects(inLogFileRef, theFolder, inTarget, inRebuild)
- end repeat
-
-end BuildProjects
-
---
--- ReportBuildInfo
---
-on ReportBuildInfo(inLogFileRef, inBuildInfo)
- global theProjectCount, theProjectSuccessCount
-
- set theErrorCount to 0
- set theWarningCount to 0
-
- repeat with theInfo in inBuildInfo
- tell application "CodeWarrior IDE 4.0.4"
- set theKind to ((messageKind of theInfo) as string)
-
- tell me to write "*** " & theKind & " *** " & message of theInfo & gEol to inLogFileRef
- try
- set theFile to ((file of theInfo) as string)
- on error
- set theFile to ""
- end try
- if theFile is not "" then
- tell me to write theFile & " line " & lineNumber of theInfo & gEol to inLogFileRef
- end if
- tell me to write gEol to inLogFileRef
- end tell
-
- if MessageKindIsError(theKind) then
- set theErrorCount to theErrorCount + 1
- else
- set theWarningCount to theWarningCount + 1
- end if
- end repeat
-
- if theErrorCount is 0 then
- set theProjectSuccessCount to theProjectSuccessCount + 1
- write "build succeeded with " & theWarningCount & " warning(s)" & gEol to inLogFileRef
- else
- write "build failed with " & theErrorCount & " error(s) and " & theWarningCount & " warning(s)" & gEol to inLogFileRef
- end if
-end ReportBuildInfo
-
---
--- MessageKindIsError
---
-on MessageKindIsError(inKind)
- if inKind is "compiler error" or inKind is "linker error" or inKind is "generic error" then
- return true
- else
- return false
- end if
-end MessageKindIsError
-
---
--- GetMonthIndex
---
-on GetMonthIndex(inDate)
- set theMonth to the month of inDate
- set theMonthList to {January, February, March, April, May, June, July, August, September, October, November, December}
- repeat with i from 1 to the number of items in theMonthList
- if theMonth is item i of theMonthList then
- return i
- end if
- end repeat
-end GetMonthIndex
------------------------------------------------------------------------------
--- Name: docs/mac/M5mcp2xml.applescript
--- Purpose: Automatic export of CodeWarrior 5 projects to XML files
--- Author: Gilles Depeyrot
--- Modified by:
--- Created: 28.11.2001
--- RCS-ID: $Id: M5mcp2xml.applescript,v 1.2 2001/12/02 20:02:17 GD Exp $
--- Copyright: (c) 2001 Gilles Depeyrot
--- Licence: wxWindows licence
------------------------------------------------------------------------------
---
--- This AppleScript automatically recurses through the selected folder looking for
--- and exporting CodeWarrior projects to xml files.
--- To use this script, simply open it with the 'Script Editor' and run it.
---
-
---
--- Suffix used to recognize CodeWarrior project files
---
-property gProjectSuffix : "M5.mcp"
-
---
--- Project and build success count
---
-set theProjectCount to 0
-set theProjectSuccessCount to 0
-
---
--- Ask the user to select the wxWindows samples folder
---
-set theFolder to choose folder with prompt "Select the wxWindows folder"
-
-ExportProjects(theFolder)
-
-tell me to display dialog "Exported " & theProjectSuccessCount & " projects out of " & theProjectCount
-
---
--- ExportProjects
---
-on ExportProjects(inFolder)
- global theProjectCount, theProjectSuccessCount
-
- tell application "Finder" to update inFolder
-
- try
- tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
- on error
- set theProject to ""
- end try
-
- if theProject is not "" then
- set theProjectCount to theProjectCount + 1
-
- -- save the current text delimiters
- set theDelimiters to my text item delimiters
-
- -- replace the ".mcp" extension with ".xml"
- set my text item delimiters to "."
- set theList to (every text item of theProject)
- set theList to (items 1 thru -2 of theList)
- set theExport to (theList as string) & ".xml"
-
- -- restore the text delimiters
- set my text item delimiters to theDelimiters
-
- tell application "CodeWarrior IDE 4.0.4"
- --
- -- Open the project in CodeWarrior
- --
- open theProject
- --
- -- Export the selected project
- --
- try
- export project document 1 in theExport
- set theProjectSuccessCount to theProjectSuccessCount + 1
- on error number errnum
- tell me to display dialog "Error " & errnum & " exporting " & theExport
- end try
- --
- -- Close the project
- --
- Close Project
- end tell
- end if
-
- tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
- repeat with theFolder in theSubFolders
- ExportProjects(theFolder)
- end repeat
-
-end ExportProjects
------------------------------------------------------------------------------
--- Name: docs/mac/M5xml2mcp.applescript
--- Purpose: Automatic import of CodeWarrior 5 xml files to projects
--- Author: Gilles Depeyrot
--- Modified by:
--- Created: 30.11.2001
--- RCS-ID: $Id: M5xml2mcp.applescript,v 1.2 2001/12/02 20:02:17 GD Exp $
--- Copyright: (c) 2001 Gilles Depeyrot
--- Licence: wxWindows licence
------------------------------------------------------------------------------
---
--- This AppleScript automatically recurses through the selected folder looking for
--- and importing CodeWarrior xml files to projects
--- To use this script, simply open it with the 'Script Editor' and run it.
---
-
---
--- Suffix used to recognize CodeWarrior xml files
---
-property gXmlSuffix : "M5.xml"
-
---
--- Project and build success count
---
-set theXmlCount to 0
-set theXmlSuccessCount to 0
-
---
--- Ask the user to select the wxWindows samples folder
---
-set theFolder to choose folder with prompt "Select the wxWindows folder"
-
-ImportProjects(theFolder)
-
-tell me to display dialog "Imported " & theXmlSuccessCount & " xml files out of " & theXmlCount buttons {"OK"}
-
---
--- ImportProjects
---
-on ImportProjects(inFolder)
- global theXmlCount, theXmlSuccessCount
-
- tell application "Finder" to update inFolder
-
- try
- tell application "Finder" to set theXml to ((the first file of inFolder whose name ends with gXmlSuffix) as string)
- on error
- set theXml to ""
- end try
-
- if theXml is not "" then
- set theXmlCount to theXmlCount + 1
-
- -- save the current text delimiters
- set theDelimiters to my text item delimiters
-
- -- replace the ".xml" extension with ".mcp"
- set my text item delimiters to "."
- set theList to (every text item of theXml)
- set theList to (items 1 thru -2 of theList)
- set theImport to (theList as string) & ".mcp"
-
- -- restore the text delimiters
- set my text item delimiters to theDelimiters
-
- tell application "CodeWarrior IDE 4.0.4"
- --
- -- Import the selected xml file
- --
- try
- make new project document as theImport with data theXml
- set theXmlSuccessCount to theXmlSuccessCount + 1
- --
- -- Close the project
- --
- Close Project
- on error number errnum
- tell me to display dialog "Error " & errnum & " importing " & theXml & " to " & theImport
- end try
- end tell
- end if
-
- tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
- repeat with theFolder in theSubFolders
- ImportProjects(theFolder)
- end repeat
-
-end ImportProjects
------------------------------------------------------------------------------
--- Name: docs/mac/M8mcp2xml.applescript
--- Purpose: Automatic export of CodeWarrior 8 projects to XML files
--- Author: Gilles Depeyrot
--- Modified by: Stefan Csomor for M8
--- Created: 28.11.2001
--- RCS-ID: $Id: M8mcp2xml.applescript,v 1.1 2003/01/16 06:44:49 SC Exp $
--- Copyright: (c) 2001 Gilles Depeyrot
--- Licence: wxWindows licence
------------------------------------------------------------------------------
---
--- This AppleScript automatically recurses through the selected folder looking for
--- and exporting CodeWarrior projects to xml files.
--- To use this script, simply open it with the 'Script Editor' and run it.
---
-
---
--- Suffix used to recognize CodeWarrior project files
---
-property gProjectSuffix : "M8.mcp"
-
---
--- Project and build success count
---
-set theProjectCount to 0
-set theProjectSuccessCount to 0
-
---
--- Ask the user to select the wxWindows samples folder
---
-set theFolder to choose folder with prompt "Select the wxWindows folder"
-
-ExportProjects(theFolder)
-
-tell me to display dialog "Exported " & theProjectSuccessCount & " projects out of " & theProjectCount
-
---
--- ExportProjects
---
-on ExportProjects(inFolder)
- global theProjectCount, theProjectSuccessCount
-
- tell application "Finder" to update inFolder
-
- try
- tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
- on error
- set theProject to ""
- end try
-
- if theProject is not "" then
- set theProjectCount to theProjectCount + 1
-
- -- save the current text delimiters
- set theDelimiters to my text item delimiters
-
- -- replace the ".mcp" extension with ".xml"
- set my text item delimiters to "."
- set theList to (every text item of theProject)
- set theList to (items 1 thru -2 of theList)
- set theExport to (theList as string) & ".xml"
-
- -- restore the text delimiters
- set my text item delimiters to theDelimiters
-
- tell application "CodeWarrior IDE"
- --
- -- Open the project in CodeWarrior
- --
- open theProject
- --
- -- Export the selected project
- --
- try
- export project document 1 to theExport
- set theProjectSuccessCount to theProjectSuccessCount + 1
- on error number errnum
- tell me to display dialog "Error " & errnum & " exporting " & theExport
- end try
- --
- -- Close the project
- --
- Close Project
- end tell
- end if
-
- tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
- repeat with theFolder in theSubFolders
- ExportProjects(theFolder)
- end repeat
-
-end ExportProjects
------------------------------------------------------------------------------
--- Name: docs/mac/M8xml2mcp.applescript
--- Purpose: Automatic import of CodeWarrior 8 xml files to projects
--- Author: Gilles Depeyrot
--- Modified by: Stefan Csomor
--- Created: 30.11.2001
--- RCS-ID: $Id: M8xml2mcp.applescript,v 1.2 2004/04/28 22:03:15 DS Exp $
--- Copyright: (c) 2001 Gilles Depeyrot
--- Licence: wxWindows licence
------------------------------------------------------------------------------
---
--- This AppleScript automatically recurses through the selected folder looking for
--- and importing CodeWarrior xml files to projects
--- To use this script, simply open it with the 'Script Editor' and run it.
---
-
---
--- Suffix used to recognize CodeWarrior xml files
---
-property gXmlSuffix : "M8.xml"
-
---
--- Project and build success count
---
-set theXmlCount to 0
-set theXmlSuccessCount to 0
-
---
--- Ask the user to select the wxWindows samples folder
---
-set theFolder to choose folder with prompt "Select the wxWindows folder"
-
-ImportProjects(theFolder)
-
-tell me to display dialog "Imported " & theXmlSuccessCount & " xml files out of " & theXmlCount buttons {"OK"}
-
---
--- ImportProjects
---
-on ImportProjects(inFolder)
- global theXmlCount, theXmlSuccessCount
-
- tell application "Finder" to update inFolder
-
- tell application "Finder" to set theXmlList to (every file of inFolder whose name ends with gXmlSuffix)
-
- repeat with theXml in theXmlList
- set theXml to theXml as string
- set theXmlCount to theXmlCount + 1
-
- -- save the current text delimiters
- set theDelimiters to my text item delimiters
-
- -- replace the ".xml" extension with ".mcp"
- set my text item delimiters to "."
- set theList to (every text item of theXml)
- set theList to (items 1 thru -2 of theList)
- set theImport to (theList as string) & ".mcp"
-
- -- restore the text delimiters
- set my text item delimiters to theDelimiters
-
- tell application "CodeWarrior IDE"
- --
- -- Import the selected xml file
- --
- try
- make new project document as theImport with data theXml
- set theXmlSuccessCount to theXmlSuccessCount + 1
- --
- -- Close the project
- --
- Close Project
- on error number errnum
- tell me to display dialog "Error " & errnum & " importing " & theXml & " to " & theImport
- end try
- end tell
- end repeat
-
- tell application "Finder" to set theSubFolders to every folder of inFolder whose name does not end with " Data"
- repeat with theFolder in theSubFolders
- ImportProjects(theFolder)
- end repeat
-
-end ImportProjects
----------------------------------------------------------------------------------
--- Name: docs/mac/SetXMLCreator.applescript
--- Purpose: Sets the creator types of the XML files
--- Author: Ryan Wilcox
--- Modified by:
--- Created: 2004-03-30
--- RCS-ID: $Id: SetXMLCreator.applescript,v 1.2 2004/03/30 10:26:17 JS Exp $
--- Copyright: (c) 2004 Ryan Wilcox
--- Licence: wxWindows licence
---
--- Press the run button and select the file you need (or, alternatively, save the
--- script as an application drag-and-drop the files on top of it).
----------------------------------------------------------------------------------
-
-on run
- set myFile to choose file
- open ({myFile})
-end run
-
-
-on open (fileList)
-
- repeat with each in fileList
-
- tell application "Finder"
- if name of each contains "M5" or name of each contains "M7" or name of each contains "M8" then
- set creator type of each to "CWIE"
- set file type of each to "TEXT"
-
- log "set"
- end if
-
- end tell
- end repeat
-end open
-
-(* Application.applescript *)
-
-(* This example employs many UI features in Cocoa, such as a 'drawer' and 'panels' as well as using the 'do shell script' to provide a UI frontend to the 'gnutar' shell tool to build tar archives. It also demonstrates how to design an application that is a droplet as well. You can also fine an example of how to use the 'user-defaults' class. *)
-
-(* The structure of this script is as follows:
- Properties Properties needed for the application.
- Event Handlers Handlers that are called by actions in the UI.
- Handlers Handlers that are called within the script.
-*)
-
-(* ==== Properties ==== *)
-
--- Settings
-property openWindowOnLaunch : true
-property showProgress : true
-property compressArchive : true
-property preserveIDs : true
-property followLinks : false
-property verboseMode : false
-property defaultLocation : ""
-
--- Others
-property windowOpened : false
-property progressPanel : missing value
-property fileNames : {}
-property filesDataSource : missing value
-
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called as early in the process of launching an application as is possible. The handler is a good place to register our settings as well as read in the current set of settings.
---
-on will finish launching theObject
- set windowOpened to false
-
- registerSettings()
- readSettings()
-end will finish launching
-
--- This event handler is the last handler called in the process of launching an application. If the handler is called and a window hasn't been shown yet (via the 'open' event handler) then we need to show the main window here (as well was opening the settings drawer).
---
-on launched theObject
- if windowOpened is false then
- showWindow()
- showSettings()
- end if
-end launched
-
--- This event handler is called when the object that is associated with it is loaded from its nib file. It's a good place to do any one-time initialization, which in this case is to create the data source for the table view.
---
-on awake from nib theObject
- -- Create the data source for the table view
- set filesDataSource to make new data source at end of data sources with properties {name:"files"}
-
- -- Create the "files" data column
- make new data column at end of data columns of filesDataSource with properties {name:"files"}
-
- -- Assign the data source to the table view
- set data source of theObject to filesDataSource
-
- -- Register for the "file names" drag types
- tell theObject to register drag types {"file names", "color"}
-end awake from nib
-
--- This event handler is called (in this example) when the user drags any finder items over the table view.
---
-on drop theObject drag info dragInfo
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
-
- -- We are only interested in either "file names" or "color" data types
- if "file names" is in dataTypes then
- -- Initialize the list of files to an empty list
- set theFiles to {}
-
- -- We want the data as a list of file names, so set the preferred type to "file names"
- set preferred type of pasteboard of dragInfo to "file names"
-
- -- Get the list of files from the pasteboard
- set theFiles to contents of pasteboard of dragInfo
-
- -- Make sure we have at least one item
- if (count of theFiles) > 0 then
- -- Turn off the updating of the views
- set update views of filesDataSource to false
-
- -- For every item in the list, make a new data row and set it's contents
- repeat with theItem in theFiles
- set theDataRow to make new data row at end of data rows of filesDataSource
- set contents of data cell "files" of theDataRow to quoted form of theItem
- set fileNames to fileNames & {quoted form of theItem}
- end repeat
-
- -- Turn back on the updating of the views
- set update views of filesDataSource to true
- end if
- end if
-
- -- Set the preferred type back to the default
- set preferred type of pasteboard of dragInfo to ""
-
- return true
-end drop
-
--- This event handler is called when you drag any file/folder items in the Finder onto the application icon (either in the Finder or in the Dock). It can be called as many times as the user drags items onto the application icon, therefore the main process here is to append the list of names the existing list of names. Then we conditionally open the window, make the archive (displaying a progress bar if requested) and then if a window hasn't been opened we simply quit.
---
-on open names
- -- Append the list of names to our current list
- repeat with i from 1 to count of names
- set fileNames to fileNames & {quoted form of (POSIX path of (item i of names))}
- end repeat
-
- -- Show the window if requested
- if openWindowOnLaunch then
- -- Of course, only show if it hasn't already been opened
- if not windowOpened then
- showWindow()
- end if
- end if
-
- -- If the main window wasn't opened then go ahead and process the list of files, making an archive with a determined name.
- if not windowOpened then
- set windowOpened to true
-
- -- Get the generated archive name
- set archiveFileName to getArchiveFileName()
-
- -- Show the progress panel if requested
- if showProgress then
- showProgressPanel(false, archiveFileName)
- end if
-
- -- Make the archive
- set theResult to makeArchive(archiveFileName)
-
- -- If we are in verbose mode, then show the results in the log window
- if verboseMode then
- set contents of text view "log" of scroll view "log" of window "log" to theResult
- show window "log"
- end if
-
- -- Hide the progress panel (if shown)
- if showProgress then
- hideProgressPanel(false)
- end if
-
- -- Go ahead and quit, as we are done. (This might need some rethinking, as it probably isn't the right thing to do if for instance the log window is shown, with the verbose mode on.
- quit
- else if openWindowOnLaunch then
- -- Turn off the updating of the views
- set update views of filesDataSource to false
-
- -- Add the files to the data source
- repeat with i from 1 to count of names
- set theDataRow to make new data row at end of data rows of filesDataSource
- set contents of data cell "files" of theDataRow to quoted form of (POSIX path of (item i of names))
- end repeat
-
- -- Turn back on the updating of the views
- set update views of filesDataSource to true
- end if
-end open
-
--- This handler is the last handler to be called before the application quits. It's a good place to the get current settings from the setting drawer and write them out (but only if the window has been opened).
---
-on will quit theObject
- if windowOpened then
- getSettingsFromUI()
- writeSettings()
- end if
-end will quit
-
--- This event handler is called when a UI object is clicked (any object that is linked to this handler in Interface Builder that is...).
---
-on clicked theObject
- if name of theObject is "make" then
- -- Make sure that we have at least one item to make into an archive.
- if (count of fileNames) is greater than 0 then
- -- Get the current settings in the UI from the settings drawer.
- getSettingsFromUI()
-
- -- Determine a good default name based on the first file item, and then ask for the archive name.
- set defaultName to last word of (item 1 of fileNames as string) & ".tar"
- if compressArchive then set defaultName to defaultName & ".gz"
-
- -- Setup the 'save panel'
- tell save panel
- set title to "Save Archive As"
- set prompt to "Make"
- set treat packages as directories to false
- end tell
-
- -- Display the save panel as a sheet (we will do the processing in the 'on panel ended' handler)
- display save panel in directory defaultLocation with file name defaultName attached to window of theObject
- else
- -- Alert the user that they need to have at least one file item.
- display alert "Missing Files/Folders" as critical message "You must add files or folders by dragging them on to the application icon in order to make an archive." attached to window "main"
- end if
- else if name of theObject is "settings" then
- -- This simply toggles the state of the 'settings' button, showing/hiding the settings drawer as needed.
- tell window "main"
- set currentState to state of drawer "settings"
-
- if currentState is drawer closed then
- my showSettings()
- else if currentState is drawer opened then
- my hideSettings()
- end if
-
- end tell
- else if name of theObject is "choose" then
- -- Choose the default location (folder) in which to store the archive when the application is used as a droplet (without the main window begin shown.)
- chooseDefaultLocation()
- end if
-end clicked
-
--- This event handler is called when the save panel (which was shown as a sheet) has been concluded.
---
-on panel ended theObject with result withResult
- if theObject is the open panel then
- if withResult is 1 then
- set theLocation to item 1 of (path names of open panel as list)
- set contents of text field "default location" of drawer "settings" of window "main" to theLocation as string
- end if
- else if theObject is the save panel and withResult is 1 then
- -- We need to hide the panel as we might be putting up a progress panel next
- set visible of save panel to false
-
- -- Show the progress panel (if requested).
- if showProgress then
- showProgressPanel(true, path name of save panel)
- end if
-
- -- The main point of this entire application. Make the archive (which expects everything to be a POSIX path.
- set theResult to makeArchive(path name of save panel)
-
- -- If requested, show the results of the make in the log window
- if verboseMode then
- set contents of text view "log" of scroll view "log" of window "log" to theResult
- show window "log"
- end if
-
- -- Hide the progres panel (if shown)
- if showProgress then
- hideProgressPanel(true)
- end if
- end if
-end panel ended
-
-
-(* ==== Handlers ==== *)
-
--- This is the bread and butter of the application. It simply creates the command to be issued to 'do shell script' and returns the result.
---
-on makeArchive(archiveName)
- -- The 'gnutar' command in it's basic strucure.
- set scriptCommand to "gnutar " & getOptionsString() & " -f " & archiveName
-
- -- Add each of the file items to the command.
- repeat with fileName in fileNames
- set scriptCommand to scriptCommand & space & fileName
- end repeat
-
- -- Tell the shell to do it's thing.
- return do shell script scriptCommand
-end makeArchive
-
--- Returns the various options chosen by the user in a simple string beginning with the required '-c' which is used to tell 'gnutar' to create a new archive. You can do a 'man gnutar' to see all of the options in a terminal window.
---
-on getOptionsString()
- set optionsString to "-c"
-
- if compressArchive then
- set optionsString to optionsString & "z"
- end if
- if preserveIDs then
- set optionsString to optionsString & "p"
- end if
- if followLinks then
- set optionsString to optionsString & "h"
- end if
- if verboseMode then
- set optionsString to optionsString & "v"
- end if
-
- return optionsString
-end getOptionsString
-
--- Returns a self determined archive name based on the first item in the file item list.
---
-on getArchiveFileName()
- set archiveFileName to ""
-
- -- Prepend the file name with the default location
- if defaultLocation is not equal to "" then
- set archiveFileName to defaultLocation
- if archiveFileName does not end with "/" then
- set archiveFileName to archiveFileName & "/"
- end if
- end if
-
- -- Append the last word of the first item plus a '.tar' or '.tar.gz' (which is the normal extension for tar files.
- set archiveFileName to archiveFileName & last word of (item 1 of fileNames as string) & ".tar"
- if compressArchive then set archiveFileName to archiveFileName & ".gz"
-
- return archiveFileName
-end getArchiveFileName
-
--- Loads the progress panel (if needed) and then displays it.
---
-on showProgressPanel(attachedToWindow, archiveFileName)
- -- Only load the progress panel once.
- if progressPanel is missing value then
- load nib "ProgressPanel"
- set progressPanel to window "progress"
- end if
-
- -- Set the status item in the progress panel
- set content of text field "status" of progressPanel to "Making Archive: " & (call method "lastPathComponent" of archiveFileName)
-
- -- Display the progress panel appropriately.
- if attachedToWindow then
- display panel progressPanel attached to window "main"
- else
- show progressPanel
- end if
-
- -- Start spinning the progress bar.
- tell progressPanel
- set uses threaded animation of progress indicator "progress" to true
- tell progress indicator "progress" to start
- end tell
-end showProgressPanel
-
--- Hides the progress panel.
---
-on hideProgressPanel(attachedToWindow)
- if attachedToWindow then
- tell progress indicator "progress" of progressPanel to stop
- close panel progressPanel
- else
- hide progressPanel
- end if
-
- -- Set the status item in the progress panel
- set content of text field "status" of progressPanel to ""
-end hideProgressPanel
-
--- Shows the main window, doing any necessary setup of the drawer as necessary.
---
-on showWindow()
- tell window "main"
- tell drawer "settings"
- -- Initialize some settings to appropriate values for the settings drawer. These will set the current, min and max contents size to be the same, which will have the effect of keeping the settings drawer size appropriate to it's contents. (In other words it can't grow or shrink.)
- set leading offset to 20
- set trailing offset to 20
- set content size to {436, 136}
- set minimum content size to {436, 136}
- set maximum content size to {436, 136}
-
- -- Set the UI settings
- my setSettingsInUI()
- end tell
-
- set visible to true
- end tell
-
- set windowOpened to true
-end showWindow
-
--- Shows the current list of file names as a list of strings in the text view of the main window.
---
-on updateFileNamesInUI()
- tell window "main"
- set AppleScript's text item delimiters to return
- set contents of text view "files" of scroll view "files" to fileNames as string
- set AppleScript's text item delimiters to ""
- end tell
-end updateFileNamesInUI
-
--- Prompts the user to select a default location for new archives.
---
-on chooseDefaultLocation()
- -- Setup the open panel properties
- tell open panel
- set can choose directories to true
- set can choose files to false
- set prompt to "Choose"
- end tell
-
- display open panel attached to window "main"
-end chooseDefaultLocation
-
--- Show's the settings drawer, also adjusting the title of the 'settings' button.
---
-on showSettings()
- tell window "main"
- tell drawer "settings" to open drawer on bottom edge
- set title of button "settings" to "Hide Settings"
- end tell
-end showSettings
-
--- Hide's the settings drawer, also adjusting the title of the 'settings' button.
---
-on hideSettings()
- tell window "main"
- tell drawer "settings" to close drawer
- set title of button "settings" to "Show Settings"
- end tell
-end hideSettings
-
--- Sets the settings properties based on the states of the various UI items in the settings drawer.
---
-on getSettingsFromUI()
- tell drawer "settings" of window "main"
- set defaultLocation to contents of text field "default location"
- set openWindowOnLaunch to (state of button "open window") as boolean
- set showProgress to (state of button "show progress") as boolean
- set compressArchive to (state of button "compress archive") as boolean
- set preserveIDs to (state of button "preserve ids") as boolean
- set followLinks to (state of button "follow links") as boolean
- set verboseMode to (state of button "verbose mode") as boolean
- end tell
-end getSettingsFromUI
-
--- Sets the state of the UI elements int he settings drawer based upon the settings properties.
---
-on setSettingsInUI()
- tell drawer "settings" of window "main"
- set contents of text field "default location" to defaultLocation
- set state of button "open window" to openWindowOnLaunch
- set state of button "show progress" to showProgress
- set state of button "compress archive" to compressArchive
- set state of button "preserve ids" to preserveIDs
- set state of button "follow links" to followLinks
- set state of button "verbose mode" to verboseMode
- end tell
-end setSettingsInUI
-
--- Registers the settings (application preferences) with the 'user defaults'.
---
-on registerSettings()
- tell user defaults
- -- Add all of the new defalt entries
- make new default entry at end of default entries with properties {name:"openWindowOnLaunch", contents:openWindowOnLaunch}
- make new default entry at end of default entries with properties {name:"showProgress", contents:showProgress}
- make new default entry at end of default entries with properties {name:"compressArchive", contents:compressArchive}
- make new default entry at end of default entries with properties {name:"preserveIDs", contents:preserveIDs}
- make new default entry at end of default entries with properties {name:"followLinks", contents:followLinks}
- make new default entry at end of default entries with properties {name:"verboseMode", contents:verboseMode}
- make new default entry at end of default entries with properties {name:"defaultLocation", contents:defaultLocation}
-
- -- Now we need to register the new entries in the user defaults
- register
- end tell
-end registerSettings
-
--- Reads the settings (application preferences) from the 'user defaults'.
---
-on readSettings()
- tell user defaults
- set openWindowOnLaunch to contents of default entry "openWindowOnLaunch" as boolean
- set showProgress to contents of default entry "showProgress" as boolean
- set compressArchive to contents of default entry "compressArchive" as boolean
- set preserveIDs to contents of default entry "preserveIDs" as boolean
- set followLinks to contents of default entry "followLinks" as boolean
- set verboseMode to contents of default entry "verboseMode" as boolean
- set defaultLocation to contents of default entry "defaultLocation"
- end tell
-end readSettings
-
--- Writes the settings (application preferences) to the 'user defaults'.
---
-on writeSettings()
- tell user defaults
- set contents of default entry "openWindowOnLaunch" to openWindowOnLaunch
- set contents of default entry "showProgress" to showProgress
- set contents of default entry "compressArchive" to compressArchive
- set contents of default entry "preserveIDs" to preserveIDs
- set contents of default entry "followLinks" to followLinks
- set contents of default entry "verboseMode" to verboseMode
- set contents of default entry "defaultLocation" to defaultLocation
- end tell
-end writeSettings
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Assistant.applescript *)
-
-(* This application is to present one possible implementation of an 'Assistant'. The strategy that is used is to use a tab view and use seperate tab view items to represent an information panel. The tab view is set without a border or visible tabs. This gives the appearance of a panel full of UI elements to being switched in and out. The design also supports the ability to easily add, remove or change the order of info panels. One thing of note is that and that is incorporated in this strategy is that UI elements of tab view items that are not the current tab view item are not accessible. The way a tab view works is by adding and removing the tab view item's view in and out of the view hierarchy. Since AppleScript needs to be able to walk that view hierarchy to get access to the UI elements in the sub views. Thus, the properties of each info panel is updated before the tab view item is switched out. *)
-
-(* The structure of this script is as follows:
- Properties Properties needed for the application.
- Script Objects Model/Controller objects that are specific to each info panel.
- Event Handlers Handlers that are called by actions in the UI.
- Handlers Handlers that interact with the script objects and as well as the UI.
-*)
-
-
-(* ==== Properties === *)
-
-property infoPanels : {}
-property currentInfoPanelIndex : 1
-property statusImages : {}
-
-
-(* ==== Script Objects ==== *)
-
--- This is the parent script object that represents an info panel. It has default implementations of all of the handlers that is used throughout this application.
---
-script InfoPanel
- -- This handler is called when the contents of the UI elements need to be prepared
- on prepareValues(theWindow)
- -- Scripts that inherit from this script need to implement this handler
- end prepareValues
-
- -- This handler is called when the properties need to be updated from the contents of the UI elements
- on updateValues(theWindow)
- -- Scripts that inherit from this script need to implement this handler
- end updateValues
-
- -- This handler is called to allow an info panel to validate it's values, returning false if the data isn't valid (or is missing)
- on validateValues(theWindow)
- -- Scripts that inherit from this script need to implement this handler
- return true
- end validateValues
-
- -- This handler is called when a summary of the property values is needed.
- on summarizeValues()
- -- Scripts that inherit from this script need to implement this handler
- end summarizeValues
-
- -- This handler will set the focus on the UI element that has a problem and then presents an alert.
- on postValidationAlert(theMessage, theTextField, theWindow)
- -- Move to the field that is missing it's information
- set first responder of theWindow to theTextField
-
- -- Display the alert
- display alert "Missing Information" as critical message theMessage attached to theWindow
- end postValidationAlert
-end script
-
-
--- This script represents the reporter info panel that contains the personal information about the person reporting the problem.
---
-script ReporterInfoPanel
- property parent : InfoPanel
- property infoPanelName : "reporter"
- property infoPanelInstruction : "Please enter your personal information."
-
- property company : ""
- property name : ""
- property address : ""
- property city : ""
- property zip : ""
- property state : ""
- property email : ""
-
- -- This handler is called when the properties need to be updated from the contents of the UI elements
- --
- on updateValues(theWindow)
- tell view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow
- set my company to contents of text field "company"
- set my name to contents of text field "name"
- set my address to contents of text field "address"
- set my city to contents of text field "city"
- set my state to contents of text field "state"
- set my zip to contents of text field "zip"
- set my email to contents of text field "email"
- end tell
- end updateValues
-
- -- This handler is called to allow an info panel to validate it's values, returning false if the data isn't valid (or is missing)
- --
- on validateValues(theWindow)
- set isValid to true
-
- -- We need to have at least the name and email
- if name is "" then
- postValidationAlert("You must enter a name.", text field "name" of view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow, theWindow)
- set isValid to false
- else if email is "" then
- postValidationAlert("You must enter an e-mail address.", text field "email" of view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow, theWindow)
- set isValid to false
- end if
-
- return isValid
- end validateValues
-
- -- This handler is called when a summary of the property values is needed.
- --
- on summarizeValues()
- set theSummary to company & return
- set theSummary to theSummary & name & return
- set theSummary to theSummary & address & return
- set theSummary to theSummary & city & ", " & state & " " & zip & return
- set theSummary to theSummary & email & return
- return theSummary
- end summarizeValues
-end script
-
-
--- This script represents the problem info panel that contains the information about the problem itself.
---
-script ProblemInfoPanel
- property parent : InfoPanel
- property infoPanelName : "problem"
- property infoPanelInstruction : "Please describe your problem."
-
- property product : ""
- property version : ""
- property severity : ""
- property reproducible : ""
- property description : ""
-
- -- This handler is called when the properties need to be updated from the contents of the UI elements
- --
- on updateValues(theWindow)
- tell view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow
- set my product to contents of text field "product"
- set my version to contents of text field "version"
- set my severity to title of current cell of matrix "severity"
- set my reproducible to title of current menu item of popup button "reproducible"
- set my description to contents of text view "description" of scroll view "scroll"
- end tell
- end updateValues
-
- -- This handler is called to allow an info panel to validate it's values, returning false if the data isn't valid (or is missing)
- --
- on validateValues(theWindow)
- set isValid to true
-
- -- We need to have at the very least the product info, version info and description info
- if product is "" then
- postValidationAlert("You must enter a product name.", text field "product" of view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow, theWindow)
- set isValid to false
- else if version is "" then
- postValidationAlert("You must enter the version of the product.", text field "version" of view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow, theWindow)
- set isValid to false
- else if description is "" then
- postValidationAlert("You must enter a description of the problem.", text field "description" of view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow, theWindow)
- set isValid to false
- end if
-
- return isValid
- end validateValues
-
- -- This handler is called when a summary of the property values is needed.
- --
- on summarizeValues()
- set theSummary to "Product: " & tab & product & " version " & version & return
- set theSummary to theSummary & "Severity: " & tab & severity & return
- set theSummary to theSummary & "Reproducible: " & tab & reproducible & return
- set theSummary to theSummary & "Description: " & return
- set theSummary to theSummary & description & return
- return theSummary
- end summarizeValues
-
-end script
-
-
--- This script represents the comments info panel that contains the comments from the reporter.
---
-script CommentsInfoPanel
- property parent : InfoPanel
- property infoPanelName : "comments"
- property infoPanelInstruction : "Please enter any comments."
-
- property comments : ""
-
- -- This handler is called when the properties need to be updated from the contents of the UI elements
- --
- on updateValues(theWindow)
- tell view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow
- set my comments to contents of text view "comments" of scroll view "scroll"
- end tell
- end updateValues
-
- -- This handler is called when a summary of the property values is needed.
- --
- on summarizeValues()
- set theSummary to "Comments: " & return
- set theSummary to theSummary & comments & return
- return theSummary
- end summarizeValues
-end script
-
-
--- This script represents the review info panel, that allows the reporter a chance to see a summary of all of the information before it will be sent.
---
-script ReviewInfoPanel
- property parent : InfoPanel
- property infoPanelName : "review"
- property infoPanelInstruction : "Please review before sending."
-
- property reviewSummary : ""
-
- -- This handler is called when the contents of the UI elements need to be prepared
- --
- on prepareValues(theWindow)
- set theSummary to summarizeValues()
- tell view of tab view item "review" of tab view "info panels" of box "border" of theWindow
- set contents of text view "review" of scroll view "scroll" to theSummary
- end tell
- end prepareValues
-
- -- This handler is called when the properties need to be updated from the contents of the UI elements
- --
- on updateValues(theWindow)
- tell view of tab view item infoPanelName of tab view "info panels" of box "border" of theWindow
- set my reviewSummary to contents of text view "review" of scroll view "scroll"
- end tell
- end updateValues
-
- -- This handler is called when a summary of the property values is needed.
- --
- on summarizeValues()
- set theSummary to ""
-
- -- Since this is the review info panel, we'll get the summary from all of the other info panels and put them together
- repeat with n from 1 to ((count of infoPanels) - 1)
- set theSummary to theSummary & summarizeValues() of item n of infoPanels & return
- end repeat
-
- return theSummary
- end summarizeValues
-end script
-
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the application is finished launching. It's a good place to to any initialization before showing the main window.
---
-
-on launched theObject
- -- Load the images
- set statusImages to {(load image "DotBlue"), (load image "DotGray")}
-
- -- Setup the info panel list. The order of the panels is established here. You can easily change the order that they are presented by changing their order here in this list. The only other thing you need to keep synchronized is the status text items in the left hand portion of the window.
- set infoPanels to {ReporterInfoPanel, ProblemInfoPanel, CommentsInfoPanel, ReviewInfoPanel}
-
- -- Switch to the first info panel
- switchToFirstInfoPanel(window "main")
-
- set visible of window "main" to true
-end launched
-
-
--- This event handler is called when a button is clicked, in this case the 'go back' or 'continue' buttons.
---
-on clicked theObject
- if name of theObject is "continue" then
- if currentInfoPanelIndex is equal to (count of infoPanels) then
- -- On the last panel, the button has changed to 'Send' so send the gathered information
- sendInformation(window of theObject)
- else
- -- Switch to the next info panel
- switchToNextInfoPanel(window of theObject)
- end if
- else if name of theObject is "back" then
- -- Switch to the previous info panel
- switchToPreviousInfoPanel(window of theObject)
- end if
-end clicked
-
-
--- This event handler is called when the tab view is about to switch tab items. You can control the result by returning 'true' to allow the selection to happen, or 'false' to cancel it. Here we will collect the information from each panel and then validate the information and make our decision based upon the validation as to whether or not we will allow the selection to change.
---
-on should select tab view item theObject tab view item tabViewItem
- set isValid to true
-
- -- We only want to update and validate if the window is visible
- if window of theObject is visible then
- -- Update the current info panel with the contents of the UI
- updateCurrentInfoPanel(window of theObject)
-
- -- Validate the current info panel to see if we should move on
- set isValid to validateCurrentInfoPanel(window of theObject)
- end if
-
- -- Return the validity status (true if it's ok to select the tab, false if it's not)
- return isValid
-end should select tab view item
-
-
--- This event handler is called when the current tab view item has been changed.
---
-on selected tab view item theObject tab view item tabViewItem
- -- We will give the new info panel a chance to prepare it's data values
- prepareValues(window of theObject) of infoPanelWithName(name of tabViewItem)
-end selected tab view item
-
-
-(* ==== Handlers ==== *)
-
--- This handler will attempt to switch to the indicated info panel and change the UI to reflect that change.
---
-on switchToInfoPanel(theIndex, theWindow)
- tell theWindow
- set theInfoPanelName to infoPanelName of item theIndex of infoPanels
- set theInfoPanelInstruction to infoPanelInstruction of item theIndex of infoPanels
-
- -- Attempt to switch to the indicated tab view item
- tell tab view "info panels" of box "border"
- set current tab view item to tab view item theInfoPanelName
-
- -- The tab may not change due to validation checking, so make sure we have changed
- if name of current tab view item is not equal to theInfoPanelName then
- return
- end if
- end tell
-
- -- Update the current index
- set currentInfoPanelIndex to theIndex
-
- -- Update the instructions
- tell box "instructions"
- set contents of text field "instructions" to theInfoPanelInstruction
- end tell
-
- -- Update the 'back' button.
- if theIndex is 1 then
- -- Hide it on the first panel.
- set visible of button "back" to false
- else
- -- Show it on all others
- set visible of button "back" to true
- end if
-
- -- Update the 'continue' button.
- if theIndex is (count of infoPanels) then
- -- Set the title to 'Send' if we are on the last panel.
- set title of button "continue" to "Send"
- else
- -- Otherwise set it to 'Continue'
- set title of button "continue" to "Continue"
- end if
-
- -- Update the status images
- repeat with index from 1 to count of infoPanels
- -- Get the name of the info panel
- set infoPanelName to infoPanelName of item index of infoPanels
-
- -- We will be setting the status image to blue for any info panels up to the current index, otherwise we'll set it to gray
- if index ² currentInfoPanelIndex then
- set image of image view infoPanelName to item 1 of statusImages
- else
- set image of image view infoPanelName to item 2 of statusImages
- end if
- end repeat
- end tell
-end switchToInfoPanel
-
-
--- Switches to the the first info panel (called upon startup of the application)
---
-on switchToFirstInfoPanel(theWindow)
- -- Switch to the first item in the info panels list
- switchToInfoPanel(1, theWindow)
-end switchToFirstInfoPanel
-
-
--- Switches to the the next info panel if available
---
-on switchToNextInfoPanel(theWindow)
- -- Make sure that we aren't already on the last panel
- if currentInfoPanelIndex is less than (count of infoPanels) then
- switchToInfoPanel(currentInfoPanelIndex + 1, theWindow)
- end if
-end switchToNextInfoPanel
-
-
--- Switches to the the previous info panel if available
---
-on switchToPreviousInfoPanel(theWindow)
- -- Make sure that we aren't already on the first panel
- if currentInfoPanelIndex is greater than 1 then
- switchToInfoPanel(currentInfoPanelIndex - 1, theWindow)
- end if
-end switchToPreviousInfoPanel
-
-
--- This handler will tell the current info panel to set it's properties values from the UI objects in it's panel
---
-on updateCurrentInfoPanel(theWindow)
- tell item currentInfoPanelIndex of infoPanels to updateValues(theWindow)
-end updateCurrentInfoPanel
-
-
--- This handler will validate the current info panel, to ensure that the required data is present and valid
---
-on validateCurrentInfoPanel(theWindow)
- return validateValues(theWindow) of item currentInfoPanelIndex of infoPanels
-end validateCurrentInfoPanel
-
-
--- This event handler handles sending the gathered information to (wherever)
---
-on sendInformation(theWindow)
- -- Get the summary information from the the Review info panel
- set theInformation to reviewSummary of ReviewInfoPanel
-
- -- Send this information
- -- *** This is left blank as it is implementation dependent and is left as an exercise ***
-end sendInformation
-
-
--- This is a utility handler that is called to return the info panel with the given name
---
-on infoPanelWithName(theName)
- set theInfoPanel to null
-
- repeat with thePanel in infoPanels
- if infoPanelName of thePanel is equal to theName then
- set theInfoPanel to thePanel
- exit repeat
- end if
- end repeat
-
- return theInfoPanel
-end infoPanelWithName
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* This example demonstrates how to script a browser object. The main parts of the script are the "number of browser rows" event handler which needs to return number of rows in the browser for the given column, and the "will display browser cell" event handler that will be called for every item in the browser. *)
-
-(* ==== Properties ==== *)
-
-property diskNames : {}
-
-
-(* ==== Event Handlers ==== *)
-
--- Initialize various items here
---
-on launched theObject
- tell application "Finder"
- set diskNames to name of every disk as list
- end tell
-
- set path separator of browser "browser" of window "main" to ":"
-
- tell browser "browser" of window "main" to update
-end launched
-
--- Return the number of rows for the given column
---
-on number of browser rows theObject in column theColumn
- set rowCount to 0
-
- if (count of diskNames) > 0 then
- if theColumn is 1 then
- set rowCount to count of diskNames
- else
- tell browser "browser" of window "main"
- set thePath to path for column theColumn - 1
- end tell
-
- tell application "Finder"
- set rowCount to count of items of item thePath
- end tell
- end if
- end if
-
- return rowCount
-end number of browser rows
-
--- This is called whenever a cell in the browser needs to be displayed.
---
-on will display browser cell theObject row theRow browser cell theCell in column theColumn
- if theColumn > 1 then
- tell browser "browser" of window "main"
- set thePath to path for column theColumn
- end tell
- end if
-
- tell application "Finder"
- if theColumn is 1 then
- set cellContents to displayed name of disk (item theRow of diskNames as string)
- set isLeaf to false
- else
- set theItem to item theRow of item thePath
-
- if class of theItem is folder or class of theItem is disk then
- set isLeaf to false
- else
- set isLeaf to true
- end if
-
- set cellContents to (displayed name of theItem as string)
- end if
- end tell
-
- set string value of theCell to cellContents
- set leaf of theCell to isLeaf
-
-end will display browser cell
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Tool Helper.applescript *)
-
-(* This example will help to find shell commands and then provide a window containing the man page for that command. You choose how to search by choosing from several choices in a popup button: "begins with", "contains", "ends with" and "is". The strategy employed is to get a list of all of the command names at starup and then search through that list when requested, displaying the results of the ones found. *)
-
-
-(* ==== Properties ==== *)
-
-property commandsDataSource : missing value
-property commandNames : {}
-property manPageWindow : missing value
-
-
-(* ==== Event Handlers ==== *)
-
--- The "will finish launching" event handler is the first event handler called in the startup sequence and is a good place to do any type of initialization work that doesn't require any UI. For this example we will get a list of all of the command names.
---
-on will finish launching theObject
- -- The quickest method of getting a list of all of the command names appears to be to get the information using "ls" in a "do shell script". We want to get a list of all of the commands from the following locations: /bin, /usr/bin, /usr/sbin. We can do this by concating the commands together with the ";" character and then piping ("|") the results through the "sort" shell command passing it the "-u" option which eliminates any duplicates. We then take the result from the do shell command (which will be a string with return characters between each item) and convert it to a list of strings.
- set commandNames to every paragraph of (do shell script "ls /usr/bin ; ls /usr/sbin ; ls /bin | sort -u")
-end will finish launching
-
-
--- The "awake from nib" event handler is called when the object is loaded from a nib file. It's a good place to initialize one or more items.
---
-on awake from nib theObject
- if name of theObject is "main" then
- -- When the window is loaded, be sure to hide the status items
- hideStatus(theObject)
- else if name of theObject is "man page" then
- -- If the man page window is being loaded then set a reference to it
- set manPageWindow to theObject
- else if name of theObject is "commands" then
- -- Create the data source
- set commandsDataSource to make new data source at end of data sources with properties {name:"commands"}
-
- -- Create the data columns
- make new data column at end of data columns of commandsDataSource with properties {name:"command"}
- make new data column at end of data columns of commandsDataSource with properties {name:"description"}
-
- -- Assign the data source to the table view
- set data source of theObject to commandsDataSource
- end if
-end awake from nib
-
-
--- The "launched" is one of the last event handlers that is called in the startup sequence. In this case we want to show our main window.
---
-on launched theObject
- show window "main"
-end launched
-
-
--- The "clicked" event handler is called (in this example) when the "Find" button is clicked. We then initiate our find process.
---
-on clicked theObject
- if name of theObject is "find" then
- findCommands(window of theObject)
- end if
-end clicked
-
-
-on double clicked theObject
- if name of theObject is "commands" then
- -- Show and update the message items in the main window
- showStatus(window of theObject)
- updateStatusMessage(window of theObject, "Getting the man page...")
-
- -- Get the clicked row of the table view
- set theRow to clicked row of theObject
- set theDataRow to data row theRow of data source of theObject
-
- -- Get the name of the command
- set theCommandName to contents of data cell "command" of theDataRow
-
- -- See if the window is already open
- set theWindow to findWindowWithTitle(theCommandName)
- if theWindow is not missing value then
- -- Just bring it to the front
- show theWindow
- else
- -- Load a new instance of the man page window and show it
- load nib "ManPage"
- set title of manPageWindow to theCommandName
-
- -- Get the man page for the command, cleaning it up in the process
- set theResult to do shell script "man " & theCommandName & " | perl -pe 's/.\\x08//g'"
-
- -- Put the results into the text view of our man page window
- set contents of text view "man page" of scroll view "man page" of manPageWindow to theResult
-
- -- Show the window
- show manPageWindow
- end if
-
- -- Hide the status items
- hideStatus(window of theObject)
- end if
-end double clicked
-
-
--- The "action" event handler is called (in this example) when a menu item is chosen from the popup button. We then initiate our find process.
---
-on action theObject
- if name of theObject is "how" then
- findCommands(window of theObject)
- end if
-end action
-
-
-(* ==== Handlers ==== *)
-
--- This handler is called to find any commands that meet the criteria specified in the UI (how and what). It also is responsible for providing any feedback during the find, such as showing, updating and hiding the status items in the window.
---
-on findCommands(theWindow)
- -- Show the the status items
- showStatus(theWindow)
- updateStatusMessage(theWindow, "Finding commands...")
-
- -- Find the commands with what coming from the text field, and how coming from the popup button
- set theCommands to commandsWithName(contents of text field "name" of theWindow, title of popup button "how" of theWindow)
-
- -- Turn off the updating of the table view while we load the data source
- set update views of commandsDataSource to false
-
- -- Delete any existing items in the data source
- delete every data row of commandsDataSource
-
- -- Make sure that we actually found at least one command
- if (count of theCommands) > 0 then
- -- Update the status message
- updateStatusMessage(theWindow, "Adding commands...")
-
- -- Add the list of commands to the data source using the "append" command
- append commandsDataSource with theCommands
- end if
-
- -- Turn back on the updating of the table view
- set update views of commandsDataSource to true
-
- -- Hide the status items
- hideStatus(theWindow)
-end findCommands
-
-
--- This handler is used to look through our list of command names, returning a list of found commands, which also includes getting and returning the description of the command
---
-on commandsWithName(whatToFind, howToFind)
- -- Set our result to a known good value, in this case an empty list will do just fine
- set theCommands to {}
-
- -- Make sure that we have a value to find for
- if (count of whatToFind) > 0 then
- -- Set our found names list to an empty list
- set foundCommandNames to {}
-
- -- Based on the "howToFind" repeat through each of the command names in our commandNames list finding the appropriate items and adding it to the foundCommandNames list
- if howToFind is "begins with" then
- repeat with i in commandNames
- if i begins with whatToFind then
- copy i to end of foundCommandNames
- end if
- end repeat
- else if howToFind is "contains" then
- repeat with i in commandNames
- if i contains whatToFind then
- copy i to end of foundCommandNames
- end if
- end repeat
- else if howToFind is "ends with" then
- repeat with i in commandNames
- if i ends with whatToFind then
- copy i to end of foundCommandNames
- end if
- end repeat
- else if howToFind is "is" then
- repeat with i in commandNames
- if (i as string) is equal to whatToFind then
- copy i to end of foundCommandNames
- end if
- end repeat
- end if
-
- -- Make sure that we found at least one command name
- if (count of foundCommandNames) > 0 then
- -- Iterate through each of the found names
- repeat with i in foundCommandNames
- try
- set theDescription to ""
-
- -- We will use the "whatis" shell command to get the description of
- set theResult to do shell script ("whatis " & (i as string))
-
- -- Unfortunately, the result will look something like "more(1), page(1) - file perusal filter for crt viewing". We only want to get portion of the text following the " - " characters. This can be done using the following bit of script.
- set dashoffset to offset of " - " in theResult
- set firstReturn to offset of return in theResult
- set theDescription to characters (dashoffset + 2) through (firstReturn - 1) of theResult as string
-
- -- Add the command name and description as a list the end of our command list
- copy {i, theDescription} to end of theCommands
- end try
- end repeat
- end if
- end if
-
- -- Return our result
- return theCommands
-end commandsWithName
-
-
-(* ==== Status Handlers ==== *)
-
--- This handler will show the various status items in the window, along with starting the animation of the progress indicator
---
-on showStatus(theWindow)
- tell theWindow
- set visible of progress indicator "progress" to true
- set visible of text field "status" to true
- set uses threaded animation of progress indicator "progress" to true
- start progress indicator "progress"
- end tell
-end showStatus
-
-
--- This handler will hide all of the status items in the window, including stopping the animation of the progress indicator
---
-on hideStatus(theWindow)
- tell theWindow
- set visible of progress indicator "progress" to false
- set visible of text field "status" to false
- stop progress indicator "progress"
- end tell
-end hideStatus
-
-
--- This handler will update the status message in the status items of the window
---
-on updateStatusMessage(theWindow, theMessage)
- set contents of text field "status" of theWindow to theMessage
-end updateStatusMessage
-
-
-(* ==== Utility Handlers ==== *)
-
--- This is a utility handler that will simply find the window with the specified title.
---
-on findWindowWithTitle(theTitle)
- set theWindow to missing value
-
- set theWindows to every window whose title is theTitle
- if (count of theWindows) > 0 then
- set theWindow to item 1 of theWindows
- end if
-
- return theWindow
-end findWindowWithTitle
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Coordinate System.applescript *)
-
-(* This is an example of how to use the new coordinate system support. *)
-
-(* ===== Event Handlers ===== *)
-
-on launched theObject
- show window "main"
-end launched
-
--- This event handler is attached to the window and will be called when it is loaded. It is a good time to update the display in the window to show the current coordinates.
---
-on awake from nib theObject
- updateDisplay(theObject)
-end awake from nib
-
--- This event handler is called when the button in our document window is clicked. It will test the various settings of the coordinate system by moving the window and then by moving the button.
---
-on clicked theObject
- set theWindow to window of theObject
- set testObject to theWindow
-
- -- Test the Cocoa coordinate system on a window. This system uses {x, y, width, height}, with the origin of a window or view in the lower left corner being 0, 0
- set coordinate system to Cocoa coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {50, 50, 500, 500}
- delay 1
- set position of testObject to {150, 150}
- updateDisplay(theWindow)
- delay 1
-
- -- Test the old (classic) coordinate system on a window. This system uses {left, bottom, right, top}, with the origin of a window or view in the bottom left corner being 0, 0
- set coordinate system to classic coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {50, 50, 500, 500}
- delay 1
- set position of testObject to {150, 150}
- updateDisplay(theWindow)
- delay 1
-
- -- Test the AppleScript coordinate system on a window. This system uses {left, top, right, bottom}, with the origin of a window or view in the top left corner being 0, 0
- set coordinate system to AppleScript coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {50, 50, 500, 500}
- delay 1
- set position of testObject to {150, 150}
- updateDisplay(theWindow)
- delay 1
-
- set testObject to theObject
-
- -- Test the Cocoa coordinate system on our button. This system uses {x, y, width, height}, with the origin of a window or view in the lower left corner being 0, 0
- set coordinate system to Cocoa coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {0, 0, 82, 30}
- delay 1
- set position of testObject to {10, 10}
- updateDisplay(theWindow)
- delay 1
-
- -- Test the old (classic) coordinate system on our button. This system uses {left, bottom, right, top}, with the origin of a window or view in the bottom left corner being 0, 0
- set coordinate system to classic coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {0, 0, 82, 30}
- delay 1
- set position of testObject to {10, 10}
- updateDisplay(theWindow)
- delay 1
-
- -- Test the AppleScript coordinate system on our button. This system uses {left, top, right, bottom}, with the origin of a window or view in the top left corner being 0, 0
- set coordinate system to AppleScript coordinate system
- set testBounds to bounds of testObject
- set testPosition to position of testObject
- set bounds of testObject to {0, 0, 82, 30}
- delay 1
- set position of testObject to {10, 10}
- updateDisplay(theWindow)
-end clicked
-
--- This event handler is called when the coordinate system popup button is changed. It will change the coordinate system and update the display.
---
-on action theObject
- set popupChoice to content of theObject
-
- if popupChoice is 0 then
- set coordinate system to Cocoa coordinate system
- else if popupChoice is 1 then
- set coordinate system to classic coordinate system
- else if popupChoice is 2 then
- set coordinate system to AppleScript coordinate system
- end if
-
- updateDisplay(window of theObject)
-end action
-
--- This event handler is called when the window moves. It will update the display to show the current coordinates.
---
-on moved theObject
- updateDisplay(theObject)
-end moved
-
--- This event handler is called when the window resizes. It will update the display to show the current coordinates.
---
-on resized theObject
- updateDisplay(theObject)
-end resized
-
-(* ===== Handlers ===== *)
-
--- This handler is used to get the coordinates of the window and button and display a description in the window.
---
-on updateDisplay(theWindow)
- set theButton to button "button" of theWindow
-
- set windowBounds to bounds of theWindow
- set windowPosition to position of theWindow
- set buttonBounds to bounds of theButton
- set buttonPosition to position of theButton
-
- if coordinate system is Cocoa coordinate system then
- set coordinateSystemDescription to 0
- set windowBoundsDescription to "{x: " & item 1 of windowBounds & ", y: " & item 2 of windowBounds & ", w: " & item 3 of windowBounds & ", h: " & item 4 of windowBounds & "}"
- set windowPositionDescription to "{x: " & item 1 of windowPosition & ", y: " & item 2 of windowPosition & "}"
- set buttonBoundsDescription to "{x: " & item 1 of buttonBounds & ", y: " & item 2 of buttonBounds & ", w: " & item 3 of buttonBounds & ", h: " & item 4 of buttonBounds & "}"
- set buttonPositionDescription to "{x: " & item 1 of buttonPosition & ", y: " & item 2 of buttonPosition & "}"
- else if coordinate system is classic coordinate system then
- set coordinateSystemDescription to 1
- set windowBoundsDescription to "{l: " & item 1 of windowBounds & ", b: " & item 2 of windowBounds & ", r: " & item 3 of windowBounds & ", t: " & item 4 of windowBounds & "}"
- set windowPositionDescription to "{l: " & item 1 of windowPosition & ", b: " & item 2 of windowPosition & "}"
- set buttonBoundsDescription to "{l: " & item 1 of buttonBounds & ", b: " & item 2 of buttonBounds & ", r: " & item 3 of buttonBounds & ", t: " & item 4 of buttonBounds & "}"
- set buttonPositionDescription to "{l: " & item 1 of buttonPosition & ", b: " & item 2 of buttonPosition & "}"
- else if coordinate system is AppleScript coordinate system then
- set coordinateSystemDescription to 2
- set windowBoundsDescription to "{l: " & item 1 of windowBounds & ", t: " & item 2 of windowBounds & ", r: " & item 3 of windowBounds & ", b: " & item 4 of windowBounds & "}"
- set windowPositionDescription to "{l: " & item 1 of windowPosition & ", t: " & item 2 of windowPosition & "}"
- set buttonBoundsDescription to "{l: " & item 1 of buttonBounds & ", t: " & item 2 of buttonBounds & ", r: " & item 3 of buttonBounds & ", b: " & item 4 of buttonBounds & "}"
- set buttonPositionDescription to "{l: " & item 1 of buttonPosition & ", t: " & item 2 of buttonPosition & "}"
- end if
-
- tell theWindow
- set content of popup button "coordinate system" to coordinateSystemDescription
- set content of text field "window bounds" to windowBoundsDescription
- set content of text field "window position" to windowPositionDescription
- set content of text field "button bounds" to buttonBoundsDescription
- set content of text field "button position" to buttonPositionDescription
- end tell
-end updateDisplay
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Coundown Timer.applescript *)
-
-(* This is a simple example the demonstrates how to idle event to do a countdown timer. When the application is launched it will display the countdown window with a sheet asking for the amount of time for the countdown, after which the countdown begins and when the specified time has elapsed, it displays an alert. *)
-
-(* ===== Properties ===== *)
-
-property countdown : false
-property currentDate : 0
-property startDate : 0
-property endDate : 0
-
-
-(* ===== Event Handlers ===== *)
-
-on launched theObject
- -- Show the window
- set visible of window "main" to true
-
- -- Display an alert (as a sheet) asking for the amount of time in the HH:MM:SS format
- display dialog "Enter the amount of time for the countdown timer:" default answer "00:00:05" attached to window "main"
-end launched
-
-on dialog ended theObject with reply withReply
- -- See if the "OK" button has been clicked
- if button returned of withReply is "OK" then
- -- Save the current date for display purposes
- set currentDate to date (text returned of withReply)
-
- -- Save the start date
- set startDate to current date
-
- -- And determine the end date (start date + the countdown timer)
- set endDate to startDate + (time of currentDate)
-
- -- Update the contents of the text field
- set contents of text field "display" of window "main" to currentDate
-
- -- And let the processing in the idle event handler begin
- set countdown to true
- end if
-end dialog ended
-
-on idle theObject
- -- See if we are ready to start counting down
- if countdown then
- -- If the required amount of time has elapsed then display our dialog
- if (current date) is greater than endDate then
- set countdown to false
- display alert "Time's Up!"
- else
- -- Otherwise determine how much time has elapsed (for display purposes)
- set elapsedTime to (current date) - startDate
-
- -- Update the display
- set contents of text field "display" of window "main" to currentDate - elapsedTime
- end if
- end if
-
- -- We want to update the idle event every second, so we return 1
- return 1
-end idle
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* This is a very simple example that illustrates getting and setting the contents of text fields. It is a simple currency converter based on a '(rate * amount) = value' formula. It also uses 'formatters' for the text fields to align and set the number formatting (this is done in Interface Builder by dragging a formatter onto the text field). *)
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- tell window of theObject
- try
- set theRate to contents of text field "rate"
- set theAmount to contents of text field "amount" as number
-
- set contents of text field "total" to theRate * theAmount
- on error
- set contents of text field "total" to 0
- end try
- end tell
-end clicked
-
-on should quit after last window closed theObject
- return true
-end should quit after last window closed
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Currency Converter.applescript *)
-
-(* This is an enhanced version of Currency Converter that utilizes SOAP services to enable getting the current exchange rate. *)
-
-
-(* ==== Event Handlers ==== *)
-
--- The "action" event handler is called when the user choosing a country from the popup button. We will call the "getRate" event handler to use a SOAP service to get the rate.
---
-on action theObject
- set contents of text field "rate" of window of theObject to getRate(title of theObject as string)
-end action
-
-
--- The "clicked" event handler is called when the user clicks on the "Convert" button. This will do a simple calculatin of "rate * dollars" and put the result in the "total" field.
---
-on clicked theObject
- tell window of theObject
- set theRate to contents of text field "rate" as real
- set theDollars to contents of text field "dollars" as real
- set contents of text field "total" to theRate * theDollars
- end tell
-end clicked
-
-
--- The "awake from nib" event handler is called the popup button is loaded form the nib. In this example we will use this opportunity to get the rate (based on the default selection of the popup button).
---
-on awake from nib theObject
- set contents of text field "rate" of window of theObject to getRate(title of theObject)
-end awake from nib
-
-
-(* ==== Handlers ==== *)
-
--- This handler is called to get the current exchange rate for the given country. It does this by using the "call soap" command to communicate with a SOAP web service.
---
-on getRate(forCountry)
- -- Initialize the result to a known value
- set theRate to 1.0
-
- -- We always convert from the US
- set fromCountry to "USA"
-
- -- Talk to the soap service
- tell application "http://services.xmethods.net:80/soap"
- -- Call the "getRate" method of the soap service returning the current rate
- set theRate to call soap {method name:"getRate", method namespace uri:"urn:xmethods-CurrencyExchange", parameters:{country1:fromCountry, country2:forCountry}, SOAPAction:""}
- end tell
-
- -- Return the result
- return theRate
-end getRate
-
--- This is a utility handler to get the given unicode text as plain text (not styled text)
---
-on getPlainText(fromUnicodeString)
- set styledText to fromUnicodeString as string
- set styledRecord to styledText as record
- return Çclass ktxtÈ of styledRecord
-end getPlainText
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Daily Dilbert.applescript *)
-
-(* This is a simple example of how to load an image given a URL from a web service. It utilizes a couple of shell commands (date, curl) to accomplish this. *)
-
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is called when the object is loaded from its nib file. In this case it will be the image view. The script will get the image from the web service and then set that image into the image view. Then the window will be resized appropriately.
---
-on awake from nib theObject
- -- We need to have the date in the format "mm/dd/yy" which is actually easier to get from the "date" shell command.
- set theDate to do shell script "date +%m/%d/%y"
-
- -- Get the Dilbert image based on the date
- set theImage to getDilbertImageForDate(theDate)
- set image of theObject to theImage
-
- -- Resize the window
- set the size of (window of theObject) to call method "size" of object theImage
-
- -- Show the window
- show window of theObject
-end awake from nib
-
-
-(* ==== Handlers ==== *)
-
--- This handler will return the image for the given date. It does this by getting the URL for the image from a web service.
---
-on getDilbertImageForDate(theDate)
- set theImage to missing value
- set theImage to loadImageAtURL(DailyDilbertImagePath(theDate))
- return theImage
-end getDilbertImageForDate
-
-
--- With the given URL, this handler will download the image using the "curl" shell tool. It then will load the image using the "load image" command.
---
-on loadImageAtURL(theURL)
- set theImage to missing value
-
- -- Get the last component of the URL. Here we'll use the "lastPathComponent" method of NSString.
- set theImagePath to "/tmp/" & (call method "lastPathComponent" of object theURL)
-
- -- Download the image using "curl"
- do shell script ("curl -o " & theImagePath & " " & theURL)
-
- -- Load the image
- set theImage to load image theImagePath
-
- return theImage
-end loadImageAtURL
-
-
-(* ==== Web Services Handlers ==== *)
-
--- This handler will return the URL that points to the Dilbert image for the given date.
---
-on DailyDilbertImagePath(forDate)
- tell application "http://www.esynaps.com/WebServices/DailyDiblert.asmx"
- set mname to "DailyDilbertImagePath"
- set soapact to "http://tempuri.org/DailyDilbertImagePath"
- set namespace to "http://tempuri.org/"
- set params to {}
- set params to params & {|parameters|:forDate}
- return call soap {method name:mname, parameters:params, SOAPAction:soapact, method namespace uri:namespace}
- end tell
-end DailyDilbertImagePath
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Debug Test.applescript *)
-
-(* The purpose of this example is to illustrate the debugging of AppleScript. Many of the properties and values are there mainly to test the debugger in it's ability to show and set the various values. It also illustrates the ability to interact with the UI while in the processing of executing a script. *)
-
-(* ==== Properties ==== *)
-
-property keepRunning : true
-property prop1 : "Test property 1"
-property prop2 : "Test property 2"
-property prop3 : 0
-
-
-(* ==== Event Handlers ==== *)
-
--- Here we handle the click on the "Start/Stop" button, toggling between states as necessary.
---
-on clicked theObject
- if title of theObject is "Start" then
- set keepRunning to true
- set title of theObject to "Stop"
- set theResult to 2
- runforever()
- else if title of theObject is "Stop" then
- set title of theObject to "Start"
- set keepRunning to false
- end if
-end clicked
-
--- This handler is called after the window is loaded, but before it is displayed.
---
-on will open theObject
- set prop3 to 10
-end will open
-
--- This event handler is called just before the window is closed. If you want to stop the window from being closed, you can use the "should close" event handler and return false.
---
-on will close theObject
- set keepRunning to false
-end will close
-
-
-(* ==== Handlers ==== *)
-
--- This is a handler that is called to do a repeat loop until the keepRunning variable gets changed to false. It also animates the barber pole and set the value of the text field.
---
-on runforever()
- set numberTest to 1
- set stringTest to "testing"
-
- runonce()
-
- repeat while keepRunning
- tell progress indicator "Barber Pole" of window "Main" to animate
- set prop3 to prop3 + 1
- set numberTest to numberTest + 1
-
- set contents of text field "counter" of window "Main" to numberTest as string
- end repeat
-end runforever
-
-on runonce()
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
-
- runonceagain()
-end runonce
-
-on runonceagain()
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
- set prop3 to prop3 + 1
-
- runlasttime()
-end runonceagain
-
-on runlasttime()
- set prop3 to prop3 + 1
-end runlasttime
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Display Alert.applescript *)
-
-(* This example demonstrates the "display alert" command. It can be used in place of "display dialog" when you need to alert the user to some condition. The icon is determined by the "as" type. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Display Alert" button is clicked, which when clicked the various parameter values pulled from the text fields to be sent to "display alert".
---
-on clicked theObject
- -- Get the various parameter values
- tell window "main"
- set dialogText to contents of text field "text"
- set dialogMessage to contents of text field "message"
- set defaultButtonTitle to contents of text field "default button"
- set alternateButtonTitle to contents of text field "alternate button"
- set otherButtonTitle to contents of text field "other button"
- end tell
-
- -- Set the "as" type to be either warning, informational or critical based on the setting in the radio group.
- set dialogType to warning
- if current row of matrix "type" of window "main" is 2 then
- set dialogType to informational
- else if current row of matrix "type" of window "main" is 3 then
- set dialogType to critical
- end if
-
- -- If the "as sheet" button is checked then use the "attached to" optional parameter, in which the "alert ended" event handler will be called when the sheet is dismissed.
- if state of button "as sheet" of window "main" is 1 then
- display alert dialogText as dialogType message dialogMessage default button defaultButtonTitle alternate button alternateButtonTitle other button otherButtonTitle attached to window "main"
- else
- -- Otherwise handle it much like "display dialog"
- set theReply to display alert dialogText as dialogType message dialogMessage default button defaultButtonTitle alternate button alternateButtonTitle other button otherButtonTitle
- set contents of text field "button returned" of window "main" to button returned of theReply
- end if
-end clicked
-
--- This event handler is called if the "attached to" parameter is used. It is called when the dialog has been dismissed. It simply sets the text field to be the button that was pressed to dismiss the dialog.
---
-on alert ended theObject with reply theReply
- set contents of text field "button returned" of window "main" to button returned of theReply
-end alert ended
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Display Dialog.applescript *)
-
-(* This example will demonstrate the various ways of using the "display dialog" command. The dialog can be displayed as a dialog, or attached to a window as sheet. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Display Dialog" button is clicked. It gets the various settings from the UI elements and passes them to "display dialog" as parameters.
---
-on clicked theObject
- -- Initialize all the parameter values that will be passed to display dialog
- tell window "main"
- set dialogText to contents of text field "text"
- set dialogDefaultAnswer to contents of text field "default answer"
- set dialogButton1 to contents of text field "button 1"
-
- set dialogButton2 to contents of text field "button 2"
- set dialogButton3 to contents of text field "button 3"
- set dialogDefaultButton to contents of text field "default button"
- set dialogIcon to contents of text field "icon"
- set dialogGivingUpAfter to contents of text field "giving up" as number
- end tell
-
- -- If we want to have the display dialog presented as a sheet, then we need add the optional parameter "attached to" passing it a window object
- if state of button "as sheet" of window "main" is equal to 1 then
- if dialogDefaultAnswer is "" then
- display dialog dialogText buttons {dialogButton1, dialogButton2, dialogButton3} default button dialogDefaultButton giving up after dialogGivingUpAfter with icon dialogIcon attached to window "main"
- else
- display dialog dialogText default answer dialogDefaultAnswer buttons {dialogButton1, dialogButton2, dialogButton3} default button dialogDefaultButton giving up after dialogGivingUpAfter with icon dialogIcon attached to window "main"
- end if
- else
- -- Otherwise we do it the standard way
- try
- if dialogDefaultAnswer is "" then
- set theReply to display dialog dialogText buttons {dialogButton1, dialogButton2, dialogButton3} default button dialogDefaultButton giving up after dialogGivingUpAfter with icon dialogIcon
- else
- set theReply to display dialog dialogText default answer dialogDefaultAnswer buttons {dialogButton1, dialogButton2, dialogButton3} default button dialogDefaultButton giving up after dialogGivingUpAfter with icon dialogIcon
- end if
-
- -- Set the values returned from the dialog reply
- set contents of text field "text returned" of window "main" to text returned of theReply
- set contents of text field "button returned" of window "main" to button returned of theReply
- set state of button "gave up" of window "main" to gave up of theReply
- on error
- -- The user pressed the "Cancel" button, so display that as the result. We can't use the "theReply" value because it wasn't returned from the "display dialog" call, because of the cancel.
- set contents of text field "button returned" of window "main" to "Cancel"
- end try
- end if
-end clicked
-
--- This handler gets called when the display dialog dialog if finished if it was called with the "attached to" optional parameter.
-on dialog ended theObject with reply theReply
- -- Set the values returned in "theReply"
- set contents of text field "text returned" of window "main" to text returned of theReply
- set contents of text field "button returned" of window "main" to button returned of theReply
- set state of button "gave up" of window "main" to gave up of theReply
-end dialog ended
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Settings.applescript *)
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- if name of theObject is "cancel" then
- close panel (window of theObject)
- else if name of theObject is "change" then
- close panel (window of theObject) with result 1
- end if
-end clicked
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Window.applescript *)
-
-(* This script demonstrates the "display panel" command which allows you to create your own dialogs and have them displayed either as a dialog or attached to a window as a sheet. *)
-
-(* ==== Properties ==== *)
-
-property panelWIndow : missing value
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- set theName to contents of text field "name" of window "main"
- set theType to contents of text field "type" of window "main"
-
- -- Load the panel. We do this by loading the nib that contains the panel window, and then setting our property to the loaded window. Only do this once, as every time the nib is loaded, it will create new copies of all of the top level objects in the nib.
- if panelWIndow is equal to missing value then
- load nib "SettingsPanel"
- set panelWIndow to window "settings"
- end if
-
- -- Set the state of the items in the panel
- tell panelWIndow
- set contents of text field "name" to theName
- if theType is "Button" then
- set current row of matrix "type" to 1
- else if theType is "Popup Button" then
- set current row of matrix "type" to 2
- else if theType is "Radio" then
- set current row of matrix "type" to 3
- else if theType is "Switch" then
- set current row of matrix "type" to 4
- end if
- end tell
-
- -- Display the panel
- if state of button "as sheet" of window "main" is 1 then
- display panel panelWIndow attached to window "main"
- else
- if (display panel panelWIndow) is 1 then
- local theName
- local theType
-
- tell panelWIndow
- set theName to contents of text field "name"
- set selectedRow to current row of matrix "type"
-
- if selectedRow is 1 then
- set theType to "Button"
- else if selectedRow is 2 then
- set theType to "Popup Button"
- else if selectedRow is 3 then
- set theType to "Radio"
- else if selectedRow is 4 then
- set theType to "Switch"
- end if
- end tell
-
- set contents of text field "name" of window "main" to theName
- set contents of text field "type" of window "main" to theType
- end if
- end if
-
-end clicked
-
-on panel ended thePanel with result theResult
- if theResult is 1 then
- local theName
- local theType
-
- tell thePanel
- set theName to contents of text field "name"
- set selectedRow to current row of matrix "type"
-
- if selectedRow is 1 then
- set theType to "Button"
- else if selectedRow is 2 then
- set theType to "Popup Button"
- else if selectedRow is 3 then
- set theType to "Radio"
- else if selectedRow is 4 then
- set theType to "Switch"
- end if
- end tell
-
- set contents of text field "name" of window "main" to theName
- set contents of text field "type" of window "main" to theType
- end if
-end panel ended
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Button.applescript *)
-
-(* This script is used to register the appropriate drag types for the "button" object and then responds to a drop on it. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is a good place to register the drag types that this object can respond to.
---
-on awake from nib theObject
- -- Enable the dropping of the appropriate types by registering them.
- tell theObject to register drag types {"string", "rich text", "file names"}
-end awake from nib
-
--- The "drop" event handler is called when the appropriate type of data is dropped onto the object. All of the pertinent information about the drop is contained in the "dragInfo" object.
---
-on drop theObject drag info dragInfo
- -- Make sure that we have the "string" data type
- if "string" is in types of pasteboard of dragInfo then
- -- Set the title of the button to the contents of the pasteboard
- set title of theObject to contents of pasteboard of dragInfo
- end if
-
- return true
-end drop
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Drag and Drop.applescript *)
-
-(* This script is the main script of the application, although in this case it does very little. It responds to the "Color Chooser" button by displaying the "color panel". *)
-
-(* ==== Event Handlers ==== *)
-
--- The "clicked" event handler is called when the user clicks on the "Color Chooser" button.
---
-on clicked theObject
- -- We simply want to the show the "color panel" so that the user can drag a color from it.
- show the color panel
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Image View.applescript *)
-
-(* This script is used to register the appropriate drag types for the "image view" object and then responds to a drop on it. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is a good place to register the drag types that this object can respond to.
---
-on awake from nib theObject
- -- Enable the dropping of the appropriate types by registering them.
- tell theObject to register drag types {"image", "pict image", "file names", "color"}
-end awake from nib
-
--- The "drop" event handler is called when the appropriate type of data is dropped onto the object. All of the pertinent information about the drop is contained in the "dragInfo" object.
---
-on drop theObject drag info dragInfo
- -- Get a list of the data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
-
- -- Currently, we are only interested if there are "files names" on the pasteboard
- if "file names" is in dataTypes then
- -- This is a mechanism to tell the pasteboard which type of data we want when we access the "contents" of the pasteboard.
- set preferred type of pasteboard of dragInfo to "file names"
-
- -- Get the list of files dropped on the object form the pasteboard
- set thePaths to contents of pasteboard of dragInfo
-
- -- Load the image at the location of the first item
- set theImage to load image (item 1 of thePaths)
-
- -- Set the image into the image view
- set image of theObject to theImage
-
- -- Make sure to delete the image we loaded otherwise it will never be removed from memory.
- delete theImage
-
- -- Set the preferred type back to the default
- set preferred type of pasteboard of dragInfo to ""
- end if
-
- return true
-end drop
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Table.applescript *)
-
-(* This script is used to register the appropriate drag types for the "table view" object and then responds to a drop on it. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is a good place to register the drag types that this object can respond to.
---
-on awake from nib theObject
- -- Create the data source for the table view
- set theDataSource to make new data source at end of data sources with properties {name:"files"}
-
- -- Create the "files" data column
- make new data column at end of data columns of theDataSource with properties {name:"files"}
-
- -- Assign the data source to the table view
- set data source of theObject to theDataSource
-
- -- Register for the "color" and "file names" drag types
- tell theObject to register drag types {"file names", "color"}
-end awake from nib
-
--- The "drop" event handler is called when the appropriate type of data is dropped onto the object. All of the pertinent information about the drop is contained in the "dragInfo" object.
---
-on drop theObject drag info dragInfo
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
-
- -- We are only interested in either "file names" or "color" data types
- if "file names" is in dataTypes then
- -- Initialize the list of files to an empty list
- set theFiles to {}
-
- -- We want the data as a list of file names, so set the preferred type to "file names"
- set preferred type of pasteboard of dragInfo to "file names"
-
- -- Get the list of files from the pasteboard
- set theFiles to contents of pasteboard of dragInfo
-
- -- Make sure we have at least one item
- if (count of theFiles) > 0 then
- --- Get the data source from the table view
- set theDataSource to data source of theObject
-
- -- Turn off the updating of the views
- set update views of theDataSource to false
-
- -- Delete all of the data rows in the data source
- delete every data row of theDataSource
-
- -- For every item in the list, make a new data row and set it's contents
- repeat with theItem in theFiles
- set theDataRow to make new data row at end of data rows of theDataSource
- set contents of data cell "files" of theDataRow to theItem
- end repeat
-
- -- Turn back on the updating of the views
- set update views of theDataSource to true
- end if
- else if "color" is in dataTypes then
- -- We want the data as a color, so set the preferred type
- set preferred type of pasteboard of dragInfo to "color"
-
- -- Set the background color of the table view to the color on the pasteboard
- set background color of theObject to contents of pasteboard of dragInfo
-
- -- We need to update the table view (redraw it).
- update theObject
- end if
-
- -- Set the preferred type back to the default
- set preferred type of pasteboard of dragInfo to ""
-
- return true
-end drop
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is a good place to register the drag types that this object can respond to.
---
-on awake from nib theObject
- -- We will register for the following types (altough this example only responds to the "string" type).
- tell theObject to register drag types {"string", "rich text", "file names"}
-end awake from nib
-
-on conclude drop theObject drag info dragInfo
- (* We need to have this handler do nothing to keep the text field from doing it's own drop. This is true for text view's as well. If you want to let the text field or text view do the actual drop you can remove the "conclude drop" event handler and then not do anything in the "drop" event handler. *)
-end conclude drop
-
--- The "drop" event handler is called when the appropriate type of data is dropped onto the object. All of the pertinent information about the drop is contained in the "dragInfo" object.
---
-on drop theObject drag info dragInfo
- -- We are only interested in the "string" data type
- if "string" is in types of pasteboard of dragInfo then
- -- Set the contents of the text field to the contents of the pasteboard
- set string value of theObject to contents of pasteboard of dragInfo
- end if
-
- return true
-end drop
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* ==== Properties ==== *)
-
-property endRace : false
-property finishLine : 627
-property betAmount : 5
-property holdingsAmount : 1000
-
-global carOneOrgbounds, carTwoOrgbounds, carThreeOrgbounds, carFourOrgbounds, carFiveOrgbounds, pickedCar, winner, raceSpeedval
-
-
-(* ==== Handlers ==== *)
-
-on resetRace()
- set the title of button "Car 1" of window "Drag Race" to "Car 1"
- set the title of button "Car 2" of window "Drag Race" to "Car 2"
- set the title of button "Car 3" of window "Drag Race" to "Car 3"
- set the title of button "Car 4" of window "Drag Race" to "Car 4"
- set the title of button "Car 5" of window "Drag Race" to "Car 5"
- set the enabled of button "Start Race" of window "Drag Race" to false
- set the bounds of button "Car 1" of window "Drag Race" to carOneOrgbounds
- set the bounds of button "Car 2" of window "Drag Race" to carTwoOrgbounds
- set the bounds of button "Car 3" of window "Drag Race" to carThreeOrgbounds
- set the bounds of button "Car 4" of window "Drag Race" to carFourOrgbounds
- set the bounds of button "Car 5" of window "Drag Race" to carFiveOrgbounds
-end resetRace
-
-
-on moveCar1()
- tell window "Drag Race"
- set carOneOrgPos to the bounds of button "Car 1"
- set stepVal to random number from 1 to raceSpeedval
- set bounds of button "Car 1" to {((item 1 of carOneOrgPos) + stepVal), item 2 of carOneOrgbounds, ((item 3 of carOneOrgPos) + stepVal), item 4 of carOneOrgbounds}
-
- set carOneOrgPos to the bounds of button "Car 1"
- if item 3 of carOneOrgPos > 630 then
- set winner to "Car 1"
- set endRace to true
- set the enabled of button "Start Race" to false
- if pickedCar = "Car 1" then
- set the contents of text field "results" to "Car 1, you won!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (betAmount + holdingsAmount)
- else
- set the contents of text field "results" to winner & " won, you lost!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (holdingsAmount - betAmount)
- end if
- end if
- end tell
-end moveCar1
-
-on moveCar2()
- tell window "Drag Race"
- set cartwoOrgPos to the bounds of button "Car 2"
- set stepVal to random number from 1 to raceSpeedval
- set bounds of button "Car 2" to {((item 1 of cartwoOrgPos) + stepVal), item 2 of carTwoOrgbounds, ((item 3 of cartwoOrgPos) + stepVal), item 4 of carTwoOrgbounds}
-
- set cartwoOrgPos to the bounds of button "Car 2"
- if item 3 of cartwoOrgPos > finishLine then
- set winner to "Car 2"
- set endRace to true
- set the enabled of button "Start Race" to false
- if pickedCar = "Car 2" then
- set the contents of text field "results" to "Car 2, you won!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (betAmount + holdingsAmount)
- else
- set the contents of text field "results" to winner & " won, you lost!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (holdingsAmount - betAmount)
- end if
- end if
- end tell
-end moveCar2
-
-on moveCar3()
- tell window "Drag Race"
- set carThreeOrgPos to the bounds of button "Car 3"
- set stepVal to random number from 1 to raceSpeedval
- set bounds of button "Car 3" to {((item 1 of carThreeOrgPos) + stepVal), item 2 of carThreeOrgbounds, ((item 3 of carThreeOrgPos) + stepVal), item 4 of carThreeOrgbounds}
- set carThreeOrgPos to the bounds of button "Car 3"
- if item 3 of carThreeOrgPos > finishLine then
- set winner to "Car 3"
- set endRace to true
- set the enabled of button "Start Race" to false
- if pickedCar = "Car 3" then
- set the contents of text field "results" to "Car 3, you won!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (betAmount + holdingsAmount)
- else
- set the contents of text field "results" to winner & " won, you lost!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (holdingsAmount - betAmount)
- end if
- end if
- end tell
-end moveCar3
-
-on moveCar4()
- tell window "Drag Race"
- set carFourOrgPos to the bounds of button "Car 4"
- set stepVal to random number from 1 to raceSpeedval
- set bounds of button "Car 4" to {((item 1 of carFourOrgPos) + stepVal), item 2 of carFourOrgbounds, ((item 3 of carFourOrgPos) + stepVal), item 4 of carFourOrgbounds}
- set carFourOrgPos to the bounds of button "Car 4"
- if item 3 of carFourOrgPos > finishLine then
- set winner to "Car 4"
- set endRace to true
- set the enabled of button "Start Race" to false
- if pickedCar = "Car 4" then
- set the contents of text field "results" to "Car 4, you won!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (betAmount + holdingsAmount)
- else
- set the contents of text field "results" to winner & " won, you lost!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (holdingsAmount - betAmount)
- end if
- end if
- end tell
-end moveCar4
-
-on moveCar5()
- tell window "Drag Race"
- set carFiveOrgPos to the bounds of button "Car 5"
- set stepVal to random number from 1 to raceSpeedval
- set bounds of button "Car 5" to {((item 1 of carFiveOrgPos) + stepVal), item 2 of carFiveOrgbounds, ((item 3 of carFiveOrgPos) + stepVal), item 4 of carFiveOrgbounds}
- set carFiveOrgPos to the bounds of button "Car 5"
- if item 3 of carFiveOrgPos > finishLine then
- set winner to "Car 5"
- set endRace to true
- set the enabled of button "Start Race" to false
- if pickedCar = "Car 5" then
- set the contents of text field "results" to "Car 5, you won!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (betAmount + holdingsAmount)
- else
- set the contents of text field "results" to winner & " won, you lost!"
- tell progress indicator "ProgressBar" to stop
- set visible of progress indicator "ProgressBar" to false
- set contents of text field "holdings" to (holdingsAmount - betAmount)
- end if
- end if
- end tell
-end moveCar5
-
-
-(* ==== Event Handlers ==== *)
-
-on will open theObject
- set visible of progress indicator "ProgressBar" of window "Drag Race" to false
- set betAmount to contents of text field "bet" of window "Drag Race"
- set holdingsAmount to contents of text field "holdings" of window "Drag Race"
- set raceSpeedval to contents of slider "RaceSpeed" of window "Drag Race" as integer
- set carOneOrgbounds to the bounds of button "Car 1" of window "Drag Race"
- set carTwoOrgbounds to the bounds of button "Car 2" of window "Drag Race"
- set carThreeOrgbounds to the bounds of button "Car 3" of window "Drag Race"
- set carFourOrgbounds to the bounds of button "Car 4" of window "Drag Race"
- set carFiveOrgbounds to the bounds of button "Car 5" of window "Drag Race"
- set the contents of text field "results" of window "Drag Race" to "Pick a car!"
- set the enabled of button "Start Race" of window "Drag Race" to false
- set the enabled of button "Reset" of window "Drag Race" to false
-end will open
-
-
-on clicked theObject
-
- if title of theObject = "Car 1" then
- resetRace()
- set the title of button "Car 1" of window "Drag Race" to "Car 1 ¥"
- set contents of text field "results" of window "Drag Race" to "You picked car 1"
- set pickedCar to "Car 1"
- set the enabled of button "Start Race" of window "Drag Race" to true
- set the enabled of button "Reset" of window "Drag Race" to true
- else if title of theObject = "Car 2" then
- resetRace()
- set the title of button "Car 2" of window "Drag Race" to "Car 2 ¥"
- set contents of text field "results" of window "Drag Race" to "You picked car 2"
- set pickedCar to "Car 2"
- set the enabled of button "Start Race" of window "Drag Race" to true
- set the enabled of button "Reset" of window "Drag Race" to true
- else if title of theObject = "Car 3" then
- resetRace()
- set the title of button "Car 3" of window "Drag Race" to "Car 3 ¥"
- set contents of text field "results" of window "Drag Race" to "You picked car 3"
- set pickedCar to "Car 3"
- set the enabled of button "Start Race" of window "Drag Race" to true
- set the enabled of button "Reset" of window "Drag Race" to true
- else if title of theObject = "Car 4" then
- resetRace()
- set the title of button "Car 4" of window "Drag Race" to "Car 4 ¥"
- set contents of text field "results" of window "Drag Race" to "You picked car 4"
- set pickedCar to "Car 4"
- set the enabled of button "Start Race" of window "Drag Race" to true
- set the enabled of button "Reset" of window "Drag Race" to true
- else if title of theObject = "Car 5" then
- resetRace()
- set the title of button "Car 5" of window "Drag Race" to "Car 5 ¥"
- set contents of text field "results" of window "Drag Race" to "You picked car 5"
- set pickedCar to "Car 5"
- set the enabled of button "Start Race" of window "Drag Race" to true
- set the enabled of button "Reset" of window "Drag Race" to true
- else if title of theObject = "Reset" then
- set endRace to true
- tell progress indicator "ProgressBar" of window "Drag Race" to stop
- resetRace()
- set the contents of text field "results" of window "Drag Race" to "Pick a car!"
- end if
-
- if contents of text field "results" of window "Drag Race" ­ "Pick a car!" then
- if title of theObject = "Start Race" then
- set endRace to false
- set betAmount to contents of text field "bet" of window "Drag Race"
- set holdingsAmount to contents of text field "holdings" of window "Drag Race"
- set visible of progress indicator "ProgressBar" of window "Drag Race" to true
- tell progress indicator "ProgressBar" of window "Drag Race" to start
- repeat while endRace = false
- moveCar1()
- moveCar2()
- moveCar3()
- moveCar4()
- moveCar5()
- end repeat
- end if
- end if
-end clicked
-
-on action theObject
- set raceSpeedval to contents of slider "RaceSpeed" of window "Drag Race" as integer
-end action
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* This is an example that demonstrates how to show and hide a drawer, as well as change all of the various settings of a drawer, including the leading/trailing offsets and the various content sizes. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when any of the attached UI elements are clicked. One thing of note in the handling of clicking on stepper objects: you need to update the value of the text fields based on the value of the stepper in order to keep them in sync.
---
-on clicked theObject
- tell window "main"
- if theObject is equal to button "drawer" then
- set currentState to state of drawer "drawer"
- set openOnSide to current row of matrix "open on"
-
- -- Show/Hide the drawer as appropriate as well as updating the state text fields.
- if currentState is equal to drawer closed or currentState is equal to drawer closing then
- if openOnSide is equal to 1 then
- tell drawer "drawer" to open drawer on left edge
- else if openOnSide is equal to 2 then
- tell drawer "drawer" to open drawer on top edge
- else if openOnSide is equal to 3 then
- tell drawer "drawer" to open drawer on right edge
- else if openOnSide is equal to 4 then
- tell drawer "drawer" to open drawer on bottom edge
- end if
- set title of button "drawer" to "Close Drawer"
- set contents of text field "drawer state" to "Opened"
- else if currentState is equal to drawer opened or currentState is equal to drawer opening then
- tell drawer "drawer" to close drawer
- set title of button "drawer" to "Open Drawer"
- set contents of text field "drawer state" to "Closed"
- end if
- else if theObject is equal to stepper "leading offset" then
- set theValue to (contents of stepper "leading offset") as integer
- set leading offset of drawer "drawer" to theValue
- set contents of text field "leading offset" to theValue
- else if theObject is equal to stepper "trailing offset" then
- set theValue to (contents of stepper "trailing offset") as integer
- set trailing offset of drawer "drawer" to theValue
- set contents of text field "trailing offset" to theValue
- else if theObject is equal to stepper "content width" then
- set theValue to (contents of stepper "content width") as integer
- set contentSize to content size of drawer "drawer"
- set item 1 of contentSize to theValue
- set content size of drawer "drawer" to contentSize
- set contents of text field "content width" to theValue
- else if theObject is equal to stepper "content height" then
- set theValue to (contents of stepper "content height") as integer
- set contentSize to content size of drawer "drawer"
- set item 2 of contentSize to theValue
- set content size of drawer "drawer" to contentSize
- set contents of text field "content height" to theValue
- else if theObject is equal to stepper "minimum width" then
- set theValue to (contents of stepper "minimum width") as integer
- set minimumSize to minimum content size of drawer "drawer"
- set item 1 of minimumSize to theValue
- set minimum content size of drawer "drawer" to minimumSize
- set contents of text field "minimum width" to theValue
- else if theObject is equal to stepper "minimum height" then
- set theValue to (contents of stepper "minimum height") as integer
- set minimumSize to minimum content size of drawer "drawer"
- set item 2 of minimumSize to theValue
- set minimum content size of drawer "drawer" to minimumSize
- set contents of text field "minimum height" to theValue
- else if theObject is equal to stepper "maximum width" then
- set theValue to (contents of stepper "maximum width") as integer
- set maximumSize to maximum content size of drawer "drawer"
- set item 1 of maximumSize to theValue
- set maximum content size of drawer "drawer" to maximumSize
- set contents of text field "maximum width" to theValue
- else if theObject is equal to stepper "maximum height" then
- set theValue to (contents of stepper "maximum height") as integer
- set maximumSize to maximum content size of drawer "drawer"
- set item 2 of maximumSize to theValue
- set maximum content size of drawer "drawer" to maximumSize
- set contents of text field "maximum height" to theValue
- end if
- end tell
-end clicked
-
--- This event handler is called when the text value of the attached text fields are changed. One thing of note in the handling of text fields with stepper objects: you need to update the value of the stepper based on the value of the text field in order to keep them in sync.
---
-on action theObject
- set textValue to contents of theObject
-
- tell window "main"
- if theObject is equal to text field "leading offset" then
- set leading offset of drawer "drawer" to textValue
- set contents of stepper "leading offset" to textValue
- else if theObject is equal to text field "trailing offset" then
- set trailing offset of drawer "drawer" to textValue
- set contents of stepper "trailing offset" to textValue
- else if theObject is equal to text field "content width" then
- set theValue to (contents of text field "content width") as integer
- set contentSize to content size of drawer "drawer"
- set item 1 of contentSize to theValue
- set content size of drawer "drawer" to contentSize
- set contents of stepper "content width" to theValue
- else if theObject is equal to text field "content height" then
- set theValue to (contents of text field "content height") as integer
- set contentSize to content size of drawer "drawer"
- set item 2 of contentSize to theValue
- set content size of drawer "drawer" to contentSize
- set contents of stepper "content height" to theValue
- else if theObject is equal to text field "minimum width" then
- set theValue to (contents of text field "minimum width") as integer
- set minimumSize to minimum content size of drawer "drawer"
- set item 1 of minimumSize to theValue
- set minimum content size of drawer "drawer" to minimumSize
- set contents of stepper "minimum width" to theValue
- else if theObject is equal to text field "minimum height" then
- set theValue to (contents of text field "minimum height") as integer
- set minimumSize to minimum content size of drawer "drawer"
- set item 2 of minimumSize to theValue
- set minimum content size of drawer "drawer" to minimumSize
- set contents of stepper "minimum height" to theValue
- else if theObject is equal to text field "maximum width" then
- set theValue to (contents of text field "maximum width") as integer
- set maximumSize to maximum content size of drawer "drawer"
- set item 1 of maximumSize to theValue
- set maximum content size of drawer "drawer" to maximumSize
- set contents of stepper "maximum width" to theValue
- else if theObject is equal to text field "maximum height" then
- set theValue to (contents of text field "maximum height") as integer
- set maximumSize to maximum content size of drawer "drawer"
- set item 2 of maximumSize to theValue
- set maximum content size of drawer "drawer" to maximumSize
- set contents of stepper "maximum height" to theValue
- end if
- end tell
-end action
-
--- This event handler is called when the attached window is loaded from the nib file. It's a good place to set up the values of all of the UI elements based on the current drawer settings.
---
-on awake from nib theObject
- tell theObject
- set openOnEdge to edge of drawer "drawer"
- set preferredEdge to preferred edge of drawer "drawer"
-
- -- Set the drawer up with some initial values.
- set leading offset of drawer "drawer" to 20
- set trailing offset of drawer "drawer" to 20
-
- -- Update the UI to match the settings of the drawer.
- if state of drawer "drawer" is drawer closed then
- set contents of text field "drawer state" to "Closed"
- else if state of drawer "drawer" is drawer opened then
- set contents of text field "drawer state" to "Opened"
- end if
-
- if openOnEdge is left edge then
- set current row of matrix "open on" to 1
- else if openOnEdge is top edge then
- set current row of matrix "open on" to 2
- else if openOnEdge is right edge then
- set current row of matrix "open on" to 3
- else if openOnEdge is bottom edge then
- set current row of matrix "open on" to 4
- end if
-
- if preferredEdge is left edge then
- set current row of matrix "prefer on" to 1
- else if preferredEdge is top edge then
- set current row of matrix "prefer on" to 2
- else if preferredEdge is right edge then
- set current row of matrix "prefer on" to 3
- else if preferredEdge is bottom edge then
- set current row of matrix "prefer on" to 4
- end if
-
- set leadingValue to leading offset of drawer "drawer"
- set trailingValue to trailing offset of drawer "drawer"
- set contentSize to content size of drawer "drawer"
- set minimumContentSize to minimum content size of drawer "drawer"
- set maximumContentSize to maximum content size of drawer "drawer"
-
- set contents of text field "leading offset" to leadingValue
- set contents of stepper "leading offset" to leadingValue
- set contents of text field "trailing offset" to trailingValue
- set contents of stepper "trailing offset" to trailingValue
- set contents of text field "content width" to item 1 of contentSize
- set contents of stepper "content width" to item 1 of contentSize
- set contents of text field "content height" to item 2 of contentSize
- set contents of stepper "content height" to item 2 of contentSize
- set contents of text field "minimum width" to item 1 of minimumContentSize
- set contents of stepper "minimum width" to item 1 of minimumContentSize
- set contents of text field "minimum height" to item 2 of minimumContentSize
- set contents of stepper "minimum height" to item 2 of minimumContentSize
- set contents of text field "maximum width" to item 1 of maximumContentSize
- set contents of stepper "maximum width" to item 1 of maximumContentSize
- set contents of text field "maximum height" to item 2 of maximumContentSize
- set contents of stepper "maximum height" to item 2 of maximumContentSize
- end tell
-end awake from nib
-
-on launched theObject
- show window "main"
-end launched
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Content Controller.applescript *)
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to (current date) as text
-end clicked
-
-on should open theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "should open"
- return false
-end should open
-
-on should close theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "should close"
- return true
-end should close
-
-on will open theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "will open"
-end will open
-
-on will resize theObject proposed size proposedSize
- log proposedSize as string
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "will resize"
-end will resize
-
-on will close theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "will close"
-end will close
-
-on opened theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "opened"
-end opened
-
-on closed theObject
- set contents of text field "Date Field" of drawer "Drawer" of window "Main" to "closed"
-end closed
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* This example simply loads an image with a given name that is contained in the project and set's it as the image of the image view. *)
-
-(* ==== Event Handlers ==== *)
-
-on awake from nib theObject
- set image of image view "image" of window "main" to load image "AboutBox"
-end awake from nib
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Mail Search.applescript *)
-
-(* ==== Globals ==== *)
-
-global controllers
-
-
-(* ==== Properties ==== *)
-
-property windowCount : 0
-property statusPanelNibLoaded : false
-
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- set theController to controllerForWindow(window of theObject)
- if theController is not equal to null then
- tell theController to find()
- end if
-end clicked
-
-on double clicked theObject
- set theController to controllerForWindow(window of theObject)
- if theController is not equal to null then
- tell theController to openMessages()
- end if
-end double clicked
-
-on action theObject
- set theController to controllerForWindow(window of theObject)
- if theController is not equal to null then
- tell theController to find()
- end if
-end action
-
-on will open theObject
- set theController to makeController(theObject)
- if theController is not equal to null then
- addController(theController)
- tell theController to initialize()
- end if
-end will open
-
-on opened theObject
- set theController to controllerForWindow(theObject)
- if theController is not equal to null then
- tell theController to loadMailboxes()
- end if
-end opened
-
-on will finish launching theObject
- set controllers to {}
-end will finish launching
-
-
-(* ==== Controller Handlers ==== *)
-
-on makeController(forWindow)
- script
- property theWindow : forWindow
- property theStatusPanel : null
- property foundMessages : {}
- property mailboxesLoaded : false
-
- -- Handlers
-
- on initialize()
- -- Add a column to the mailboxes data source
- tell scroll view "mailboxes" of split view 1 of theWindow
- make new data column at the end of the data columns of data source of outline view "mailboxes" with properties {name:"mailboxes"}
- end tell
-
- -- Add the columns to the messages data source
- tell scroll view "messages" of split view 1 of theWindow
- make new data column at the end of the data columns of data source of table view "messages" with properties {name:"from"}
- make new data column at the end of the data columns of data source of table view "messages" with properties {name:"subject"}
- make new data column at the end of the data columns of data source of table view "messages" with properties {name:"mailbox"}
- end tell
-
- set windowCount to windowCount + 1
- end initialize
-
- on loadMailboxes()
- if not mailboxesLoaded then
- -- Open the status panel
- set theStatusPanel to makeStatusPanel(theWindow)
- tell theStatusPanel to openPanel("Looking for Mailboxes...")
-
- -- Add the mailboxes
- addMailboxes()
-
- -- Close the status panel
- tell theStatusPanel to closePanel()
-
- set mailboxesLoaded to true
- end if
- end loadMailboxes
-
- on find()
- -- Get what and where to find
- set whatToFind to contents of text field "what" of theWindow
- set whereToFind to title of current menu item of popup button "where" of theWindow
-
- -- Make sure that we have something to find
- if (count of whatToFind) is greater than 0 then
- -- Clear any previously found messages
- clearMessages()
-
- -- Setup a status panel
- set theStatusPanel to makeStatusPanel(theWindow)
- tell theStatusPanel to openPanel("Determining the number of messages...")
-
- try
- -- Determine the mailboxes to search
- set mailboxesToSearch to selectedMailboxes()
-
- -- Determine the total number of messages to search
- set totalCount of theStatusPanel to countMessages(mailboxesToSearch)
-
- -- Adjust the status panel
- tell theStatusPanel to adjustPanel()
-
- -- Find the messages
- set foundMessages to findMessages(mailboxesToSearch, whereToFind, whatToFind)
-
- -- Change the status panel
- tell theStatusPanel to changePanel("Adding found messages...")
-
- -- Add the found messages to the result table
- addMessages(foundMessages)
-
- -- Close the status panel
- tell theStatusPanel to closePanel()
- on error errorText
- tell theStatusPanel to closePanel()
- display alert "AppleScript Error" as critical attached to theWindow message errorText
- end try
- else
- display alert "Missing Value" as critical attached to theWindow message "You need to enter a value to search for."
- end if
- end find
-
- on addMailbox(accountItem, accountName, mailboxIndex, mailboxName)
- -- Add a new item
- set mailboxItem to make new data item at the end of the data items of accountItem
- set name of data cell 1 of mailboxItem to "mailboxes"
- set contents of data cell 1 of mailboxItem to mailboxName
- set associated object of mailboxItem to mailboxIndex
- end addMailbox
-
- on addAccount(a, accountIndex, accountName)
- -- Add a new item
- set accountItem to make new data item at the end of the data items of data source of outline view "mailboxes" of scroll view "mailboxes" of split view 1 of theWindow
- set name of data cell 1 of accountItem to "mailboxes"
- set contents of data cell 1 of accountItem to accountName
- set associated object of accountItem to accountIndex
-
- -- Add the mail boxes
- tell application "Mail"
- set mailboxIndex to 0
- repeat with m in (get mailboxes of a)
- try
- set mailboxIndex to mailboxIndex + 1
- my addMailbox(accountItem, accountName, mailboxIndex, name of m)
- end try
- end repeat
- end tell
- end addAccount
-
- on addMailboxes()
- tell application "Mail"
- set accountIndex to 0
- repeat with a in (get accounts whose enabled is not equal to false)
- try
- set accountIndex to accountIndex + 1
- my addAccount(a, accountIndex, name of a)
- end try
- end repeat
- end tell
- end addMailboxes
-
- on mailboxesForIndex(mailboxIndex)
- -- Initiialize the result
- set theMailboxes to {}
-
- set theIndex to 0
- set theAccountIndex to 0
-
- -- Determine if the selected item is an account or a mailbox
- tell outline view "mailboxes" of scroll view "mailboxes" of split view 1 of theWindow
- set theItem to item for row mailboxIndex
- set theName to contents of data cell 1 of theItem
- set theIndex to associated object of theItem
- if has parent data item of theItem then
- set theAccountIndex to the associated object of the parent data item of theItem
- end if
- end tell
-
- tell application "Mail"
- if theAccountIndex > 0 then
- set theMailboxes to {mailbox theIndex of account theAccountIndex}
- else
- set theMailboxes to theMailboxes & every mailbox of account theIndex
- end if
- end tell
-
- -- Return the result
- return theMailboxes
- end mailboxesForIndex
-
- on selectedMailboxes()
- -- Initialize the result
- set mailboxesSelected to {}
-
- -- Get the currently selected mailboxes in the outline view
- set mailboxIndicies to selected rows of outline view "mailboxes" of scroll view "mailboxes" of split view 1 of theWindow
-
- -- Get the actual mailboxes from Mail
- tell application "Mail"
- if (count of mailboxIndicies) is equal to 0 then
- repeat with a in (get accounts)
- set mailboxesSelected to mailboxesSelected & every mailbox of a
- end repeat
- else
- repeat with i in mailboxIndicies
- set mailboxesSelected to mailboxesSelected & my mailboxesForIndex(i)
- end repeat
- end if
- end tell
-
- -- Return the result
- return mailboxesSelected
- end selectedMailboxes
-
- on addMessage(messageFrom, messageSubject, messageMailbox)
- -- Add a new row
- set theRow to make new data row at the end of the data rows of data source of table view "messages" of scroll view "messages" of split view 1 of theWindow
-
- -- Add "From" cell
- set name of data cell 1 of theRow to "from"
- set contents of data cell 1 of theRow to messageFrom
-
- -- Add "Subject" cell
- set name of data cell 2 of theRow to "subject"
- set contents of data cell 2 of theRow to messageSubject
-
- -- Add "Mailbox" cell
- set name of data cell 3 of theRow to "mailbox"
- set contents of data cell 3 of theRow to messageMailbox
-
- -- set the associated object of theRow to m
- end addMessage
-
- on addMessages(foundMessages)
- set update views of data source of table view "messages" of scroll view "messages" of split view 1 of theWindow to false
-
- tell application "Mail"
- repeat with m in foundMessages
- try
- set messageMailbox to name of account 1 of mailbox of m & "/" & name of mailbox of m
- my addMessage(sender of m, subject of m, messageMailbox)
- end try
- end repeat
- end tell
-
- set update views of data source of table view "messages" of scroll view "messages" of split view 1 of theWindow to true
- end addMessages
-
- on findMessages(mailboxesToSearch, whereToFind, whatToFind)
- -- Initialize the result
- set messagesFound to {}
-
- tell application "Mail"
- -- Search through each of the mail boxes
- repeat with b in (get mailboxesToSearch)
- try
- -- Search through each of the messages of the mail box
- repeat with m in (get messages of b)
- try
- if whereToFind is equal to "Subject" then
- if whatToFind is in the subject of m then
- copy m to end of messagesFound
- end if
- else if whereToFind is equal to "From" then
- if whatToFind is in sender of m then
- copy m to end of messagesFound
- end if
- else if whereToFind is equal to "To" then
- set foundRecipient to false
-
- -- Recipients
- repeat with r in (get recipients of m)
- if whatToFind is in address of r or whatToFind is in name of r then
- set foundRecipient to true
- end if
- end repeat
-
- -- To Recipients
- if not foundRecipient then
- repeat with r in (get to recipients of m)
- if whatToFind is in address of r or whatToFind is in name of r then
- set foundRecipient to true
- end if
- end repeat
- end if
-
- -- cc Recipients
- if not foundRecipient then
- repeat with r in (get cc recipients of m)
- if whatToFind is in address of r or whatToFind is in name of r then
- set foundRecipient to true
- end if
- end repeat
- end if
-
- -- bcc Recipients
- if not foundRecipient then
- repeat with r in (get bcc recipients of m)
- if whatToFind is in address of r or whatToFind is in name of r then
- set foundRecipient to true
- end if
- end repeat
- end if
-
- if foundRecipient then
- copy m to end of messagesFound
- end if
- else if whereToFind is equal to "Contents" then
- if whatToFind is in the content of m then
- copy m to end of messagesFound
- end if
- end if
-
- -- Update the status panel
- tell theStatusPanel to incrementPanel()
- end try
- end repeat
- end try
- end repeat
- end tell
-
- -- Return the result
- return messagesFound
- end findMessages
-
- on clearMessages()
- tell scroll view "messages" of split view 1 of theWindow
- tell data source of table view "messages" to delete every data row
- end tell
- end clearMessages
-
- on countMessages(mailboxesToSearch)
- set messageCount to 0
-
- tell application "Mail"
- repeat with b in (get mailboxesToSearch)
- try
- set messageCount to messageCount + (count of every message of b)
- end try
- end repeat
- end tell
-
- return messageCount
- end countMessages
-
- on openMessages()
- -- Since Mail.app currently can't open a selected message then we will just open it in our own window
- openMessageWindow()
- end openMessages
-
- on openMessageWindow()
- set clickedRow to clicked row of table view "messages" of scroll view "messages" of split view 1 of theWindow
- if clickedRow is greater than or equal to 0 then
- set theAccount to ""
- set theMailbox to ""
- set theSubject to ""
- set theDateReceived to ""
- set theContents to ""
- set theSender to ""
- set theRecipients to ""
- set theCCRecipients to ""
- set theReplyTo to ""
-
- tell application "Mail"
- set theMessage to item clickedRow of foundMessages
-
- set theAccount to name of account of mailbox of theMessage
- set theMailbox to name of mailbox of theMessage
- set theSubject to subject of theMessage
- -- set theDateReceived to date received of theMessage
- set theContents to content of theMessage
- set theSender to sender of theMessage
- set theRecipients to address of every recipient of theMessage
- set theCCRecipients to address of every cc recipient of theMessage
- set theReplyTo to reply to of theMessage
- end tell
-
- set messageWindow to makeMessageWindow()
- tell messageWindow
- set messageContents to "Account: " & theAccount & return
- set messageContents to messageContents & "Mailbox: " & theMailbox & return
- if length of theSender > 0 then
- set messageContents to messageContents & "From: " & theSender & return
- end if
- if length of theDateReceived as string > 0 then
- set messageContents to messageContents & "Date: " & (theDateReceived as string) & return
- end if
- if length of theRecipients > 0 then
- set messageContents to messageContents & "To: " & theRecipients & return
- end if
- if length of theCCRecipients > 0 then
- set messageContents to messageContents & "Cc: " & theCCRecipients & return
- end if
- if length of theSubject > 0 then
- set messageContents to messageContents & "Subject: " & theSubject & return
- end if
- if length of theReplyTo > 0 then
- set messageContents to messageContents & "Reply-To: " & theReplyTo & return & return
- end if
- set messageContents to messageContents & theContents
- set contents of text view "message" of scroll view "message" to messageContents
- set title to theSubject
- set visible to true
- end tell
- end if
- end openMessageWindow
- end script
-end makeController
-
-on addController(theController)
- set controllers to controllers & {theController}
-end addController
-
-
-on controllerForWindow(aWindow)
- repeat with c in controllers
- if theWindow of c is equal to aWindow then
- set theController to c
- end if
- end repeat
- return theController
-end controllerForWindow
-
-
-(* ==== Message Window Handlers ==== *)
-
-on makeMessageWindow()
- load nib "Message"
- set windowCount to windowCount + 1
- set windowName to "message " & windowCount
- set name of window "message" to windowName
- return window windowName
-end makeMessageWindow
-
-
-(* ==== Status Panel Handlers ==== *)
-
-on makeStatusPanel(forWindow)
- script
- property theWindow : forWindow
- property initialized : false
- property totalCount : 0
- property currentCount : 0
-
- -- Handlers
- on openPanel(statusMessage)
- if initialized is false then
- if not statusPanelNibLoaded then
- load nib "StatusPanel"
- set statusPanelNibLoaded to true
- end if
- tell window "status"
- set indeterminate of progress indicator "progress" to true
- tell progress indicator "progress" to start
- set contents of text field "statusMessage" to statusMessage
- end tell
- set initialized to true
- end if
- display panel window "status" attached to theWindow
- end openPanel
-
- on changePanel(statusMessage)
- tell window "status"
- set indeterminate of progress indicator "progress" to true
- tell progress indicator "progress" to start
- set contents of text field "statusMessage" to statusMessage
- end tell
- end changePanel
-
- on adjustPanel()
- tell progress indicator "progress" of window "status"
- set indeterminate to false
- set minimum value to currentCount
- set maximum value to totalCount
- set contents to 0
- end tell
- incrementPanel()
- end adjustPanel
-
- on incrementPanel()
- set currentCount to currentCount + 1
- if currentCount ² totalCount then
- tell window "status"
- tell progress indicator "progress" to increment by 1
- set contents of text field "statusMessage" to "Message " & currentCount & " of " & totalCount
- end tell
- end if
- end incrementPanel
-
- on closePanel()
- close panel window "status"
- end closePanel
- end script
-end makeStatusPanel
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- AppleScript.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "AppleScript" button is clicked.
---
-on clicked theObject
- tell window of theObject
- -- Simply put "AppleScript" into the text field
- set the contents of the text field "applescript" to "AppleScript"
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- C++.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "C++" button is clicked.
---
-on clicked theObject
- tell window of theObject
- -- Call the Objective-C method "nameForCPlusPlusLanguage" defined in "Multi-Language.h"
- -- It will in turn call a method of the CPlusPlusLanguage class defined in "C++.h"
- set contents of text field "c++" to call method "nameForCPlusPlusLanguage"
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- C.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "C" button is clicked.
---
-on clicked theObject
- tell window of theObject
- -- Call the Objective-C method "nameForCLanguage" defined in "Multi-Language.h"
- -- It in turn, will call a function defined in "C.h"
- set contents of text field "c" to call method "nameForCLanguage"
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- Java.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when either the "Java" or "Direct Java" button is clicked. If the "Java" button is clicked it will call into the Objective-C method and use the Java Bridging mechanism to call a Java method of a Java class. If the "Direct Java" button is clicked it will use 'call method''s ability to call a static method of a Java class directly.
---
-on clicked theObject
- tell window of theObject
- if name of theObject is "java" then
- -- Call the Objective-C method "nameForJavaLanguage" defined in "Multi-Language.h"
- -- It will in turn call a method of the JavaLanguage class defined in "JavaLanguage.java"
- set contents of text field "java" to call method "nameForJavaLanguage"
- else if name of theObject is "direct java" then
- -- Call the static "languageName" method of the "JavaLanguage" class which is defined in "JavaLanguage.java"
- set contents of text field "direct java" to call method "languageName" of class "JavaLanguage"
- end if
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- Application.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Use All" button is clicked.
---
-on clicked theObject
- tell window of theObject
- -- Execute the 'nameOfAllLanguages' Objective-C method in "Multi-Language.mm" and then append "AppleScript" to the result and put it in the text field
- set contents of text field "use all" to ((call method "nameOfAllLanguages") & ", AppleScript")
- end tell
-end clicked
-
--- This event handler is called when the "Clear All" menu item in the edit menu is chosen. It will set the contents of all of the text fields to empty strings.
---
-on choose menu item theObject
- tell window "main"
- set contents of text field "applescript" to ""
- set contents of text field "objective-c" to ""
- set contents of text field "c" to ""
- set contents of text field "c++" to ""
- set contents of text field "java" to ""
- set contents of text field "direct java" to ""
- set contents of text field "use all" to ""
- end tell
-end choose menu item
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- Objective-C.applescript
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Objective-C" button is clicked.
---
-on clicked theObject
- tell window of theObject
- -- Call the Objective-C method "nameForObjCLanguage" defined in "Multi-Language.h"
- -- It will in turn call a method of the ObjCLanugage class defined in "Objective-C.h"
- set contents of text field "objective-c" to call method "nameForObjCLanguage"
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(*Open Panel.applescript *)
-
-(* This example demonstrates how to use the 'open-panel' class, either as a modal panel or as a panel attached to a window. The 'open panel' is a property of the application object. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Display Open Panel" button is clicked, which when clicked the various parameter values pulled from the text fields to be sent to "display".
---
-on clicked theObject
- -- Get the values from the UI
- tell window of theObject
- set theTitle to contents of text field "title"
- set thePrompt to contents of text field "prompt"
- set theFileTypes to contents of text field "file types"
- set theDirectory to contents of text field "directory"
- set theFileName to contents of text field "file name"
- set treatPackages to contents of button "treat packages" as boolean
- set canChooseDirectories to contents of button "choose directories" as boolean
- set canChooseFiles to contents of button "choose files" as boolean
- set allowsMultiple to contents of button "multiple selection" as boolean
- set asSheet to contents of button "sheet" as boolean
-
- -- Convert the comma separated list of file type to an actual list
- set AppleScript's text item delimiters to ", "
- set theFileTypes to text items of theFileTypes
- set AppleScript's text item delimiters to ""
- end tell
-
- -- Setup the properties in the 'open panel'
- tell open panel
- set title to theTitle
- set prompt to thePrompt
- set treat packages as directories to treatPackages
- set can choose directories to canChooseDirectories
- set can choose files to canChooseFiles
- set allows multiple selection to allowsMultiple
- end tell
-
- -- Determine which way to display the panel
- if asSheet then
- -- Display the panel as sheet (in which case the result will happen in 'on panel ended').
- -- One thing to note is that the script will not stop processing until the panel is presented but continues on. You must use the 'on panel ended' event handler to get notified when the panel has finished.
- -- The 'in directory' and 'with file name' parameters are optional.
- if (count of theFileTypes) is 0 then
- display open panel in directory theDirectory with file name theFileName attached to window of theObject
- else
- display open panel in directory theDirectory with file name theFileName for file types theFileTypes attached to window of theObject
- end if
- else
- -- Display the panel.
- -- Unlike the 'attached to' variant, the script does stop processing until the panel is finished.
- -- The 'in directory' and 'with file name' parameters are optional
- if (count of theFileTypes) is 0 then
- set theResult to display open panel in directory theDirectory with file name theFileName for file types theFileTypes
- else
- set theResult to display open panel in directory theDirectory with file name theFileName
- end if
-
- if theResult is 1 then
- -- Convert the list into a list of strings separated by return characters that we can put in the 'path names' text view
- -- For some unknown (as of yet) you must coerce the 'path names' to a list (even though it is defined as list).
- set the pathNames to (path names of open panel as list)
- set AppleScript's text item delimiters to return
- set the pathNames to pathNames as string
- set AppleScript's text item delimiters to ""
-
- set contents of text view "path names" of scroll view "path names" of window "main" to pathNames
- else
- set contents of text view "path names" of scroll view "path names" of window "main" to ""
- end if
- end if
-end clicked
-
--- This event handler is called when the panel presented with the 'display attached to' command is finished.
---
-on panel ended theObject with result withResult
- if withResult is 1 then
- -- Convert the list into a list of strings separated by return characters that we can put in the 'path names' text view
- -- For some unknown (as of yet) you must coerce the 'path names' to a list (even though it is defined as list).
- set the pathNames to (path names of open panel as list)
- set AppleScript's text item delimiters to return
- set the pathNames to pathNames as string
- set AppleScript's text item delimiters to ""
-
- set contents of text view "path names" of scroll view "path names" of window "main" to pathNames
- else
- set contents of text view "path names" of scroll view "path names" of window "main" to ""
- end if
-end panel ended
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* This example illustrates how to script an outline view. *)
-
-(* ==== Properties ==== *)
-
-property diskNames : {}
-
-
-(* ==== Event Handlers ==== *)
-
-on launched theObject
- try
- tell application "Finder"
- set diskNames to name of every disk
- end tell
- end try
- tell outline view "outline" of scroll view "scroll" of window "main" to update
-end launched
-
-on number of items theObject outline item theItem
- set itemCount to 0
- try
- tell application "Finder"
- if (count of diskNames) > 0 then
- if theItem is 0 then
- set itemCount to count of diskNames
- else
- set itemCount to count of items of (get item theItem)
- end if
- end if
- end tell
- end try
- return itemCount
-end number of items
-
-on child of item theObject outline item theItem child theChild
- set childItem to ""
- try
- tell application "Finder"
- if theItem is 0 then
- set childItem to disk (get item theChild of diskNames as string) as string
- else
- set childItem to item theChild of (get item theItem) as string
- end if
- end tell
- end try
- return childItem
-end child of item
-
-on item expandable theObject outline item theItem
- set isExpandable to false
- try
- if theItem is 0 then
- if (count of diskNames) is greater than 1 then
- set isExpandable to true
- end if
- else
- tell application "Finder"
- if (count of items of (get item theItem)) is greater than 1 then
- set isExpandable to true
- end if
- end tell
- end if
- end try
- return isExpandable
-end item expandable
-
-on item value theObject outline item theItem table column theColumn
- set itemValue to ""
- try
- if the identifier of theColumn is "name" then
- tell application "Finder"
- set itemValue to displayed name of (get item theItem) as string
- end tell
- else if the identifier of theColumn is "date" then
- tell application "Finder"
- set itemValue to modification date of (get item theItem) as string
- end tell
- else if the identifier of theColumn is "kind" then
- tell application "Finder"
- set itemValue to kind of (get item theItem) as string
- end tell
- end if
- end try
- return itemValue
-end item value
-
-on will open theObject
- try
- tell application "Finder"
- set diskNames to name of every disk
- end tell
- end try
- tell outline view "outline" of scroll view "scroll" of window "main" to update
-end will open
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Outline Reorder.applescript *)
-
-(* This example populates an outline view using the "content" property and then uses the "allows reordering" property of the table and outline views to enable the automatic support of drag and drop to roerder items.
-*)
-
-
-(* ===== Event Handlers ===== *)
-
--- This event handler is attached to the table view and is a good place to setup our data source.
---
-on awake from nib theObject
- -- Setup the data source, data items and data cells simply by setting the "content" property of the table view.
- set content of theObject to {{completed:false, task:"Things to do", |items|:{{completed:true, task:"Work on outline example", |items|:{{completed:true, task:"Make it plain and simple"}, {completed:true, task:"Put it all in an \"on launched'\" event handler"}}}, {completed:true, task:"Put it in my iDisk when done"}}}}
-end awake from nib
-
--- This event handler is called when the user clicks on the check box.
---
-on clicked theObject
- set allows reordering of outline view "outline" of scroll view "scroll" of window of theObject to state of theObject
-end clicked
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Document.applescript *)
-
-(* This is a very simple example of how to write a document based plain text editor. It takes advantage of the lower level handlers for document handling, namely "read from file" and "write to file". It does this so that it can read text documents created by other applications. The two higher level handlers "data representation" and "load data representation" allow you to return and set any type of data, but then it will only be readable by your application, as it utilizes Cocoa's NSData object to store and retrieve your data. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "read from file" handler is called when the document needs to the data to be read from disk. "theObject" is the document object, "pathName" contains the POSIX style path of the file to read and "ofType" contains the type of document to read (which by default this value will be "DocumentType" as set up in the documents section of the target editor for document based Studio applications).
---
-on read from file theObject path name pathName of type ofType
- -- Open the file so that we can read it in
- set theFile to open for access (pathName as POSIX file)
-
- -- Read the data in
- set theData to read theFile as string
-
- -- Close the file
- close access theFile
-
- -- Put the data that we read into the text view of our document
- set contents of text view "editor" of scroll view "editor" of window of theObject to theData
-
- -- We need to return true (if everything went well) or false (if something failed). For the purposes of this example we'll signal that everything went well.
- return true
-end read from file
-
-
--- The "write to file" handler is called when the document needs to be saved to disk. "theObject" is the document object, "pathName" contains the POSIX style path of the file to write and "ofType" contains the type of document to read (which by default this value will be "DocumentType" as set up in the documents section of the target editor for document based Studio applications).
---
-on write to file theObject path name pathName of type ofType
- -- Get the data from the text view of the document
- set theData to contents of text view "editor" of scroll view "editor" of window of theObject
-
- -- Open the file for writing
- set theFile to open for access (pathName as POSIX file) with write permission
-
- -- Write the data
- write theData to theFile as string
-
- -- Close the file
- close access theFile
-
- -- We need to return true (if everything went well) or false (if something failed). For the purposes of this example we'll signal that everything went well.
- return true
-end write to file
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(*Save Panel.applescript *)
-
-(* This example demonstrates how to use the 'save-panel' class, either as a modal panel or as a panel attached to a window. The 'save panel' is a property of the application object. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Display Save Panel" button is clicked, which when clicked the various parameter values pulled from the text fields to be sent to "display".
---
-on clicked theObject
- -- Get the values from the UI
- tell window of theObject
- set theTitle to contents of text field "title"
- set thePrompt to contents of text field "prompt"
- set theFileType to contents of text field "file type"
- set theDirectory to contents of text field "directory"
- set theFileName to contents of text field "file name"
- set treatPackages to contents of button "treat packages" as boolean
- set asSheet to contents of button "sheet" as boolean
- end tell
-
- -- Setup the properties in the 'save panel'
- tell save panel
- set title to theTitle
- set prompt to thePrompt
- set required file type to theFileType
- set treat packages as directories to treatPackages
- end tell
-
- -- Determine which way to display the panel
- if asSheet then
- -- Display the panel as sheet (in which case the result will happen in 'on panel ended').
- -- One thing to note is that the script will not stop processing until the panel is presented but continues on. You must use the 'on panel ended' event handler to get notified when the panel has finished.
- -- The 'in directory' and 'with file name' parameters are optional.
- display save panel in directory theDirectory with file name theFileName attached to window of theObject
- else
- -- Display the panel.
- -- Unlike the 'attached to' variant, the script does stop processing until the panel is finished.
- -- The 'in directory' and 'with file name' parameters are optional
- set theResult to display save panel in directory theDirectory with file name theFileName
- if theResult is 1 then
- set contents of text field "path name" of window "main" to path name of save panel
- else
- set contents of text field "path name" of window "main" to ""
- end if
- end if
-end clicked
-
--- This event handler is called when the panel presented with the 'display attached to' command is finished.
---
-on panel ended theObject with result withResult
- if withResult is 1 then
- set contents of text field "path name" of window "main" to path name of save panel
- else
- set contents of text field "path name" of window "main" to ""
- end if
-end panel ended
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Simple Outline.applescript *)
-
-(* This is a very simple example of how to populate an outline view using a data source. It will create a data source with data items representing the following outline:
-
- - Things to do
- - Work on outline example
- - Make it plain and simple
- - Put it all in a "on launched" event handler
- - Put it in my iDisk when done
-
- It has been enhanced to add drag and drop support and uses the new "content" property.
-*)
-
-
-(* ===== Event Handlers ===== *)
-
--- This event handler is attached to the table view in our nib. It is a good place to set the contents of the table view and to setup any drag types that we might desire.
---
-on awake from nib theObject
- -- Create the data source, data items and data cells by simply setting the "content" property of the outline view
- set content of theObject to {{completed:"--", task:"Things to do", |items|:{{completed:"Yes", task:"Work on outline example", |items|:{{completed:"Yes", task:"Make it plain and simple"}, {completed:"Yes", task:"Put it all in an \"on launched'\" event handler"}}}, {completed:"Yes", task:"Put it in my iDisk when done"}}}}
-
- tell theObject to register drag types {"items", "file names"}
-end awake from nib
-
--- The launched handler is generally the last event handler to be called in the launch sequence. It's a good place for us to show our window.
---
-on launched theObject
- show window "main"
-end launched
-
--- This event handler is called whenever the user is done editing a cell in the outline view.
---
-on change item value theObject table column tableColumn outline item outlineItem value theValue
- return "maybe"
-end change item value
-
--- This event handler is called that the beginning of a drag operation in our outline view
---
-on prepare outline drag theObject drag items dragItems pasteboard thePasteboard
- -- We are about to start a drag from within our outline view, so set the preferred type of the pasteboard to be "items" and then set the content of the pasteboard to be the items being dragged
- set preferred type of thePasteboard to "items"
- set content of thePasteboard to dragItems
-
- -- Since it isn't convenient to get items on to the pasteboard, we just save the list of dragged items to be used later
- set dragged items of theObject to dragItems
-
- return true
-end prepare outline drag
-
--- This event handler is called while the drag and drop operation is ongoing. We can decide whether or not we want to accept the drop, or where to allow the drop.
---
-on prepare outline drop theObject data item dataItem drag info dragInfo child index childIndex
- -- By default we will set the drag operation to not be a drag operation
- set dragOperation to no drag operation
-
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
-
- -- Set the type of drag operation based on the drop operation and the state of the option key
- if "items" is in dataTypes then
- if option key down of event 1 then
- set dragOperation to copy drag operation
- else
- set dragOperation to move drag operation
- end if
- else if "file names" is in dataTypes then
- set dragOperation to copy drag operation
- end if
-
- -- Return the desired drag operation
- return dragOperation
-end prepare outline drop
-
--- This event handler is called when the drop happens.
---
-on accept outline drop theObject data item dataItem drag info dragInfo child index childIndex
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
- set dataSource to data source of theObject
-
- -- Turn off the updating of the views
- set update views of dataSource to false
-
- -- Set up the target data item (where we'll be placing the dropped items)
- if dataItem is missing value or childIndex = 0 or childIndex > (count of data items of dataItem) then
- set targetDataItem to missing value
- else
- set targetDataItem to data item childIndex of dataItem
- end if
-
- -- See if we are receiving our "items" in the drop
- if "items" is in dataTypes then
- -- We'll just use the list of dragged items we saved earlier, as it is easier than getting them from the pasteboard
- set draggedItems to dragged items of theObject
-
- -- Now move or duplicate the data items based on the option key
- if option key down of event 1 then
- repeat with i in draggedItems
- if dataItem is not missing value then
- if childIndex = 0 or childIndex > (count of data items of dataItem) then
- duplicate i to end of data items of dataItem
- else
- duplicate i to before dataItem
- end if
- else
- duplicate i to end of data items of dataSource
- end if
- end repeat
- else
- repeat with i in draggedItems
- if dataItem is not missing value then
- if childIndex = 0 or childIndex > (count of data items of dataItem) then
- move i to end of data items of dataItem
- else
- move i to before dataItem
- end if
- else
- move i to end of data items of dataSource
- end if
- end repeat
- end if
- else if "file names" is in dataTypes then
- -- Initialize the list of files to an empty list
- set theFiles to {}
-
- -- We want the data as a list of file names, so set the preferred type to "file names"
- set preferred type of pasteboard of dragInfo to "file names"
-
- -- Get the list of files from the pasteboard
- set theFiles to contents of pasteboard of dragInfo
-
- -- Make sure we have at least one item
- if (count of theFiles) > 0 then
- repeat with theItem in theFiles
- if targetDataItem is not missing value then
- set dataItem to make new data item at before targetDataItem
- else
- set dataItem to make new data item at end of data items of dataSource
- end if
-
- set contents of data cell "task" of dataItem to theItem
- end repeat
- end if
- end if
-
- -- Turn back on the updating of the views
- set update views of dataSource to true
-
- -- Make sure to return true, otherwise the drop will be cancelled.
- return true
-end accept outline drop
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* ==== Event Handlers ==== *)
-
-on action theObject
- set theResult to do shell script (contents of text field "input" of window "main" as string)
- set the contents of text view "output" of scroll view "output" of window "main" to theResult
- set needs display of text view "output" of scroll view "output" of window "main" to true
-end action
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Simple Table.applescript *)
-
-(* This is a very simple example of how to populate a table view using the "content" property. It also demonstrates how to add drag and drop support to allow both reordering and accepting external drops.
-*)
-
-
-(* ===== Event Handlers ===== *)
-
--- This event handler is attached to the table view in our nib. It is a good place to set the contents of the table view and to setup any drag types that we might desire.
---
-on awake from nib theObject
- -- Create the data source, data rows and data cells by simply setting the "content" property of the table view
- set content of theObject to {{"Work on outline example", "Yes"}, {"Make it plain and simple", "Yes"}, {"Put it all in an \"on launched\" event handler", "Yes"}, {"Put it in my iDisk when done", "Yes"}}
-
- -- Register for the "rows" and "file names" drag types
- tell theObject to register drag types {"rows", "file names"}
-end awake from nib
-
--- The launched handler is generally the last event handler to be called in the launch sequence. It's a good place for us to show our window.
---
-on launched theObject
- show window "main"
-end launched
-
--- This event handler is called whenever the user double clicks, edits and then leaves a cell in the table.
---
-on change cell value theObject table column tableColumn row theRow value theValue
- return theValue
-end change cell value
-
--- This event handler is called that the beginning of a drag operation in our table view
---
-on prepare table drag theObject drag rows dragRows pasteboard thePasteboard
- -- We are about to start a drag from within our table view, so set the preferred type of the pasteboard to be "rows" and then set the content of the pasteboard to be the rows being dragged
- set preferred type of thePasteboard to "rows"
- set content of thePasteboard to dragRows
-
- -- We need to return true here so that the drag will continue
- return true
-end prepare table drag
-
--- This event handler is called while the drag and drop operation is ongoing. We can decide whether or not we want to accept the drop, or where to allow the drop.
---
-on prepare table drop theObject drag info dragInfo row theRow drop operation dropOperation
- -- By default we will set the drag operation to not be a drag operation
- set dragOperation to no drag operation
-
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
-
- -- Set the type of drag operation based on the drop operation and the state of the option key
- if "rows" is in dataTypes then
- if dropOperation is 1 then
- if option key down of event 1 then
- set dragOperation to copy drag operation
- else
- set dragOperation to move drag operation
- end if
- end if
- else if "file names" is in dataTypes then
- if dropOperation is 1 then
- set dragOperation to copy drag operation
- end if
- end if
-
- -- Return the desired drag operation
- return dragOperation
-end prepare table drop
-
--- This event handler is called when the drop happens.
---
-on accept table drop theObject drag info dragInfo row theRow drop operation dropOperation
- -- Get the list of data types on the pasteboard
- set dataTypes to types of pasteboard of dragInfo
- set dataSource to data source of theObject
-
- -- Turn off the updating of the views
- set update views of dataSource to false
-
- -- Set up the target data row (where we'll be placing the dropped items)
- if theRow ² (count of data rows of dataSource) then
- set targetDataRow to data row theRow of dataSource
- else
- set targetDataRow to missing value
- end if
-
- -- See if we are accepting our own "rows" (reorder)
- if "rows" is in dataTypes then
- -- Get the list of row numbers
- set preferred type of pasteboard of dragInfo to "rows"
- set rowNumbers to contents of pasteboard of dragInfo
-
- -- We'll make a temporary list of the dragged data rows
- set dataRows to {}
- repeat with i in rowNumbers
- copy data row i of dataSource to end of dataRows
- end repeat
-
- -- Now move or duplicate the data rows based on the option key
- if option key down of event 1 then
- repeat with i in dataRows
- if targetDataRow is not missing value then
- duplicate i to before targetDataRow
- else
- duplicate i to end of data rows of dataSource
- end if
- end repeat
- else
- repeat with i in dataRows
- if targetDataRow is not missing value then
- move i to before targetDataRow
- else
- move i to end of data rows of dataSource
- end if
- end repeat
- end if
- else if "file names" is in dataTypes then
- -- Initialize the list of files to an empty list
- set theFiles to {}
-
- -- We want the data as a list of file names, so set the preferred type to "file names"
- set preferred type of pasteboard of dragInfo to "file names"
-
- -- Get the list of files from the pasteboard
- set theFiles to contents of pasteboard of dragInfo
-
- -- Make sure we have at least one item
- if (count of theFiles) > 0 then
- repeat with theItem in theFiles
- if targetDataRow is not missing value then
- set dataRow to make new data row at before targetDataRow
- else
- set dataRow to make new data row at end of data rows of dataSource
- end if
-
- set contents of data cell "task" of dataRow to theItem
- end repeat
-
- end if
- end if
-
- -- Turn back on the updating of the views
- set update views of dataSource to true
-
- -- Make sure to return true, otherwise the drop will be cancelled.
- return true
-end accept table drop
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Document.applescript *)
-
-(* This is a simple example of how to add a toolbar to a window. It also demonstrates how to respond to the user clicking on a toolbar item and how to enable or disable toolbar items.
-*)
-
-
-(* ===== Event Handlers ===== *)
-
--- These two event handlers are used to save and load the data for a document. For the purposes of this example, we will not be using them.
---
-on data representation theObject of type ofType
- (*Return the data that is to be stored in your document here.*)
-end data representation
-
-on load data representation theObject of type ofType with data withData
- (* The withData contains the data that was stored in your document that you provided in the "data representation" event handler. Return "true" if this was successful, or false if not.*)
- return true
-end load data representation
-
-
--- This event handler is attached to the table view in our nib. It is a good place to set the contents of the table view and to setup any drag types that we might desire.
---
-on awake from nib theObject
- -- Make the new toolbar, giving it a unique identifier
- set documentToolbar to make new toolbar at end with properties {name:"document toolbar", identifier:"document toolbar identifier", allows customization:true, auto sizes cells:true, display mode:default display mode, size mode:default size mode}
-
- -- Setup the allowed and default identifiers.
- set allowed identifiers of documentToolbar to {"compile item identifier", "run item identifier", "stop item identifier", "print item identifier", "customize toolbar item identifer", "flexible space item identifer", "space item identifier", "separator item identifier"}
- set default identifiers of documentToolbar to {"compile item identifier", "run item identifier", "stop item identifier"}
-
- --set selectable identifiers of documentToolbar to {}
-
- -- Create the toolbar items, adding them to the toolbar.
- make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"compile item identifier", name:"compile item", label:"Compile", palette label:"Compile", tool tip:"Compile", image name:"CompileScript"}
- make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"run item identifier", name:"run item", label:"Run", palette label:"Run", tool tip:"Run", image name:"RunScript"}
- make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"stop item identifier", name:"stop item", label:"Stop", palette label:"Stop", tool tip:"Stop", image name:"StopScript"}
-
- -- Assign our toolbar to the window
- set toolbar of theObject to documentToolbar
-end awake from nib
-
--- This event handler is called when the user clicks on one of the toolbar items
---
-on clicked toolbar item theObject
- if identifier of theObject is "compile item identifier" then
- display dialog "It's time to compile" attached to the front window
- end if
-end clicked toolbar item
-
--- This event handler is called whenever the state of the toolbar items needs to be changed.
---
-on update toolbar item theObject
- -- We return true in order to enable the toolbar item, otherwise we would return false
- return true
-end update toolbar item
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Simple Toolbar.applescript *)
-
-(* This is a simple example of how to add a toolbar to a window. It also demonstrates how to respond to the user clicking on a toolbar item and how to enable or disable toolbar items.
-*)
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* ==== Properties ==== *)
-
-global soapresult, readFile
-property SOAPEndpointURLParm : ""
-property SOAPActionPram : ""
-property MethodNamespaceURLPram : ""
-property MethodNamesPram : ""
-property ParametersPram : {}
-property ParametersPramRec : {}
-
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- set ButtonTitle to title of theObject
- if ButtonTitle = "Run" then
- set enabled of button "stop" of window "SOAPtalk" to true
- tell progress indicator "barberpole" of window "SOAPtalk" to start
- set the contents of text view "results" of scroll view 1 of window "SOAPtalk" to ""
- updateProperties()
- soapCallHandler()
- else if ButtonTitle = "Reset" then
- display dialog "Reset field?" buttons {"Cancel", "All", "Results"} default button "Results" --with icon stop --attached to window "SOAPtalk"
- set eraseresultswindbutton to text of button returned of result
- if eraseresultswindbutton = "Results" then
- set the contents of text view "results" of scroll view 1 of window "SOAPtalk" to ""
- else if eraseresultswindbutton = "All" then
- restFields()
- end if
- else if ButtonTitle = "" then
- open location "http://www.xmethods.com"
- else if ButtonTitle = "stop" then
- tell progress indicator "barberpole" of window "SOAPtalk" to stop
- set enabled of button "stop" of window "SOAPtalk" to false
- end if
-end clicked
-
-on changed theObject
- (*Add your script here.*)
-end changed
-
-on choose menu item theObject --menu item theItem
- set menuItemTitle to title of theObject as string
- if menuItemTitle = "Open..." then
- set SOAPReadFile to choose file with prompt "Please select a previously saved SOAPTalk file"
- set xRef to open for access SOAPReadFile
- set readFile to read xRef as list
- close access xRef
- updateFieldsFromFile()
- end if
- if menuItemTitle = "Save" then
- try
- updateProperties()
- set resultsfield to contents of text view "results" of scroll view 1 of window "SOAPtalk"
- set writeRecord to {SOAPEndpointURL:SOAPEndpointURLParm, SOAPAction:SOAPActionPram, MethodNamespaceURL:MethodNamespaceURLPram, MethodNames:MethodNamesPram, parameters:ParametersPram, soapresult:resultsfield}
- set saveFile to choose file name with prompt "Save File to" default name "SOAPTalk"
-
- set fileRef to open for access saveFile with write permission
- write writeRecord to fileRef as list
- close access fileRef
- on error errMsg
- try
- get fileRef
- close access fileRef
- display dialog errMsg
- end try
- end try
- end if
-end choose menu item
-
-
-(* ==== Handlers ==== *)
-
-on updateProperties()
- tell window "SOAPTalk"
- set SOAPEndpointURLParm to contents of text field "SOAPEndpointURL" --as application
- set SOAPActionPram to contents of text field "SOAPAction"
- set MethodNamespaceURLPram to contents of text field "MethodNamespaceURL"
- set MethodNamesPram to contents of text field "MethodNames"
- set ParametersPram to contents of text field "Parameters"
- set ParametersPramRec to run script ParametersPram -- convert string record into list record
- set soapresult to ""
- end tell
-end updateProperties
-
-on updateFieldsFromFile()
- tell window "SOAPTalk"
- set contents of text field "SOAPEndpointURL" to SOAPEndpointURL of item 1 of readFile
- set contents of text field "SOAPAction" to SOAPAction of item 1 of readFile
- set contents of text field "MethodNamespaceURL" to MethodNamespaceURL of item 1 of readFile
- set contents of text field "MethodNames" to MethodNames of item 1 of readFile
- set contents of text field "Parameters" to parameters of item 1 of readFile
- end tell
-end updateFieldsFromFile
-
-on restFields()
- tell window "SOAPTalk"
- set contents of text field "SOAPEndpointURL" to ""
- set contents of text field "SOAPAction" to ""
- set contents of text field "MethodNamespaceURL" to ""
- set contents of text field "MethodNames" to ""
- set contents of text field "Parameters" to ""
- set the contents of text view "results" of scroll view 1 to ""
- end tell
-end restFields
-
-on soapCallHandler()
- try
- using terms from application "http://www.apple.com"
- tell application (SOAPEndpointURLParm as string)
- set soapresult to call soap {method name:my getPlainText(MethodNamesPram), method namespace uri:my getPlainText(MethodNamespaceURLPram), parameters:ParametersPramRec, SOAPAction:my getPlainText(SOAPActionPram)}
- end tell
- end using terms from
-
- on error errMsg number errNum
- set the contents of text view "results" of scroll view 1 of window "SOAPtalk" to errMsg & " " & errNum & return & "Are you connected to the Internet?"
- tell progress indicator "barberpole" of window "SOAPtalk" to stop
- set enabled of button "stop" of window "SOAPtalk" to false
- end try
-
- set the contents of text view "results" of scroll view 1 of window "SOAPtalk" to soapresult as string
- tell progress indicator "barberpole" of window "SOAPtalk" to stop
- set enabled of button "stop" of window "SOAPtalk" to false
-end soapCallHandler
-
-on getPlainText(fromUnicodeString)
- set styledText to fromUnicodeString as string
- set styledRecord to styledText as record
- return Çclass ktxtÈ of styledRecord
-end getPlainText
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(*Application.applescript *)
-
-(* This script is used to exercise two (currently) workarounds. The first is to work around the bug in "load image" in that it won't open files outside of the project. The second is to enable "user defaults", which is Cocoa's method of reading/writing preferences for an application. *)
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "Open.." menu item is chosen.
---
-on choose menu item theObject
- -- Choose the image to be used in the image view
- set thePath to choose file with prompt "Select an Image"
-
- -- Call the workaround, making sure that path we pass is a posix path
- set theImage to call method "loadImage:" with parameter (POSIX path of thePath)
-
- -- Set the image of the image view to the one we loaded
- set image of image view "image" of window "main" to theImage
-end choose menu item
-
--- This event handler is called when the application is about done launching. We initialize the preferences and
-on will finish launching theObject
- -- Initialize the user defaults (only happens if the prefs don't exist)
- call method "registerDefaultObjects:forKeys:" with parameters {{"Text", 1, 0, 1, 1, {false, true}}, {"text", "number", "popup", "slider", "radio", "switches"}}
-end will finish launching
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(*Event Support.applescript *)
-
-(* This script is used to demonstrate how to access some of the properties of the 'event' class that is missing (not implemented) from AppleScript Studio 1.0. The properties that aren't working that are demonstrate here are: characters, command key down, control key down, option key down and shift key down. *)
-
-on keyboard up theObject event theEvent
- tell window of theObject
- -- characters
- set contents of text field "characters" to (call method "characters" of object theEvent) as string
-
- -- unmodified characters
- set contents of text field "unmodified characters" to (call method "charactersIgnoringModifiers" of object theEvent) as string
-
- -- command key down
- set state of button "command" to call method "isCommandKeyDownForEvent:" with parameter theEvent
-
- -- control key down
- set state of button "control" to call method "isControlKeyDownForEvent:" with parameter theEvent
-
- -- option key down
- set state of button "option" to call method "isOptionKeyDownForEvent:" with parameter theEvent
-
- -- shift key down
- set state of button "shift" to call method "isShiftKeyDownForEvent:" with parameter theEvent
- end tell
-end keyboard up
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(*Localized String.applescript *)
-
-(* This script is used to demonstrate a way to load a localized string from a '.strings' file. The Objective-C method that has been adde to this project is "localizedStringForKey:fromTable:" which takes two parameters. The first is the key in the .strings file (this is the string on the left hand side of the strings entry. The second is the name of the table (which is simply the name of the .strings file). Look in the "Localized.strings" file to see an example of the format for .strings file. *)
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- tell window of theObject
- if name of theObject is "open" then
- set contents of text field "output" to (call method "localizedStringForKey:fromTable:" with parameters {"OPEN_KEY", "Localized"})
- else if name of theObject is "close" then
- set contents of text field "output" to (call method "localizedStringForKey:fromTable:" with parameters {"CLOSE_KEY", "Localized"})
- end if
- end tell
-end clicked
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-
-(* Preferences.applescript *)
-
-(* This script shows an example of using the workaround for reading and writing user defaults. You can use a number, string, or array for objects to be stored in the defaults. *)
-
-(* ==== Properties ==== *)
-
-property preferencesWindow : null
-
-
-(* ==== Event Handlers ==== *)
-
--- This event handler is called when the "preferences" menu item is chosen.
---
-on choose menu item theObject
- -- Only load the preferences nib once
- if preferencesWindow is equal to null then
- load nib "Preferences"
- set preferencesWindow to window "preferences"
- end if
-
- -- Load in the preferences
- loadPreferences(preferencesWindow)
-
- -- Show the preferences window
- set visible of preferencesWindow to true
-end choose menu item
-
-
--- This event handler is called when either the "cancel" or "done" buttons are clicked.
---
-on clicked theObject
- if name of theObject is "done" then
- -- Save out the preferences
- storePreferences(preferencesWindow)
- end if
-
- -- Hide the preferences window
- set visible of preferencesWindow to false
-end clicked
-
-
-(* ==== Handlers ==== *)
-
--- This handler will read the preferences from the "Support.plist" in the ~/Library/Preferences directory and then sets those values in the UI elements.
---
-on loadPreferences(theWindow)
- -- Read in the preferences
- set theText to call method "defaultObjectForKey:" with parameter "text"
- set theNumber to call method "defaultObjectForKey:" with parameter "number"
- set thePopup to call method "defaultObjectForKey:" with parameter "popup"
- set theSlider to call method "defaultObjectForKey:" with parameter "slider"
- set theRadio to call method "defaultObjectForKey:" with parameter "radio"
- set theSwitches to call method "defaultObjectForKey:" with parameter "switches"
-
- -- Set the contents of the UI elements
- tell theWindow
- set contents of text field "text" to theText
- set contents of text field "number" to theNumber
- set contents of popup button "popup" to thePopup
- set contents of slider "slider" to theSlider
- set current row of matrix "radio" to theRadio
- set contents of button "show" to item 1 of theSwitches
- set contents of button "hide" to item 2 of theSwitches
- end tell
-end loadPreferences
-
--- This handler will get the values from the UI elements and store those values in the preferences file.
---
-on storePreferences(theWindow)
- -- Get the contents of the UI elements
- tell theWindow
- set theText to contents of text field "text"
- set theNumber to contents of text field "number"
- set thePopup to contents of popup button "popup"
- set theSlider to contents of slider "slider"
- set theRadio to current row of matrix "radio"
- set theSwitches to {contents of button "show", contents of button "hide"}
- end tell
-
- -- Write out the preferences
- call method "setDefaultObject:forKey:" with parameters {theText, "text"}
- call method "setDefaultObject:forKey:" with parameters {theNumber, "number"}
- call method "setDefaultObject:forKey:" with parameters {thePopup, "popup"}
- call method "setDefaultObject:forKey:" with parameters {theSlider, "slider"}
- call method "setDefaultObject:forKey:" with parameters {theRadio, "radio"}
- call method "setDefaultObject:forKey:" with parameters {theSwitches, "switches"}
-end storePreferences
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* WithDataSource.applescript *)
-
-(* This script is used to demonstrate the scripting of a table view using a data source that is connected to the table view in Interface Builder. Basically the data source has columns added in the "will open" event handler, the "data rows" are added/updated/removed as need from the data source. *)
-
-(* ==== Properties ==== *)
-
-property contactsDataSource : null
-
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- if name of theObject is equal to "add" then
- -- Add a new contact
- set theRow to make new data row at the end of the data rows of contactsDataSource
- getContactInfo(window of theObject, theRow)
-
- -- Clear out the contact information
- clearContactInfo(window of theObject)
- else if name of theObject is "update" then
- set tableView to table view "contacts" of scroll view "contacts" of window of theObject
- set selectedDataRows to selected data rows of tableView
- if (count of selectedDataRows) > 0 then
- -- Update the contact
- getContactInfo(window of theObject, item 1 of selectedDataRows)
-
- -- Tell the table view to update it's values
- tell tableView to update
- end if
- else if name of theObject is "remove" then
- set tableView to table view "contacts" of scroll view "contacts" of window of theObject
- set selectedDataRows to selected data rows of tableView
- if (count of selectedDataRows) > 0 then
- tell window of theObject
- -- Remove the contact form the data source
- delete (item 1 of selectedDataRows)
-
- -- Clear out the contact information
- my clearContactInfo(window of theObject)
- end tell
- end if
- end if
-end clicked
-
-on will open theObject
- -- Set up the contactDataSource so that the rest will be simpler
- set contactsDataSource to data source of table view "contacts" of scroll view "contacts" of theObject
-
- -- Here we will add the data columns to the data source of the contacts table view
- tell contactsDataSource
- make new data column at the end of the data columns with properties {name:"name"}
- make new data column at the end of the data columns with properties {name:"address"}
- make new data column at the end of the data columns with properties {name:"city"}
- make new data column at the end of the data columns with properties {name:"state"}
- make new data column at the end of the data columns with properties {name:"zip"}
- end tell
-end will open
-
-on selection changed theObject
- if name of theObject is "contacts" then
- set theWindow to window of theObject
-
- -- Set the contact index to the current row, so that we can use it to update the right contact later
- set selectedDataRows to selected data rows of theObject
-
- if (count of selectedDataRows) = 0 then
- -- There wasn't any selected so clear the contact information
- my clearContactInfo(theWindow)
-
- -- Disable the "Update" and "Remove" buttons
- set enabled of button "update" of theWindow to false
- set enabled of button "remove" of theWindow to false
- else
- -- A contact was selected, so show the contact information
- my setContactInfo(theWindow, item 1 of selectedDataRows)
-
- -- Enable the "Update" and "Remove" buttons
- set enabled of button "update" of theWindow to true
- set enabled of button "remove" of theWindow to true
- end if
- end if
-end selection changed
-
-
-(* ==== Contact Handlers ==== *)
-
--- Empty all of the text fields
---
-on clearContactInfo(theWindow)
- tell theWindow
- set contents of text field "name" to ""
- set contents of text field "address" to ""
- set contents of text field "city" to ""
- set contents of text field "state" to ""
- set contents of text field "zip" to ""
- set first responder to text field "name"
- end tell
-end clearContactInfo
-
--- Get the values from the text fields and set the cells in the the data row
---
-on getContactInfo(theWindow, theRow)
- tell theWindow
- set contents of data cell "name" of theRow to contents of text field "name"
- set contents of data cell "address" of theRow to contents of text field "address"
- set contents of data cell "city" of theRow to contents of text field "city"
- set contents of data cell "state" of theRow to contents of text field "state"
- set contents of data cell "zip" of theRow to contents of text field "zip"
- end tell
-end getContactInfo
-
--- Set the text fields with the values from the contact
---
-on setContactInfo(theWindow, theRow)
- tell theWindow
- set contents of text field "name" to contents of data cell "name" of theRow
- set contents of text field "address" to contents of data cell "address" of theRow
- set contents of text field "city" to contents of data cell "city" of theRow
- set contents of text field "state" to contents of data cell "state" of theRow
- set contents of text field "zip" to contents of data cell "zip" of theRow
- end tell
-end setContactInfo
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* WithoutDataSource.applescript *)
-
-(* This script is used to demonstrate the scripting of a table view without using a data source. The important part of supplying the table with information is in the "cell value" and "number of rows" event handlers. The table will query the script asking it for the number of rows, and then for every row of every column the "number of rows" event handler will be called, returning the contents of the cell for the table to display. *)
-
-(* ==== Properties ==== *)
-
-property contacts : {}
-property contactIndex : 0
-
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- if name of theObject is "add" then
- -- Add a new contact
- tell window of theObject
- -- Create a contact record from the values in the text fields and add it to the list of contacts
- set contacts to contacts & {my getContactInfo(window of theObject)}
-
- -- Tell the table view to update it's values
- tell table view "contacts" of scroll view "contacts" to update
-
- -- Clear out the contact information
- my clearContactInfo(window of theObject)
- end tell
-
- else if name of theObject is "update" then
- -- Update the contact
- tell window of theObject
- -- Update the contact information
- set item contactIndex of contacts to my getContactInfo(window of theObject)
-
- -- Tell the table view to update it's values
- tell table view "contacts" of scroll view "contacts" to update
- end tell
- else if name of theObject is "remove" then
- -- Remove the contact
- if contactIndex > 0 and contactIndex ² (count of contacts) then
- tell window of theObject
- -- Remove the contact form the list
- set contacts to my deleteItemInList(contactIndex, contacts)
-
- -- Tell the table view to update it's values
- tell table view "contacts" of scroll view "contacts" to update
-
- -- Clear out the contact information
- my clearContactInfo(window of theObject)
- end tell
- end if
- end if
-end clicked
-
--- Return the value of the specified column for the given row
---
-on cell value theObject row theRow table column theColumn
- -- Set the value to an empty string for now
- set theValue to ""
-
- -- Make sure that we aren't being asked for a row that is greater than the number of contacts
- if (count of contacts) ³ theRow then
- set theContact to item theRow of contacts
-
- -- Get the identifier of the column so that we can determine which field of the record to return
- set theID to identifier of theColumn
- if the theID is "name" then
- set theValue to name of theContact
- else if theID is "address" then
- set theValue to address of theContact
- else if theID is "city" then
- set theValue to city of theContact
- else if theID is "state" then
- set theValue to state of theContact
- else if theID is "zip" then
- set theValue to zip of theContact
- end if
- end if
-
- -- Now return the value that we set
- return theValue
-end cell value
-
--- Return the number of contacts
---
-on number of rows theObject
- return count of contacts
-end number of rows
-
-on selection changed theObject
- if name of theObject is "contacts" then
- set theWindow to window of theObject
-
- -- Set the contact index to the current row, so that we can use it to update the right contact later
- set contactIndex to selected row of theObject
-
- if contactIndex = 0 then
- -- There wasn't any selected so clear the contact information
- my clearContactInfo(theWindow)
-
- -- Disable the "Update" and "Remove" buttons
- set enabled of button "update" of theWindow to false
- set enabled of button "remove" of theWindow to false
- else
- -- A contact was selected, so show the contact information
- my setContactInfo(theWindow, item contactIndex of contacts)
-
- -- Enable the "Update" and "Remove" buttons
- set enabled of button "update" of theWindow to true
- set enabled of button "remove" of theWindow to true
- end if
- end if
-end selection changed
-
-
-(* ==== Contact Handlers ==== *)
-
--- Empty all of the text fields
---
-on clearContactInfo(theWindow)
- tell theWindow
- set contents of text field "name" to ""
- set contents of text field "address" to ""
- set contents of text field "city" to ""
- set contents of text field "state" to ""
- set contents of text field "zip" to ""
- set first responder to text field "name"
- end tell
-end clearContactInfo
-
--- Get the values from the text fields and return a contact record
---
-on getContactInfo(theWindow)
- tell theWindow
- return {name:contents of text field "name", address:contents of text field "address", city:contents of text field "city", state:contents of text field "state", zip:contents of text field "zip"}
- end tell
-end getContactInfo
-
--- Set the text fields with the values from the contact
---
-on setContactInfo(theWindow, theContact)
- tell theWindow
- set contents of text field "name" to name of theContact
- set contents of text field "address" to address of theContact
- set contents of text field "city" to city of theContact
- set contents of text field "state" to state of theContact
- set contents of text field "zip" to zip of theContact
- end tell
-end setContactInfo
-
-(* ==== Utilities ==== *)
-
-on deleteItemInList(x, theList)
- set x to (x as number)
- if x < 1 then return theList
- set numItems to count of items in theList
- if numItems is 1 then return {}
- if x > numItems then return theList
- if x = 1 then
- set newList to (items 2 thru -1 of theList)
- else if x = numItems then
- set newList to (items 1 thru -2 of theList)
- else
- set newList to (items 1 thru (x - 1) of theList) & (items (x + 1) thru -1 of theList)
- end if
- return newList
-end deleteItemInList
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Table Reorder.applescript *)
-
-(* This example populates a table view using the "content" property and then uses the "allows reordering" property of the table and outline views to enable the automatic support of drag and drop to reorder data rows.
-*)
-
-
-(* ===== Event Handlers ===== *)
-
--- This event handler is attached to the table view and is a good place to setup our data source.
---
-on awake from nib theObject
- -- Setup the data source, data rows and data cells simply by setting the "content" property of the table view.
- set content of theObject to {{|property|:"Zoomed", include:true}, {|property|:"Miniaturized", include:true}, {|property|:"Floating", include:false}, {|property|:"Modal", include:false}, {|property|:"Visible", include:true}, {|property|:"Closeable", include:true}, {|property|:"Resizable", include:true}, {|property|:"Zoomable", include:true}, {|property|:"Titled", include:true}}
-end awake from nib
-
--- This event handler is called when the user clicks on the check box.
---
-on clicked theObject
- set allows reordering of table view "table" of scroll view "scroll" of window of theObject to state of theObject
-end clicked
-
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Table Sort.applescript *)
-
-(* This example demonstrates how easy it is to add sorting to your tables. In the example, you can click on different columns to sort on that column. Clicking more than once in the same column changes the sort order of that column. *)
-
-(* ==== Properties ==== *)
-
-property tableData : {{|name|:"Bart Simpson", city:"Springfield", zip:"19542", age:12}, {|name|:"Ally McBiel", city:"Chicago", zip:"91544", age:28}, {|name|:"Joan of Ark", city:"Paris", zip:"53255", age:36}, {|name|:"King Tut", city:"Egypt", zip:"00245", age:45}, {|name|:"James Taylor", city:"Atlanta", zip:"21769", age:42}}
-
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" event handler is attached to the table view. It will be called when the table view is loaded from the nib. It's a good place to create our data source and set up the data columns.
---
-on awake from nib theObject
- -- Create the data source
- set theDataSource to make new data source at end of data sources with properties {name:"names"}
-
- -- Create each of the data columns, including the sort information for each column
- make new data column at end of data columns of theDataSource with properties {name:"name", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
- make new data column at end of data columns of theDataSource with properties {name:"city", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
- make new data column at end of data columns of theDataSource with properties {name:"zip", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
- make new data column at end of data columns of theDataSource with properties {name:"age", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}
-
- -- Make this a sorted data source
- set sorted of theDataSource to true
-
- -- Set the "name" data column as the sort column
- set sort column of theDataSource to data column "name" of theDataSource
-
- -- Set the data source of the table view to the new data source
- set data source of theObject to theDataSource
-
- -- Add the table data (using the new "append" command)
- append theDataSource with tableData
-end awake from nib
-
-
--- The "launched" event handler is attached to the application object ("File's Owner of MainMenu.nib"). It is called towards the end of the startup sequence.
---
-on launched theObject
- -- Show the main window
- show window "main"
-end launched
-
-
--- The "column clicked" event handler is called when the user clicks on a table column in the table view. We will use this handler to change the sort column of the data source as well as the sort order.
---
-on column clicked theObject table column tableColumn
- -- Get the data source of the table view
- set theDataSource to data source of theObject
-
- -- Get the identifier of the clicked table column
- set theColumnIdentifier to identifier of tableColumn
-
- -- Get the current sort column of the data source
- set theSortColumn to sort column of theDataSource
-
- -- If the current sort column is not the same as the clicked column then switch the sort column
- if (name of theSortColumn) is not equal to theColumnIdentifier then
- set the sort column of theDataSource to data column theColumnIdentifier of theDataSource
- else
- -- Otherwise change the sort order
- if sort order of theSortColumn is ascending then
- set sort order of theSortColumn to descending
- else
- set sort order of theSortColumn to ascending
- end if
- end if
-
- -- We need to update the table view (so it will be redrawn)
- update theObject
-end column clicked
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* ==== Event Handlers ==== *)
-
-on will open theObject
- set movie of movie view "movie" of window "main" to load movie "jumps"
-end will open
-
-on choose menu item theMenuItem
- tell window "main"
- set theCommand to tag of theMenuItem
-
- if theCommand is equal to 1001 then
- set moviePath to choose file
- set movie file of movie view "movie" to moviePath
- else if theCommand is equal to 1002 then
- tell movie view "movie" to play
- else if theCommand is equal to 1003 then
- tell movie view "movie" to stop
- else if theCommand is equal to 1004 then
- tell movie view "movie" to step forward
- else if theCommand is equal to 1005 then
- tell movie view "movie" to step back
- else if theCommand is equal to 1006 then
- tell movie view "movie" to go to beginning frame
- else if theCommand is equal to 1007 then
- tell movie view "movie" to go to end frame
- else if theCommand is equal to 1008 then
- tell movie view "movie" to go to poster frame
- else if theCommand is equal to 1009 then
- set loop mode of movie view "movie" to normal playback
- else if theCommand is equal to 1010 then
- set loop mode of movie view "movie" to looping playback
- else if theCommand is equal to 1011 then
- set loop mode of movie view "movie" to looping back and forth playback
- end if
- end tell
-end choose menu item
-
-on update menu item theMenuItem
- tell window "main"
- local enableItem
- set enableItem to 1
-
- set theCommand to tag of theMenuItem
- set thePlayBack to loop mode of movie view "movie"
-
- if theCommand is equal to 1002 then
- if playing of movie view "movie" is true then set enableItem to 0
- else if theCommand is equal to 1003 then
- if playing of movie view "movie" is false then set enableItem to 0
- else if theCommand ³ 1009 and theCommand ² 1011 then
- set theState to 0
-
- if thePlayBack is equal to normal playback and theCommand is equal to 1009 then set theState to 1
- if thePlayBack is equal to looping playback and theCommand is equal to 1010 then set theState to 1
- if thePlayBack is equal to looping back and forth playback and theCommand is equal to 1011 then set theState to 1
-
- set state of theMenuItem to theState
- end if
- end tell
-
- return enableItem
-end update menu item
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Document.applescript *)
-
-(* This is a good example of several different features of AppleScript Studio. The main one is to demonstrate how to write a document bases application using the higher level handlers "data representation" and "load data representation" (as opposed to the lower level handlers "write to file" and "read from file". It also demonstrates how to work with a table view (including support for sorting). Menu Item handling is also included in this example. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "awake from nib" handler is called (in this example) when the table view is loaded from the "Documents.nib" nib file. This is a good place to create a new data source and data columns and set various properties of said items.
---
-on awake from nib theObject
- if name of theObject is "tasks" then
- -- Create the data source for our "tasks" table view
- set theDataSource to make new data source at end of data sources with properties {name:"tasks"}
-
- -- Create the data columns, "priority", "task" and "status". We also set the sort properties of each of the data columns, including the sort order, the type of data in each column and what type of sensitivity to use.
- make new data column at end of data columns of theDataSource with properties {name:"priority", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}
- make new data column at end of data columns of theDataSource with properties {name:"task", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
- make new data column at end of data columns of theDataSource with properties {name:"status", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
-
- -- Set the data source as sorted
- set sorted of theDataSource to true
-
- -- Set the "priority" data column as the sort column
- set sort column of theDataSource to data column "priority" of theDataSource
-
- -- Finally, assign the data source of the table view to our data source
- set data source of theObject to theDataSource
- end if
-end awake from nib
-
-
--- The "action" event handler is called whenever the user chooses a menu in the popup buttons or presses (in this example) the enter key in the text field.
---
-on action theObject
- -- Set some local variables to various objects in the UI
- set theWindow to window of theObject
- set theTableView to table view "tasks" of scroll view "tasks" of theWindow
- set theDataSource to data source of theTableView
-
- -- The behavior from here will be determined by whether or not an task in the table view is selected
- if (count of selected rows of theTableView) is 0 then
- -- Since nothing is selected we will create a new task (but only if the enter key is pressed in the "task" text field)
- if name of theObject is "task" then
- -- Make a new data row
- set theTask to make new data row at end of data rows of theDataSource
-
- -- Populate the task using values in the UI
- setTaskValuesWithUIValues(theTask, theWindow)
-
- -- Now set the UI to default values
- setDefaultUIValues(theWindow)
-
- -- Make the "task" text field the object with the focus so that it will be ready for typing
- set first responder of theWindow to text field "task" of theWindow
- end if
- else
- -- Get the selected task from the table view
- set theTask to selected data row of theTableView
-
- -- See which object was touched
- if name of theObject is "priority" then
- set contents of data cell "priority" of theTask to title of theObject
- else if name of theObject is "task" then
- set contents of data cell "task" of theTask to content of theObject
- else if name of theObject is "status" then
- set contents of data cell "status" of theTask to title of theObject
- end if
- end if
-end action
-
-
-(* ==== Document Event Handlers ==== *)
-
--- The "data representation" event handler is called when the document needs to be saved. It is the responsiblity of the handler to return the data that is to be saved. This can be nearly any AppleScript object, whether it be a string, a list, a record, etc. In this case we are going to return a record that contains the list of tasks, the name of the current sort column and the sort order of the current sort column.
---
-on data representation theObject of type ofType
- -- Set some local variables to various objects in the UI
- set theWindow to window 1 of theObject
- set theDataSource to data source of table view "tasks" of scroll view "tasks" of theWindow
- set theTasks to contents of every data cell of every data row of theDataSource
- set theSortColumn to sort column of theDataSource
-
- -- Create our record containing the list of tasks (just a list of lists), the name of the sort column and the sort order.
- set theData to {tasks:theTasks, sortColumnName:name of theSortColumn, sortColumnOrder:sort order of theSortColumn}
-
- return theData
-end data representation
-
-
--- The "load data representation" event handler is called when the document is being loaded. The data that you provided in the "data representation" event handler is passed to you in the "theData" parameter.
---
-on load data representation theObject of type ofType with data theData
- -- Set some local variables to various objects in the UI
- set theWindow to window 1 of theObject
- set theDataSource to data source of table view "tasks" of scroll view "tasks" of theWindow
-
- -- Restore the sort column and sort order of the data source based on the information saved
- set sort column of theDataSource to data column (sortColumnName of theData) of theDataSource
- set sort order of sort column of theDataSource to (sortColumnOrder of theData)
-
- -- Use the "append" verb to quickly populate the data source with the list of tasks
- append the theDataSource with (tasks of theData)
-
- -- We return true, signaling that everything worked correctly. If you return "false" then the document will fail to load and an alert will be presented.
- return true
-end load data representation
-
-
-(* ==== Data View Event Handlers ==== *)
-
--- The "selection changing" event handler is called whenever the selection in the table view is changing. We will use this to update the values in the UI based on the selection.
---
-on selection changing theObject
- if name of theObject is "tasks" then
- -- If there is a selection then we'll update the UI, otherwise we set the UI to default values
- if (count of selected rows of theObject) > 0 then
- -- Get the selected data row of the table view
- set theTask to selected data row of theObject
-
- -- Update the UI using the selected task
- setUIValuesWithTaskValues(window of theObject, theTask)
- else
- -- Set the UI to default values
- setDefaultUIValues(window of theObject)
- end if
- end if
-end selection changing
-
-
--- The "selection changing" event handler is called whenever the selection in the table view is changing. We will use this to update the values in the UI based on the selection.
---
-on selection changed theObject
- if name of theObject is "tasks" then
- -- If there is a selection then we'll update the UI, otherwise we set the UI to default values
- if (count of selected rows of theObject) > 0 then
- -- Get the selected data row of the table view
- set theTask to selected data row of theObject
-
- -- Update the UI using the selected task
- setUIValuesWithTaskValues(window of theObject, theTask)
- else
- -- Set the UI to default values
- setDefaultUIValues(window of theObject)
- end if
- end if
-end selection changed
-
-
--- The "column clicked" event handler is called whenever the user clickes on a column in the table view. We will change the sort state based on the column clicked. This event handler can be used as is in most applications when utilizing the sort support built into data sources.
---
-on column clicked theObject table column tableColumn
- -- Get the data source of the table view
- set theDataSource to data source of theObject
-
- -- Get the name of the clicked table column
- set theColumnName to name of tableColumn
-
- -- Get the current sort column of the data source
- set theSortColumn to sort column of theDataSource
-
- -- If the current sort column is not the same as the clicked column then switch the sort column
- if (name of theSortColumn) is not equal to theColumnName then
- set the sort column of theDataSource to data column theColumnName of theDataSource
- else
- -- Otherwise change the sort order
- if sort order of theSortColumn is ascending then
- set sort order of theSortColumn to descending
- else
- set sort order of theSortColumn to ascending
- end if
- end if
-
- -- We need to update the table view (so it will be redrawn)
- update theObject
-end column clicked
-
-
-(* ==== Menu Item Event Handlers ==== *)
-
--- The "choose menu item" is called (in this example) whenever the user chooses one of the "New Task, Duplicate Task, and Delete Task" menu items.
---
-on choose menu item theObject
- -- Set some local variables to various objects in the UI
- set theWindow to front window
- set theTableView to table view "tasks" of scroll view "tasks" of theWindow
- set theDataSource to data source of theTableView
-
- if name of theObject is "new" then
- -- New Task
- set theTask to make new data row at end of data rows of theDataSource
-
- -- Set the UI to default values
- setDefaultTaskValues(theTask)
-
- -- Select the newly added task
- set selected data row of theTableView to theTask
-
- -- Make the "task" text field the object with the focus so that it will be ready for typing
- set first responder of theWindow to text field "task" of theWindow
- else if name of theObject is "duplicate" then
- -- Duplicate Task (only if there is a task selected in the table view)
- if (count of selected data rows of theTableView) > 0 then
- -- Get the selected task
- set theTask to selected data row of theTableView
-
- -- Make a new task and copy the values from the selected one to the new one. (There is a bug in the copy of a data row such that you can't simply say "copy theTask to end of data rows of theDataSource").
- set newTask to make new data row at end of data rows of theDataSource
- set contents of data cell "priority" of newTask to contents of data cell "priority" of theTask
- set contents of data cell "task" of newTask to contents of data cell "task" of theTask
- set contents of data cell "status" of newTask to contents of data cell "status" of theTask
- end if
- else if name of theObject is "delete" then
- -- Delete Task
- if (count of selected data rows of theTableView) > 0 then
- -- Get the selected task
- set theTask to selected data row of theTableView
-
- -- Delete it
- delete theTask
- end if
- end if
-end choose menu item
-
-
--- The "update menu item" is called whenever the status of any the "Task" menu items need to be updated (for instance when the user clicks on the "Edit" menu where these menu items are).
---
-on update menu item theObject
- -- By default we will enable each of these items
- if front window exists then
- set shouldEnable to true
-
- -- Set some local variables to various objects in the UI
- set theWindow to front window
- set theTableView to table view "tasks" of scroll view "tasks" of theWindow
- set theDataSource to data source of theTableView
-
- if name of theObject is "duplicate" then
- -- If there isn't a task selected disable the "Duplicate Task" menu item
- if (count of selected data rows of theTableView) is 0 then
- set shouldEnable to false
- end if
- else if name of theObject is "delete" then
- -- If there isn't a task selected disable the "Delete Task" menu item
- if (count of selected data rows of theTableView) is 0 then
- set shouldEnable to false
- end if
- end if
- else
- set shouldEnable to false
- end if
-
- -- Return out enable state
- return shouldEnable
-end update menu item
-
-
-(* ==== Handlers ==== *)
-
--- This handler will set the default values of a new task
---
-on setDefaultTaskValues(theTask)
- set contents of data cell "priority" of theTask to "3"
- set contents of data cell "task" of theTask to ""
- set contents of data cell "status" of theTask to "Not Started"
-end setDefaultTaskValues
-
--- This handler will set the default values of UI
---
-on setDefaultUIValues(theWindow)
- tell theWindow
- set title of popup button "priority" to "3"
- set contents of text field "task" to ""
- set title of popup button "status" to "Not Started"
- end tell
-end setDefaultUIValues
-
--- This handler will set the values of the given task using the values in the UI
---
-on setTaskValuesWithUIValues(theTask, theWindow)
- set contents of data cell "priority" of theTask to title of popup button "priority" of theWindow
- set contents of data cell "task" of theTask to contents of text field "task" of theWindow
- set contents of data cell "status" of theTask to title of popup button "status" of theWindow
-end setTaskValuesWithUIValues
-
--- This handler will set the values of the UI using the given task
---
-on setUIValuesWithTaskValues(theWindow, theTask)
- set title of popup button "priority" of theWindow to contents of data cell "priority" of theTask
- set contents of text field "task" of theWindow to contents of data cell "task" of theTask
- set title of popup button "status" of theWindow to contents of data cell "status" of theTask
-end setUIValuesWithTaskValues
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Application.applescript *)
-
-(* ==== Globals ==== *)
-
-global converterLib
-global logLib
-global LogController
-global Converter
-global LengthConverter
-global WeightConverter
-global LiquidVolumeConverter
-global VolumeConverter
-global AreaConverter
-global TemperatureConverter
-
-
-(* ==== Properties ==== *)
-
-property currentConverter : 0
-property scriptsLoaded : false
-
-
-(* ==== Event Handlers ==== *)
-
-on clicked theObject
- tell window "Main"
- if theObject is equal to button "Convert" of box 1 then
- my convert()
- else if the theObject is equal to button "Drawer" then
- if state of drawer "Log" is drawer closed then
- tell drawer "Log" to open drawer on bottom edge
- else
- tell drawer "Log" to close drawer
- end if
- else if the theObject is equal to button "Clear" of box 1 of drawer "Log" then
- tell LogController to clearLog()
- else if the theObject is equal to button "Save As" of box 1 of drawer "Log" then
- set logFile to choose file name with prompt "Save Log As" default name "Conversion Results.txt"
- tell LogController to saveLogInFile(logFile)
- end if
- end tell
-end clicked
-
-on choose menu item theObject
- tell window "Main"
- if theObject is equal to popup button "Type" of box 1 then
- set currentConverter to my getConverterForType(title of popup button "Type" of box 1)
- tell currentConverter to updateUnitTypes()
- else
- my convert()
- end if
- end tell
-end choose menu item
-
-on action theObject
- if theObject is equal to text field "Value" of box 1 of window "Main" then
- my convert()
- end if
-end action
-
-on launched theObject
- my loadScripts()
- tell LogController to initialize()
- set currentConverter to my getConverterForType(title of popup button "Type" of box 1 of window "Main")
-
- set visible of window "Main" to true
-end launched
-
-
-(* ==== Handlers ==== *)
-
-on convert()
- if contents of text field "Value" of box 1 of window "Main" is equal to "" then
- display alert "You must enter a value to convert." as critical attached to window "Main"
- else
- tell currentConverter to convert()
- end if
-end convert
-
-on getConverterForType(typeName)
- if typeName is equal to "length" then
- return LengthConverter
- else if typeName is equal to "weight and mass" then
- return WeightConverter
- else if typeName is equal to "liquid volume" then
- return LiquidVolumeConverter
- else if typeName is equal to "volume" then
- return VolumeConverter
- else if typeName is equal to "area" then
- return AreaConverter
- else if typeName is equal to "temperature" then
- return TemperatureConverter
- else
- return Converter
- end if
-end getConverterForType
-
-on pathToScripts()
- set appPath to (path to me from user domain) as text
- return (appPath & "Contents:Resources:Scripts:") as text
-end pathToScripts
-
-on loadScript(scriptName)
- return load script file (my pathToScripts() & scriptName & ".scpt")
-end loadScript
-
-on loadScripts()
- set logLib to my loadScript("Log Controller")
- set converterLib to my loadScript("Converter")
-
- set LogController to LogController of logLib
- set Converter to Converter of converterLib
- set LengthConverter to LengthConverter of converterLib
- set WeightConverter to WeightConverter of converterLib
- set LiquidVolumeConverter to LiquidVolumeConverter of converterLib
- set VolumeConverter to VolumeConverter of converterLib
- set AreaConverter to AreaConverter of converterLib
- set TemperatureConverter to TemperatureConverter of converterLib
-end loadScripts
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Converter.applescript *)
-
-(* ==== Globals ==== *)
-
-global LogController
-
-
-(* ==== Scripts ==== *)
-
-script Converter
- property measureType : ""
- property fromMeasure : ""
- property toMeasure : ""
- property fromUnits : 0
- property resultUnits : 0
- property unitTypes : {}
-
- on initializeUnitTypes()
- end initializeUnitTypes
-
- on convert()
- tell box 1 of window "Main"
- set measureType to title of popup button "Type"
- set fromMeasure to title of popup button "From"
- set toMeasure to title of popup button "To"
- set fromUnits to contents of text field "Value" as real
- set resultUnits to 0
- end tell
- end convert
-
- on updateUnitTypes()
- tell box 1 of window "Main"
- -- Delete all of the menu items from the popups
- delete every menu item of menu of popup button "From"
- delete every menu item of menu of popup button "To"
-
- -- Add each of the unit types as menu items to both of the popups
- repeat with i in my unitTypes
- make new menu item at the end of menu items of menu of popup button "From" with properties {title:i, enabled:true}
- make new menu item at the end of menu items of menu of popup button "To" with properties {title:i, enabled:true}
- end repeat
- end tell
- end updateUnitTypes
-
- on updateObject(theObject)
- end updateObject
-
- on updateResult(theResult)
- set contents of text field "Result" of box 1 of window "Main" to (theResult as text)
- tell LogController to addResultToLog((fromUnits as text) & " " & fromMeasure & " equals " & (theResult as text) & " " & toMeasure)
- end updateResult
-end script
-
-script LengthConverter
- property parent : Converter
- property unitTypes : {"kilometers", "meters", "centimeters", "miles", "yards", "feet", "inches"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "kilometers" then
- set my resultUnits to my fromUnits as kilometers
- else if my fromMeasure = "meters" then
- set my resultUnits to my fromUnits as meters
- else if my fromMeasure = "centimeters" then
- set my resultUnits to my fromUnits as centimeters
- else if my fromMeasure = "miles" then
- set my resultUnits to my fromUnits as miles
- else if my fromMeasure = "yards" then
- set my resultUnits to my fromUnits as yards
- else if my fromMeasure = "feet" then
- set my resultUnits to my fromUnits as feet
- else if my fromMeasure = "inches" then
- set my resultUnits to my fromUnits as inches
- end if
-
- if my toMeasure = "kilometers" then
- set my resultUnits to my resultUnits as kilometers
- else if my toMeasure = "meters" then
- set my resultUnits to my resultUnits as meters
- else if my toMeasure = "centimeters" then
- set my resultUnits to my resultUnits as centimeters
- else if my toMeasure = "miles" then
- set my resultUnits to my resultUnits as miles
- else if my toMeasure = "yards" then
- set my resultUnits to my resultUnits as yards
- else if my toMeasure = "feet" then
- set my resultUnits to my resultUnits as feet
- else if my toMeasure = "inches" then
- set my resultUnits to my resultUnits as inches
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-script WeightConverter
- property parent : Converter
- property unitTypes : {"kilograms", "grams", "pounds", "ounces"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "kilograms" then
- set my resultUnits to my fromUnits as kilograms
- else if my fromMeasure = "grams" then
- set my resultUnits to my fromUnits as grams
- else if my fromMeasure = "pounds" then
- set my resultUnits to my fromUnits as pounds
- else if my fromMeasure = "ounces" then
- set my resultUnits to my fromUnits as ounces
- end if
-
- if my toMeasure = "kilograms" then
- set my resultUnits to my resultUnits as kilograms
- else if my toMeasure = "grams" then
- set my resultUnits to my resultUnits as grams
- else if my toMeasure = "pounds" then
- set my resultUnits to my resultUnits as pounds
- else if my toMeasure = "ounces" then
- set my resultUnits to my resultUnits as ounces
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-script LiquidVolumeConverter
- property parent : Converter
- property unitTypes : {"liters", "gallons", "quarts"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "liters" then
- set my resultUnits to my fromUnits as liters
- else if my fromMeasure = "gallons" then
- set my resultUnits to my fromUnits as gallons
- else if my fromMeasure = "quarts" then
- set my resultUnits to my fromUnits as quarts
- end if
-
- if my toMeasure = "liters" then
- set my resultUnits to my resultUnits as liters
- else if my toMeasure = "gallons" then
- set my resultUnits to my resultUnits as gallons
- else if my toMeasure = "quarts" then
- set my resultUnits to my resultUnits as quarts
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-script VolumeConverter
- property parent : Converter
- property unitTypes : {"cubic centimeters", "cubic meters", "cubic inches", "cubic feet", "cubic yards"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "cubic centimeters" then
- set my resultUnits to my fromUnits as cubic centimeters
- else if my fromMeasure = "cubic meters" then
- set my resultUnits to my fromUnits as cubic meters
- else if my fromMeasure = "cubic inches" then
- set my resultUnits to my fromUnits as cubic inches
- else if my fromMeasure = "cubic feet" then
- set my resultUnits to my fromUnits as cubic feet
- else if my fromMeasure = "cubic yards" then
- set my resultUnits to my fromUnits as cubic yards
- end if
-
- if my toMeasure = "cubic centimeters" then
- set my resultUnits to my resultUnits as cubic centimeters
- else if my toMeasure = "cubic meters" then
- set my resultUnits to my resultUnits as cubic meters
- else if my toMeasure = "cubic inches" then
- set my resultUnits to my resultUnits as cubic inches
- else if my toMeasure = "cubic feet" then
- set my resultUnits to my resultUnits as cubic feet
- else if my toMeasure = "cubic yards" then
- set my resultUnits to my resultUnits as cubic yards
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-script AreaConverter
- property parent : Converter
- property unitTypes : {"square meters", "square kilometers", "square feet", "square yards", "square miles"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "square meters" then
- set my resultUnits to my fromUnits as square meters
- else if my fromMeasure = "square kilometers" then
- set my resultUnits to my fromUnits as square kilometers
- else if my fromMeasure = "square feet" then
- set my resultUnits to my fromUnits as square feet
- else if my fromMeasure = "square yards" then
- set my resultUnits to my fromUnits as square yards
- else if my fromMeasure = "square miles" then
- set my resultUnits to my fromUnits as square miles
- else if my fromMeasure = "feet" then
- set my resultUnits to my fromUnits as feet
- else if my fromMeasure = "inches" then
- set my resultUnits to my fromUnits as inches
- end if
-
- if my toMeasure = "square meters" then
- set my resultUnits to my resultUnits as square meters
- else if my toMeasure = "square kilometers" then
- set my resultUnits to my resultUnits as square kilometers
- else if my toMeasure = "square feet" then
- set my resultUnits to my resultUnits as square feet
- else if my toMeasure = "square yards" then
- set my resultUnits to my resultUnits as square yards
- else if my toMeasure = "square miles" then
- set my resultUnits to my resultUnits as square miles
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-script TemperatureConverter
- property parent : Converter
- property unitTypes : {"degrees Fahrenheit", "degrees Celsius", "degrees Kelvin"}
-
- on convert()
- continue convert()
-
- if my fromMeasure = "degrees Fahrenheit" then
- set my resultUnits to my fromUnits as degrees Fahrenheit
- else if my fromMeasure = "degrees Celsius" then
- set my resultUnits to my fromUnits as degrees Celsius
- else if my fromMeasure = "degrees Kelvin" then
- set my resultUnits to my fromUnits as degrees Kelvin
- end if
-
- if my toMeasure = "degrees Fahrenheit" then
- set my resultUnits to my resultUnits as degrees Fahrenheit
- else if my toMeasure = "degrees Celsius" then
- set my resultUnits to my resultUnits as degrees Celsius
- else if my toMeasure = "degrees Kelvin" then
- set my resultUnits to my resultUnits as degrees Kelvin
- end if
-
- my updateResult(my resultUnits)
- end convert
-end script
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Log Controller.applescript *)
-
-(* ==== Scripts ==== *)
-
-script LogController
- property initialized : false
-
- on initialize()
- if initialized is equal to false then
- set leading offset of drawer "Log" of window "Main" to 20
- set trailing offset of drawer "Log" of window "Main" to 20
- set initialized to true
- end if
-
- my clearLog()
- end initialize
-
- on addResultToLog(theResult)
- tell scroll view 1 of drawer "Log" of window "Main"
- set prevResult to contents of text view "Log"
- if prevResult is equal to return or prevResult is equal to "" then
- set contents of text view "Log" to theResult
- else
- set contents of text view "Log" to prevResult & return & theResult
- end if
- end tell
- end addResultToLog
-
- on clearLog()
- set contents of text view "Log" of scroll view 1 of drawer "Log" of window "Main" to ""
- end clearLog
-
- on saveLogInFile(logFile)
- open for access logFile with write permission
- set logText to contents of text view "Log" of scroll view 1 of drawer "Log" of window "Main" as string
- write logText to logFile
- close access logFile
- end saveLogInFile
-
-end script
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* Service Detail.applescript *)
-
-(* This script is used to handle events in the "Service Detail" window. *)
-
-(* ==== Event Handlers ==== *)
-
--- The "clicked" event handler is called whenever the user clicks on the buttons in the detail window.
---
-on clicked theObject
- if name of theObject is "mail" then
- -- Use the "open location" command to send an email
- set theServiceName to contents of text field "name" of window of theObject
- set theEmailAddress to contents of text field "email" of window of theObject
-
- open location "mailto: " & theEmailAddress
- else if name of theObject is "info site" then
- -- Open the information site for this service
- set theURL to contents of text field "info url" of window of theObject
- open location theURL
- else if name of theObject is "wsdl site" then
- -- Open the WSDL for this service
- set theURL to contents of text field "wsdl url" of window of theObject
- open location theURL
- end if
-end clicked
-
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-(* XMethods Service Finder.applescript *)
-
-(* This is an example that demonstrates how to use Web Services. It utilizes a service from XMethods.org that provides information about all of the services available at their site. It also demonstrates how to create and use data sources for a table view. *)
-
-(* The strategy used in this script is to populate the "services" list with all of the services avialable (which is also used to populate the "all services" data source. Then whenever a "find" is requested, the "found services" list is filled out the listing found in the "services" list, and then a new temporary data source is created, using the "found services" list to populate it. That data source is then set as the current data source of the table. If the user deletes the search text field, then the data rows of the "found services" data source are removed and the "all services" data source is set to be the current data source of the table view. In essence, it's just a matter of switching in and out the "all services" and "found services" data sources according to the actions of the user. *)
-
-(* ==== Properties ==== *)
-
-property services : {}
-property foundServices : {}
-property servicesTableView : missing value
-property detailWindow : missing value
-
-
-(* ==== Event Handlers ==== *)
-
--- The "launched" event handler is called near the end of the launch sequence. This is a good place to show our main window.
---
-on launched theObject
- show window "main"
-end launched
-
-
--- The "idle" event handler is called on a periodic basis. For our purposes, we are using it to do the initial work of getting all of the services. This is done so that the window will have already been opened and made the active window.
---
-on idle theObject
- -- Only do this once (hopefully)
- if (count of services) is 0 then
- -- Show the status items in the main window with a message
- showStatus(window "main")
- updateStatusMessage(window "main", "Getting Services...")
-
- -- Get the services from the xmethods server
- set services to getServices()
-
- -- Update the status message
- updateStatusMessage(window "main", "Adding Services...")
-
- -- Add the services to our data source
- addServicesToDataSource(services, data source "all services")
-
- -- Hide the status items
- hideStatus(window "main")
- end if
-
- return 6000
-end idle
-
-
--- The "awake from nib" event handler is called whenever the object attached to this handler is loaded from a nib. It's a great place to do any initialization for a particular object, as it's not necessary to locate the object within it's hierarchy.
---
-on awake from nib theObject
- if name of theObject is "services" then
- -- Save a reference to the table view
- set servicesTableView to theObject
-
- -- Create a data source that will always contain all of the services, and one that will contain the currently found service
- makeDataSourceWithColumns("all services", {"publisherid", "name", "shortdescription", "id"})
- makeDataSourceWithColumns("found services", {"publisherid", "name", "shortdescription", "id"})
-
- -- Use the "all services" data source at first
- set data source of servicesTableView to data source "all services"
- else if name of theObject is "detail" then
- -- Save a reference to the new detail window
- set detailWindow to theObject
- end if
-end awake from nib
-
-
--- The "double clicked" event handler is called when someone double clicks on the table view.
---
-on double clicked theObject
- if name of theObject is "services" then
- -- Show and update the message items in the main window
- showStatus(window of theObject)
- updateStatusMessage(window of theObject, "Getting Service Details...")
-
- -- Get the clicked row of the table view
- set theDataRow to clicked data row of theObject
-
- -- Get the name and id of the selected service
- set theServiceID to contents of data cell "id" of theDataRow
- set theServiceName to contents of data cell "name" of theDataRow
-
- -- See if the listing is already open
- set theWindow to findWindowWithTitle(theServiceName)
- if theWindow is not missing value then
- -- Just bring it to the front
- show theWindow
- else
- -- Load a new instance of the detail window and show it
- load nib "ServiceDetail"
- set title of detailWindow to theServiceName
-
- -- Load the service detail and update it in the window
- set theServiceDetail to getServiceDetailWithID(theServiceID as string)
- updateServiceDetailInWindow(theServiceDetail, detailWindow)
-
- -- Show the window
- show detailWindow
- end if
-
- -- Hide the status items
- hideStatus(window of theObject)
- end if
-end double clicked
-
-
--- The "action" event handler is called when someone chooses a menu item from the popup button. In this case the script will just cause another "find" to happen.
---
-on action theObject
- find(window of theObject)
-end action
-
-on column clicked theObject table column tableColumn
- -- Get the data source of the table view
- set theDataSource to data source of theObject
-
- -- Get the identifier of the clicked table column
- set theColumnIdentifier to identifier of tableColumn
-
- -- Get the current sort column of the data source
- try
- set theSortColumn to sort column of theDataSource
-
- -- If the current sort column is not the same as the clicked column then switch the sort column
- if (name of theSortColumn) is not equal to theColumnIdentifier then
- set the sort column of theDataSource to data column theColumnIdentifier of theDataSource
- else
- -- Otherwise change the sort order
- if sort order of theSortColumn is ascending then
- set sort order of theSortColumn to descending
- else
- set sort order of theSortColumn to ascending
- end if
- end if
- on error
- set sort column of theDataSource to data column theColumnIdentifier of theDataSource
- end try
-
- -- We need to update the table view (so it will be redrawn)
- update theObject
-end column clicked
-
-
-(* ==== Handlers ==== *)
-
--- This handler will show the status items in the main window. It also starts the animation of the progress indicator.
---
-on showStatus(theWindow)
- tell theWindow
- -- Show the text field and progress indicator
- set visible of text field "status" to true
- set visible of progress indicator "progress" to true
-
- -- Make sure it's using threaded animation and start it
- set uses threaded animation of progress indicator "progress" to true
- start progress indicator "progress"
- end tell
-end showStatus
-
-
--- This handler will hide the status items in the main window. It also stops the animation of the progress indicator.
---
-on hideStatus(theWindow)
- tell theWindow
- -- Hide the text field and progress indicator
- set visible of text field "status" to false
- set visible of progress indicator "progress" to false
-
- -- Stop the progress indicator
- stop progress indicator "progress"
- end tell
-end hideStatus
-
-
--- This handler will update the contents of the status message.
---
-on updateStatusMessage(theWindow, theMessage)
- set contents of text field "status" of theWindow to theMessage
-end updateStatusMessage
-
-
--- The "find" handler is used to query the data source based on the state of where, how, and what to find.
---
-on find(theWindow)
- -- Show and update the status items in the window
- showStatus(theWindow)
- updateStatusMessage(theWindow, "Finding Services...")
-
- -- Get the where, how, and what to find form the UI
- tell theWindow
- set findWhere to title of popup button "where"
- set findHow to title of popup button "how"
- set findWhat to contents of text field "what"
- end tell
-
- -- If there isn't anything specified in the "what", then switch in the "all services" data source
- if findWhat is "" then
- set data source of servicesTableView to data source "all services"
- update servicesTableView
- else
- -- Otherwise, find the matching services
- set foundServices to findServices(findWhere, findHow, findWhat)
-
- -- Turn off the updating of the table view while we manipulate the data source
- set update views of data source "found services" to false
-
- -- Delete all of the data rows in the data source
- delete every data row of data source "found services"
-
- -- Make sure that we have at least one found web service and then add the services to the data source
- if (count of foundServices) > 0 then
- addServicesToDataSource(foundServices, data source "found services")
- end if
-
- -- Switch in the "found services" data source into the table view
- set data source of servicesTableView to data source "found services"
-
- -- Turn back on the updating of the table view
- set update views of data source "found services" to true
- end if
-
- -- Hide the status items
- hideStatus(theWindow)
-end find
-
-
--- This is a utility handler that will create a new data source with the given name and columns names.
---
-on makeDataSourceWithColumns(theName, theColumnNames)
- -- Make the data source
- make new data source at the end of the data sources with properties {name:theName}
-
- -- Add the data columns
- repeat with columnName in theColumnNames
- make new data column at the end of the data columns of data source theName with properties {name:columnName, sort order:ascending, sort type:alphabetical, sort case sensitivity:case insensitive}
- end repeat
-
- -- Set the first column to be the sort column
- set sort column of data source theName to data column (item 1 of theColumnNames) of data source theName
-
- -- Make the data source sorted
- set sorted of data source theName to true
-
-end makeDataSourceWithColumns
-
-
--- This handler adds the records to the data source using the "append" command.
---
-on addServicesToDataSource(theServices, theDataSource)
- -- Turn off updating the associated table view
- set update views of theDataSource to false
-
- -- Add the records to the data source
- append theDataSource with theServices
-
- -- Turn the updating of the table view back on
- set update views of theDataSource to true
-end addServicesToDataSource
-
-
--- This is handler will do the actual searching of the "services" list based on the where, how and what parameters.
---
-on findServices(findWhere, findHow, findWhat)
- -- Set the result to an empty list
- set theServices to {}
-
- -- Determine which field of the record to search based on "where"
- if findWhere is "Publisher" then
- repeat with service in services
- set theValue to publisherid of service
- if findHow is "begins with" and theValue begins with findWhat then
- copy service to the end of theServices
- else if findHow is "contains" and theValue contains findWhat then
- copy service to the end of theServices
- else if findHow is "ends with" and theValue ends with findWhat then
- copy service to the end of theServices
- else if findHow is "is" and theValue is findWhat then
- copy service to the end of theServices
- end if
- end repeat
- else if findWhere is "Service Name" then
- repeat with service in services
- set theValue to |name| of service
- if findHow is "begins with" and theValue begins with findWhat then
- copy service to the end of theServices
- else if findHow is "contains" and theValue contains findWhat then
- copy service to the end of theServices
- else if findHow is "ends with" and theValue ends with findWhat then
- copy service to the end of theServices
- else if findHow is "is" and theValue is findWhat then
- copy service to the end of theServices
- end if
- end repeat
- else if findWhere is "Description" then
- repeat with service in services
- set theValue to shortdescription of service
- if findHow is "begins with" and theValue begins with findWhat then
- copy service to the end of theServices
- else if findHow is "contains" and theValue contains findWhat then
- copy service to the end of theServices
- else if findHow is "ends with" and theValue ends with findWhat then
- copy service to the end of theServices
- else if findHow is "is" and theValue is findWhat then
- copy service to the end of theServices
- end if
- end repeat
- end if
-
- -- Return the services that were found
- return theServices
-end findServices
-
-
--- This handler is called when the user has double clicked on one of the services in the table view. It will update the UI elements in the specified detail window with the given service detail record.
---
-on updateServiceDetailInWindow(theServiceDetail, theWindow)
- tell theWindow
- -- Update the contents of each of the text fields with the corresponding fields from the detail record.
- set contents of text field "name" to |name| of theServiceDetail
- set contents of text field "description" to shortdescription of theServiceDetail
- set contents of text field "publisher" to publisherid of theServiceDetail
- set contents of text field "email" to email of theServiceDetail
- --set contents of text field "info url" to infourl of theServiceDetail
- set contents of text field "wsdl url" to wsdlurl of theServiceDetail
-
- -- Check to see if we actually have a "note" field.
- if notes of theServiceDetail is not "<<nil not supported>>" then
- set contents of text view "notes" of scroll view "notes" to notes of theServiceDetail
- end if
- end tell
-end updateServiceDetailInWindow
-
-
-(* ==== Web Services Handlers ==== *)
-
--- The "getServices" handler is used to get a list of records that describes all of the services available from XMethods.org.
---
-on getServices()
- -- Set the result to an empty list
- set theServices to {}
-
- -- Get the list of services from the server
- try
- tell application "http://www.xmethods.net/interfaces/query"
- set theServices to call soap {method name:"getAllServiceSummaries", method namespace uri:"http://www.xmethods.net/interfaces/query", parameters:{}, SOAPAction:""}
- end tell
- end try
-
- -- Return the list of services
- return theServices
-end getServices
-
-
--- The "getServiceDetailWithID" handler will return a record that contains the details about the service with the specified ID.
---
-on getServiceDetailWithID(theServiceID)
- -- Set the result to a known value
- set theDetail to missing value
-
- -- We need to convert the supplied service id as plain text (as it is given as unicode text). This is a workaround for a known bug in the "call soap" command, as it can not except unicode or styled text at this time.
- set theServiceID to getPlainText(theServiceID)
-
- -- Get the detailed info from the server.
- try
- tell application "http://www.xmethods.net/interfaces/query"
- set theDetail to call soap {method name:"getServiceDetail", method namespace uri:"http://www.xmethods.net/interfaces/query", parameters:{|id|:theServiceID}, SOAPAction:""}
- end tell
- end try
-
- -- Return the requested detail information
- return theDetail
-end getServiceDetailWithID
-
-
-(* ==== Utility Handlers ==== *)
-
--- This is a utility handler that will simply find the window with the specified title.
---
-on findWindowWithTitle(theTitle)
- set theWindow to missing value
-
- set theWindows to every window whose title is theTitle
- if (count of theWindows) > 0 then
- set theWindow to item 1 of theWindows
- end if
-
- return theWindow
-end findWindowWithTitle
-
--- This is a workaround that will convert the given unicode text into plain text (not styled text)
---
-on getPlainText(fromUnicodeString)
- set styledText to fromUnicodeString as string
- set styledRecord to styledText as record
- return Çclass ktxtÈ of styledRecord
-end getPlainText
-
-(* © Copyright 2004 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- main.applescript
--- Get Process Information
-
-on run {input, parameters}
-
- if input is in {{}, {""}, ""} or |ignoresInput| of parameters is true then -- ignoresInput is the value of the type setting in the action's title bar
- -- if input is empty or being ignored then get process from popup button selection
- set processNameVal to (|processName| of parameters) as Unicode text
- else
- -- if input is not empty then use input as process name
- if class of input is list then
- set processNameVal to item 1 of input
- if processNameVal is in {{}, ""} then
- set processNameVal to (|processName| of parameters) as Unicode text
- end if
- else
- set processNameVal to input
- end if
- end if
-
- set ReturnAppleScriptRecordVal to (|ReturnAppleScriptRecord| of parameters)
-
- if ReturnAppleScriptRecordVal = 1 then
- (*
- Since this is a compiled script, we use the 'run script' command to load in System Events' AppleScript terminology.
- Otherwise the resulting AppleScript record will appear in chevron syntax (four byte character codes) in the View Results action.
- *)
- set theScript to "tell application \"System Events\" to properties of process \"" & processNameVal & "\""
- set processInfo to run script theScript
- else
- tell application "System Events"
- set processInfo to properties of process processNameVal
- end tell
- set counter to count of processInfo
- -- Get localized strings for properties labels
- set accepts_high_level_events to localized_string("accepts high level events")
- set accepts_remote_events to localized_string("accepts remote events")
- set background_only to localized_string("background only")
- set ClassicVal to localized_string("Classic")
- set creator_type to localized_string("creator type")
- set displayed_name to localized_string("displayed name")
- set fileVal to localized_string("file")
- set file_type to localized_string("file type")
- set frontmostVal to localized_string("frontmost")
- set has_scripting_terminology to localized_string("has scripting terminology")
- set idVal to localized_string("id")
- set nameVal to localized_string("name")
- set partition_space_used to localized_string("partition space used")
- set total_partition_size to localized_string("total partition size")
- set unix_id to localized_string("unix id")
- set visibleVal to localized_string("visible")
- -- Create text report
- tell application "System Events"
- set theTextData to accepts_high_level_events & ":" & tab & accepts high level events of processInfo & return & Â
- accepts_remote_events & ":" & tab & accepts remote events of processInfo & return & Â
- background_only & ":" & tab & background only of processInfo & return & Â
- ClassicVal & ":" & tab & Classic of processInfo & return & Â
- creator_type & ":" & tab & creator type of processInfo & return & Â
- displayed_name & ":" & tab & displayed name of processInfo & return & Â
- fileVal & ":" & tab & file of processInfo & return & Â
- file_type & ":" & tab & file type of processInfo & return & Â
- frontmostVal & ":" & tab & frontmost of processInfo & return & Â
- has_scripting_terminology & ":" & tab & has scripting terminology of processInfo & return & Â
- idVal & ":" & tab & id of processInfo & return & Â
- nameVal & ":" & tab & name of processInfo & return & Â
- partition_space_used & ":" & tab & partition space used of processInfo & return & Â
- total_partition_size & ":" & tab & total partition size of processInfo & return & Â
- unix_id & ":" & tab & unix id of processInfo & return & Â
- visibleVal & ":" & tab & visible of processInfo & return
- end tell
- set processInfo to theTextData
- end if
- return processInfo
-end run
-
-on localized_string(key_string)
- return localized string key_string in bundle with identifier "com.apple.AutomatorExamples.GetProcessInformation"
-end localized_string
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
-
--- UI.applescript
--- Get Process Information
-
-property actionview_reference : missing value
-property contentview_reference : missing value
-property action_parameters : missing value
-
-on awake from nib theObject
- set contentview_reference to theObject
- set actionview_reference to the super view of contentview_reference
- set the action_parameters to (call method "parameters" of (call method "action" of the actionview_reference))
- getProcesses()
-end awake from nib
-
-on parameters updated theObject parameters theParameters
- set (the title of popup button "processesMenu" of contentview_reference) to |processName| of theParameters as Unicode text
- set (the state of button "backgroundProcessesButton" of contentview_reference) to |backgroundProcesses| of theParameters as integer
- set (the state of button "ReturnAppleScriptRecord" of contentview_reference) to |ReturnAppleScriptRecord| of theParameters as integer
- return theParameters
-end parameters updated
-
-on update parameters theObject parameters theParameters
- set |processName| of theParameters to (the title of popup button "processesMenu" of contentview_reference) as Unicode text
- set |backgroundProcesses| of theParameters to (the state of button "backgroundProcessesButton" of contentview_reference)
- set |ReturnAppleScriptRecord| of theParameters to (the state of button "ReturnAppleScriptRecord" of contentview_reference)
- return theParameters
-end update parameters
-
-on clicked theObject
- -- This handler is attached to the check box buttons
- if name of theObject is "backgroundProcessesButton" then
- getProcesses()
- else if name of theObject is "ReturnAppleScriptRecord" then
- -- There are problems targeting the Automator process when returning a record, so we don't present this process to user
- set CurrentProcessTitle to (title of popup button "processesMenu" of contentview_reference) --as Unicode text
- if CurrentProcessTitle contains "Automator" then
- getProcesses()
- end if
- end if
-end clicked
-
-
-on will pop up theObject
- -- This handler is attached to the popup button
- tell progress indicator "ProgressIndicator" of contentview_reference to start
- set CurrentProcessTitle to (title of theObject) --as Unicode text
- getProcesses()
- set (title of theObject) to CurrentProcessTitle
- tell progress indicator "ProgressIndicator" of contentview_reference to stop
-end will pop up
-
-on getProcesses()
- set |backgroundProcesses| of action_parameters to (the state of button "backgroundProcessesButton" of contentview_reference)
- set backgroundProcessVal to (|backgroundProcesses| of action_parameters)
- set ReturnAppleScriptRecordVar to (the state of button "ReturnAppleScriptRecord" of contentview_reference)
-
- delete every menu item of menu of popup button "processesMenu" of contentview_reference
- if backgroundProcessVal = 1 then
- tell application "System Events"
- set processList to name of every process
- end tell
- else
- tell application "System Events"
- set processList to name of every process whose background only is false
- end tell
- end if
- repeat with processTitle in processList
- -- There are problems targeting the Automator process when returning a record, so we don't present this process to user
- if ReturnAppleScriptRecordVar = 1 then
- if processTitle does not contain "Automator" then
- make new menu item at the end of menu items of menu of popup button "processesMenu" of contentview_reference with properties {title:processTitle, enabled:true}
- end if
- else
- make new menu item at the end of menu items of menu of popup button "processesMenu" of contentview_reference with properties {title:processTitle, enabled:true}
- end if
- end repeat
-end getProcesses
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- main.applescript
--- Quit Application
-
-on run {input, parameters}
- set the app_path to |appPath| of parameters
-
- set the target_app to app_path as POSIX file as alias
- set the target_app to the target_app as Unicode text
-
- set saving to (saving of parameters)
- if saving is 0 then
- tell application target_app to quit saving yes
- else if saving is 1 then
- tell application target_app to quit saving no
- else
- tell application target_app to quit saving ask
- end if
- return input
-end run
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (“Appleâ€) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in this original Apple software (the “Apple Softwareâ€), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- main.applescript
--- Randomizer
-
-on run {input_items, parameters}
- set the output_items to {}
- if input_items is not {} then
- if the class of the input_items is list then
- set the number_method to (|numberMethod| of parameters) as integer
- set the number_to_choose to (|numberToChoose| of parameters) as integer
- if number_method is 1 then
- set the number_to_choose to my convert_percentage_to_number(number_to_choose, count of the input_items)
- end if
- repeat with i from 1 to the number_to_choose
- set the end of the output_items to some item of the input_items
- end repeat
- else
- set the output_items to the input_items
- end if
- end if
- return output_items
-end run
-
-on convert_percentage_to_number(this_percentage, this_total)
- return (this_percentage * this_total) div 100
-end convert_percentage_to_number
-
-on localized_string(key_string)
- return localized string key_string in bundle with identifier "com.apple.AutomatorExamples.Randomizer"
-end localized_string
-
-(* © Copyright 2005 Apple Computer, Inc. All rights reserved.
-
-IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. (ÒAppleÓ) in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.
-
-In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in this original Apple software (the ÒApple SoftwareÓ), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.
-
-The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
-IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
--- ÇFILENAMEÈ
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
--- CodeWarrior Script Handlers
--- pbxprojectimporters
--- Created by Scott Tooker on Mon Mar 17 2003.
--- Copyright ? 2003 Apple Computer. All rights reserved.
-
--- This file contains subroutines that are called by PBXCWProjectImporter to assist in the import of a CodeWarrior project.
-
--- exportCodeWarriorProjectAtPath subroutine
--- this subroutine opens the project pointed to by posixProjectPath, sets all the targets to use relative paths and then exports the project to an XML file and returns the posix path to the XML export file.
-on exportCodeWarriorProjectAtPath(posixProjectPath)
- set projectAlias to (POSIX file posixProjectPath) as alias
- tell application "CodeWarrior IDE"
- set projectToExport to a reference to document (openProject(projectAlias) of me)
- -- log projectToExport
- set theProjectWindow to window of projectToExport
- select theProjectWindow
- set projectFileLocation to (location of projectToExport) as alias
- set originalTarget to current target of projectToExport
- set originalTargetName to name of originalTarget
- set listOfTargets to name of every target in projectToExport
-
- repeat with eachTargetName in listOfTargets
- Set Current Target eachTargetName
- set settings to (Get Preferences from panel "Target Settings")
- set Use Relative Paths of settings to true
- Set Preferences of panel "Target Settings" to settings
- end repeat
-
- Set Current Target originalTargetName
-
- tell application "Finder"
- set projectFolder to (the container of projectFileLocation) as alias
- end tell
-
- set xmlFileName to (name of projectToExport) & ".xml"
- set tempXMLFilePath to ((projectFolder as Unicode text) & "tempProjectAsXML.xml")
-
- set xmlFileReference to a reference to file tempXMLFilePath
-
- export projectToExport to xmlFileReference
- end tell
-
- tell application "Finder"
- set aliasToXMLFile to tempXMLFilePath as alias
- set name of aliasToXMLFile to xmlFileName
- end tell
-
- return POSIX path of aliasToXMLFile
-end exportCodeWarriorProjectAtPath
-
--- closeCodeWarriorProjectAtPath subroutine
--- this subroutine closes the project pointed to by posixProjectPath if it is open
-on closeCodeWarriorProjectAtPath(posixProjectPath)
- set projectAlias to (POSIX file posixProjectPath) as alias
-
- tell application "CodeWarrior IDE"
- set projectToClose to a reference to document (openProject(projectAlias) of me)
- set theProjectWindow to window of projectToClose
- close theProjectWindow saving yes
- end tell
-end closeCodeWarriorProjectAtPath
-
--- generateInfoPlist subroutine
--- this subroutine generates the Info.plist from the given .plc file using the given target in the current project and returns the posix path to the Info.plist
-on generateInfoPlist(posixProjectPath, targetName, posixPlcFilePath)
- set projectAlias to (POSIX file posixProjectPath) as alias
- set plcFileAlias to (POSIX file posixPlcFilePath) as alias
-
- tell application "CodeWarrior IDE"
- set projectOfInterest to a reference to document (openProject(projectAlias) of me)
- set theProjectWindow to window of projectOfInterest
- select theProjectWindow
-
- set originalTarget to current target of projectOfInterest
- set originalTargetName to name of originalTarget
-
- Set Current Target targetName
- compile {plcFileAlias}
-
- set infoPlistPath to findInfoPlistForTargetInProject(targetName, projectAlias) of me
-
- Set Current Target originalTargetName
- return infoPlistPath
- end tell
-end generateInfoPlist
-
--- findInfoPlistForTarget subroutine
--- this subroutine finds the Info.plist for the given target in the current project and returns the posix path
-on findInfoPlistForTargetInProject(cwTargetName, projectAlias)
-
- tell application "CodeWarrior IDE"
- Set Current Target cwTargetName
- -- determine which linker is being used for this target to get the project type
- set targetSettings to (Get Preferences from panel "Target Settings")
- set linkerName to Linker of targetSettings
- set projectType to missing value
- set productName to missing value
-
- if (linkerName is "MacOS PPC Linker") then
- set targetSettings to (Get Preferences from panel "PPC Project")
- else if (linkerName is "MacOS X PPC Linker") then
- set targetSettings to (Get Preferences from panel "PPC Mac OS X Project")
- else if (linkerName is "Mach-O PPC Linker") then
- set targetSettings to (Get Preferences from panel "PPC Mach-O Target")
- end if
-
- set projectType to Project Type of targetSettings
- set productName to File Name of targetSettings
-
- set projectTypesThatIgnorePlistOutputPath to {application package, shared library package, framework, kernel extension package}
-
- set targetSettings to (Get Preferences from panel "Property List")
- set plistOutputPath to Output Directory of targetSettings
-
- if projectType is in projectTypesThatIgnorePlistOutputPath then
- set targetSettings to (Get Preferences from panel "Target Settings")
- set outputRelativePath to Output Directory Location of targetSettings
- set pathName to name of outputRelativePath
- set newPathName to pathName
-
- if format of outputRelativePath is MacOS Path then
- set newPathName to (pathName & ":" & productName & ":Contents:Info.plist")
- else if format of outputRelativePath is Unix Path then
- set newPathName to (pathName & "/" & productName & "/Contents/Info.plist")
- end if
- set (name of outputRelativePath) to newPathName
- set plistOutputPath to outputRelativePath
- end if
-
- set absolutePath to absolutePathForAccessPathInTargetNamedFromProject(plistOutputPath, cwTargetName, projectAlias) of me
-
- return absolutePath
- end tell
-end findInfoPlistForTargetInProject
-
--- absolutePathForAccessPathInTargetNamedFromProject subroutine
--- this subroutine returns an absolute posix path for the given access path
-on absolutePathForAccessPathInTargetNamedFromProject(accessPath, cwTargetName, projectAlias)
- set projectPathRoot to projectAlias
- tell application "Finder"
- set compilerFolderAlias to container of (application file id "CWIE") as alias
- set compilerPathRoot to POSIX path of (compilerFolderAlias)
- set projectFolderAlias to container of (file projectAlias) as alias
- set projectPathRoot to POSIX path of projectFolderAlias
- end tell
-
-
- tell application "CodeWarrior IDE"
- set relativePath to name of accessPath
- set pathFormat to format of accessPath
- set pathRootType to origin of accessPath
- set pathRootName to missing value
- if pathRootType is root relative then
- set pathRootName to root of accessPath
- end if
- set absolutePath to missing value
-
- if pathRootType is absolute then
- set absolutePath to relativePath
- else if pathRootType is project relative then
- if pathFormat is MacOS Path then
- set macOSProjectPathRoot to projectFolderAlias as Unicode text
- set absolutePath to (macOSProjectPathRoot & relativePath)
- else if pathFormat is Unix Path then
- set absolutePath to (projectPathRoot & relativePath)
- end if
- else if pathRootType is shell relative then
- if pathFormat is MacOS Path then
- set macOSCompilerPathRoot to compilerFolderAlias as Unicode text
- set absolutePath to (macOSCompilerPathRoot & relativePath)
- else if pathFormat is Unix Path then
- set absolutePath to (compilerPathRoot & relativePath)
- end if
- else if pathRootType is root relative then
- set sourceTreeRoot to pathForSourceTreeNameUsingTargetNamedInProjectAtPath(pathRootName, cwTargetName, projectAlias) of me
- if pathFormat is MacOS Path then
- set macOSSourceTreePathRoot to (POSIX file sourceTreeRoot) as Unicode text
- set absolutePath to (macOSSourceTreePathRoot & relativePath)
- else if pathFormat is Unix Path then
- set absolutePath to (sourceTreeRoot & relativePath)
- end if
- end if
-
- if pathFormat is MacOS Path then
- return POSIX path of (absolutePath as alias)
- else
- return absolutePath
- end if
- end tell
-end absolutePathForAccessPathInTargetNamedFromProject
-
--- pathForSourceTreeNameUsingTargetNamedInProjectAtPath subroutine
--- this subroutine returns the posix path for a given Source Tree name
--- target source trees are searched first, followed by global source trees
-on pathForSourceTreeNameUsingTargetNamedInProjectAtPath(pathRootName, cwTargetName, projectAlias)
-
- tell application "CodeWarrior IDE"
- set cwProject to a reference to document (openProjectAtPath(projectAlias) of me)
- set originalTarget to current target of cwProject
- set originalTargetName to name of originalTarget
-
- Set Current Target cwTargetName
- set targetSourceTrees to Source Trees of (Get Preferences from panel "Target Source Trees")
- Set Current Target originalTargetName
-
- set sourceTreePath to missing value
- repeat with eachSourceTree in targetSourceTrees
- if name of eachSourceTree is pathRootName then
- if format of eachSourceTree is MacOS Path then
- set sourceTreePath to POSIX path of file (path of eachSourceTree)
- else
- set sourceTreePath to (path of eachSourceTree)
- end if
- end if
- end repeat
-
- if sourceTreePath is missing value then
- set globalSourceTrees to Source Trees of Global Source Trees
-
- repeat with eachSourceTree in globalSourceTrees
- if name of eachSourceTree is pathRootName then
- if format of eachSourceTree is MacOS Path then
- set sourceTreePath to POSIX path of file (path of eachSourceTree)
- else
- set sourceTreePath to (path of eachSourceTree)
- end if
- end if
- end repeat
- end if
-
- return sourceTreePath
- end tell
-end pathForSourceTreeNameUsingTargetNamedInProjectAtPath
-
--- fixUpBrokenCodeWarriorPath subroutine
--- this is needed to get around a bug in the path value that CodeWarrior returns for a target file
-on fixUpBrokenCodeWarriorPath(brokenPath)
- set slashOffset to offset of "/" in brokenPath
- set lengthOfPath to count of brokenPath
- set firstPiece to characters 1 thru (slashOffset - 1) of brokenPath
- set lastPiece to characters (slashOffset + 1) thru lengthOfPath of brokenPath
- set fixedPath to firstPiece & ":" & lastPiece as Unicode text
-
- return fixedPath
-end fixUpBrokenCodeWarriorPath
-
--- openProject subroutine
--- this returns the name of the CodeWarrior project that is at the given path
-on openProject(projectAlias)
- tell application "CodeWarrior IDE"
- -- log (open projectAlias converting yes)
- open projectAlias converting yes
-
- set desiredProjectName to missing value
- set documentList to every document
- -- log documentList
- repeat with eachDocument in documentList
- if kind of eachDocument is project then
- if ((location of eachDocument) as alias) is projectAlias then
- set desiredProjectName to name of eachDocument
- exit repeat
- end if
- end if
- end repeat
- -- log desiredProjectName
- return desiredProjectName
- end tell
-end openProject
-
--- getGlobalSourceTrees subroutine
--- this returns the set of defined app-level source trees
-on getGlobalSourceTrees()
- tell application "CodeWarrior IDE"
- get Source Trees of (Get Preferences from panel "Global Source Trees")
- end tell
-end getGlobalSourceTrees
-
--- launchCodeWarrior subroutine
--- this launches CodeWarrior
-on launchCodeWarrior()
- launch application "CodeWarrior IDE"
-end launchCodeWarrior
-
--- quitCodeWarrior subroutine
--- this quits CodeWarrior
-on quitCodeWarrior()
- quit application "CodeWarrior IDE"
-end quitCodeWarrior
-
--- Created by Scott Tooker on Mon Apr 21 2003.
--- Copyright © 2003 Apple Computer. All rights reserved.
-
--- This file contains subroutines that are called by PBXCWProjectImporter to assist in the import of a CodeWarrior project.
-
--- isCodeWarriorOpen subroutine
--- this returns if CodeWarrior is already open
-on isCodeWarriorOpen()
-
- set codeWarriorOpen to false
-
- tell application "System Events"
- set codeWarriorProcesses to processes whose name contains "CodeWarrior"
- end tell
-
- if codeWarriorProcesses is not {} then
- set codeWarriorOpen to true
- end if
-
- return codeWarriorOpen
-
-end isCodeWarriorOpen
--- main.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
-on run {input, parameters}
-
- return input
-end run
--- ÇPROJECTNAMEÈ.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
--- ÇPROJECTNAMEÈ.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
--- Document.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
-on data representation theObject of type ofType
- (*Return the data that is to be stored in your document here.*)
-end data representation
-
-on load data representation theObject of type ofType with data withData
- (* The withData contains the data that was stored in your document that you provided in the "data representation" event handler. Return "true" if this was successful, or false if not.*)
- return true
-end load data representation
--- ÇPROJECTNAMEÈ.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
-on idle
- (* Add any idle time processing here. *)
-end idle
-
-on open names
- (* Add your script to process the names here. *)
-
- -- Remove the following line if you want the application to stay open.
- quit
-end open
-
--- ÇPROJECTNAMEÈ.applescript
--- ÇPROJECTNAMEÈ
-
--- Created by ÇFULLUSERNAMEÈ on ÇDATEÈ.
--- Copyright ÇYEARÈ ÇORGANIZATIONNAMEÈ. All rights reserved.
-
-on plugin loaded theBundle
- (* Add your script here. *)
-end plugin loaded
--- Refresh Finder.applescript
--- SCPlugin
-
--- Created by Jonathan Paisley on 03/12/2006.
--- Copyright 2006 Jonathan Paisley. All rights reserved.
-
-tell application "Finder"
- update every item of every window
-end tell
-tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preferences.users"
-end tell
-
-tell application "System Events"
- if UI elements enabled then
- tell tab group 1 of window "Accounts" of process "System Preferences"
- click radio button 1
- delay 2
- get value of text field 1
- end tell
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-tell application "TextEdit"
- activate
-end tell
-
-tell application "System Events"
- if UI elements enabled then
- tell process "TextEdit"
- set frontmost to true
- end tell
-
- key down option
- keystroke "e"
- delay 1
- key up option
- keystroke "e"
- keystroke return
-
- keystroke "e" using option down
- delay 1
- keystroke "e"
- keystroke return
-
- key down shift
- keystroke "p"
- key up shift
- keystroke return
-
- key down option
- keystroke "p"
- key up option
- keystroke return
-
- key down {shift, option}
- keystroke "p"
- key up {shift, option}
- keystroke return
-
- keystroke "p" using {shift down, option down}
- keystroke return
-
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-tell application "System Events"
- get properties
- get every process
- if UI elements enabled then
- tell process "Finder"
- get every menu bar
- tell menu bar 1
- get every menu bar item
- get every menu of every menu bar item
- get every menu item of every menu of every menu bar item
- get every menu of every menu item of every menu of every menu bar item
- get every menu item of every menu of every menu item of every menu of every menu bar item
- end tell
- end tell
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-tell application "Finder"
- activate
-end tell
-
-tell application "System Events"
- get properties
- if UI elements enabled then
- tell process "Finder"
-
- get every UI element
-
- tell window 1
-
- get every button
- get properties of every button
- get every UI element of every button
-
- get every static text
- get properties of every static text
- get every UI element of every static text
-
- get every scroll bar
- get properties of every scroll bar
- get every UI element of every scroll bar
-
- get every UI element Â
- whose class is not button and class is not static text Â
- and class is not scroll bar
- get properties of every UI element Â
- whose class is not button and class is not static text Â
- and class is not scroll bar
-
- end tell
-
- end tell
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-tell application "Finder"
- activate
-end tell
-
-tell application "System Events"
- if UI elements enabled then
- click menu item "Automatic" of menu "Location" of menu item "Location" of menu "Apple" of menu bar 1 of process "Finder"
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.sound"
-end tell
-
-tell application "System Events"
- if UI elements enabled then
- tell slider 1 of group 1 of window 1 of process "System Preferences"
- if value is 0.5 then
- set value to 0.8
- else
- set value to 0.5
- end if
- end tell
- else
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.universalaccess"
- display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
- end tell
- end if
-end tell
-(**
- * filename: MailFile.applescript
- * created : Tue Feb 11 14:24:40 2003
- * LastEditDate Was "Fri Oct 22 10:17:12 2004"
- *
- *)
-
-on sendfileviaemail(emailer, filenames)
- (* Part that does all of the work, this works for Mail *)
- if (emailer is equal to "com.apple.mail") then
- tell application "Mail"
- -- Properties can be specified in a record when creating the message or
- -- afterwards by setting individual property values.
- set newMessage to make new outgoing message
- tell newMessage
- set visible to true
- tell content
- -- Position must be specified for attachments
- repeat with filename in filenames
- make new attachment with properties {file name:filename} at after the last paragraph
- end repeat
- end tell
- end tell
- end tell
- activate
- else
- if (emailer is equal to "com.microsoft.entourage") then
- (* lots of stuff for entourage here *)
- end if
- end if
-end sendfileviaemail
-
--- sendfileviaemail("com.apple.mail", "array of files/tmp/foo.vcf")
diff --git a/etc/todo/example.lua b/etc/todo/example.lua
deleted file mode 100644
index 9d9a404..0000000
--- a/etc/todo/example.lua
+++ /dev/null
@@ -1,8289 +0,0 @@
-
--------------------------------------------------------------------------------
--- Creates a new function, with the name suffixed by "New". This new function
--- creates a new image, based on a source image, and calls the previous function
--- with this new image.
-
-local function OneSourceOneDest (funcname, width, height, color_space, data_type)
- local func = im[funcname]
- assert(func) -- see if function is really defined
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image, ...)
- -- create destination image
- local dst_image = im.ImageCreateBased(src_image, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- func(src_image, dst_image, unpack(arg))
- return dst_image
- end
-end
-
--------------------------------------------------------------------------------
--- This function is similar to OneSourceOneDest, but it receives two source
--- images.
-
-local function TwoSourcesOneDest (funcname, width, height, color_space, data_type)
- local func = im[funcname]
-
- -- see if function is really defined
- assert(func, string.format("undefined function `%s'", funcname))
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image1, src_image2, ...)
- -- create destination image
- local dst_image = im.ImageCreateBased(src_image1, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- func(src_image1, src_image2, dst_image, unpack(arg))
- return dst_image
- end
-end
-
--------------------------------------------------------------------------------
-
-TwoSourcesOneDest("ProcessCrossCorrelation")
-OneSourceOneDest("ProcessAutoCorrelation", nil, nil, nil, im.CFLOAT)
-OneSourceOneDest("ProcessFFT")
-OneSourceOneDest("ProcessIFFT")
-
--------------------------------------------------------------------------------
--- Creates a new function, with the name suffixed by "New". This new function
--- creates a new image, based on a source image, and calls the previous function
--- with this new image.
--- We assume here that the functions returns only one parameter or none.
-
-local function OneSourceOneDest (funcname, width, height, color_space, data_type)
- local func = im[funcname]
- assert(func) -- see if function is really defined
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image, ...)
- -- create destination image
- local dst_image = im.ImageCreateBased(src_image, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- local ret = func(src_image, dst_image, unpack(arg))
- if (ret) then
- return ret, dst_image
- else
- return dst_image
- end
- end
-end
-
--------------------------------------------------------------------------------
--- This function is similar to OneSourceOneDest, but it receives two source
--- images.
-
-local function TwoSourcesOneDest (funcname, width, height, color_space, data_type)
- local func = im[funcname]
-
- -- see if function is really defined
- assert(func, string.format("undefined function `%s'", funcname))
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image1, src_image2, ...)
- -- create destination image
- local dst_image = im.ImageCreateBased(src_image1, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- local ret = func(src_image1, src_image2, dst_image, unpack(arg))
- if (ret) then
- return ret, dst_image
- else
- return dst_image
- end
- end
-end
-
--------------------------------------------------------------------------------
--- This function is similar to OneSourceOneDest, but it receives three source
--- images.
-
-local function ThreeSourcesOneDest (funcname, width, height, color_space, data_type)
- local func = im[funcname]
- assert(func) -- see if function is really defined
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image1, src_image2, src_image3, ...)
- -- create destination image
- local dst_image = im.ImageCreateBased(src_image1, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- local ret = func(src_image1, src_image2, src_image3, dst_image, unpack(arg))
- if (ret) then
- return ret, dst_image
- else
- return dst_image
- end
- end
-end
-
--------------------------------------------------------------------------------
--- This function is similar to OneSourceOneDest, but it creates two destiny
--- images.
-
-local function OneSourceTwoDests (funcname, width, height, color_space, data_type)
- local func = im[funcname]
- assert(func) -- see if function is really defined
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image, ...)
- -- create destination image
- local dst_image1 = im.ImageCreateBased(src_image, width, height, color_space, data_type)
- local dst_image2 = im.ImageCreateBased(src_image, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- local ret = func(src_image, dst_image1, dst_image2, unpack(arg))
- if (ret) then
- return ret, dst_image1, dst_image2
- else
- return dst_image1, dst_image2
- end
- end
-end
-
--------------------------------------------------------------------------------
--- This function is similar to OneSourceOneDest, but it creates three destiny
--- images.
-
-local function OneSourceThreeDests (funcname, width, height, color_space, data_type)
- local func = im[funcname]
- assert(func) -- see if function is really defined
-
- -- define function with "New" suffix
- im[funcname.."New"] = function (src_image, ...)
- -- create destination image
- local dst_image1 = im.ImageCreateBased(src_image, width, height, color_space, data_type)
- local dst_image2 = im.ImageCreateBased(src_image, width, height, color_space, data_type)
- local dst_image3 = im.ImageCreateBased(src_image, width, height, color_space, data_type)
-
- -- call previous method, repassing all parameters
- local ret = func(src_image, dst_image1, dst_image2, dst_image3, unpack(arg))
- if (ret) then
- return ret, dst_image1, dst_image2, dst_image3
- else
- return dst_image1, dst_image2, dst_image3
- end
- end
-end
-
--------------------------------------------------------------------------------
-
-local function hough_height(image)
- local function sqr(x) return x*x end
- local rmax = math.sqrt(sqr(image:Width()) + sqr(image:Height())) / 2
- return 2*rmax+1
-end
-
-OneSourceOneDest("AnalyzeFindRegions", nil, nil, nil, im.USHORT)
-OneSourceOneDest("ProcessPerimeterLine")
-OneSourceOneDest("ProcessPrune")
-OneSourceOneDest("ProcessFillHoles")
-OneSourceOneDest("ProcessHoughLines", 180, hough_height, im.GRAY, im.INT)
-OneSourceOneDest("ProcessHoughLinesDraw")
-OneSourceOneDest("ProcessDistanceTransform", nil, nil, nil, im.FLOAT)
-OneSourceOneDest("ProcessRegionalMaximum", nil, nil, im.BINARY, nil)
-
-function im.ProcessReduceNew (src_image, width, height)
- local dst_image = im.ImageCreateBased(src_image, width, height)
- return im.ProcessReduce(src_image, dst_image), dst_image
-end
-
-function im.ProcessResizeNew (src_image, width, height)
- local dst_image = im.ImageCreateBased(src_image, width, height)
- return im.ProcessResize(src_image, dst_image), dst_image
-end
-
-OneSourceOneDest("ProcessReduceBy4", function (image) return image:Width() / 2 end,
- function (image) return image:Height() / 2 end)
-
-function im.ProcessCropNew (src_image, xmin, xmax, ymin, ymax)
- local width = xmax - xmin + 1
- local height = xmax - ymin + 1
- local dst_image = im.ImageCreateBased(src_image, width, height)
- im.ProcessCrop(src_image, dst_image, xmin, ymin)
- return dst_image
-end
-
-TwoSourcesOneDest("ProcessInsert")
-
-function im.ProcessAddMarginsNew (src_image, xmin, xmax, ymin, ymax)
- local width = xmax - xmin + 1
- local height = xmax - ymin + 1
- local dst_image = im.ImageCreateBased(src_image, width, height)
- im.ProcessAddMargins(src_image, dst_image, xmin, ymin)
- return dst_image
-end
-
-function im.ProcessRotateNew (src_image, cos0, sin0, order)
- local width, height = im.ProcessCalcRotateSize(src_image:Width(), src_image:Height(), cos0, sin0)
- local dst_image = im.ImageCreateBased(src_image, width, height)
- return im.ProcessRotate(src_image, dst_image, cos0, sin0, order), dst_image
-end
-
-OneSourceOneDest("ProcessRotateRef")
-OneSourceOneDest("ProcessRotate90", function (image) return image:Height() end, function (image) return image:Width() end)
-OneSourceOneDest("ProcessRotate180")
-OneSourceOneDest("ProcessMirror")
-OneSourceOneDest("ProcessFlip")
-OneSourceOneDest("ProcessRadial")
-OneSourceOneDest("ProcessGrayMorphConvolve")
-OneSourceOneDest("ProcessGrayMorphErode")
-OneSourceOneDest("ProcessGrayMorphDilate")
-OneSourceOneDest("ProcessGrayMorphOpen")
-OneSourceOneDest("ProcessGrayMorphClose")
-OneSourceOneDest("ProcessGrayMorphTopHat")
-OneSourceOneDest("ProcessGrayMorphWell")
-OneSourceOneDest("ProcessGrayMorphGradient")
-OneSourceOneDest("ProcessBinMorphConvolve")
-OneSourceOneDest("ProcessBinMorphErode")
-OneSourceOneDest("ProcessBinMorphDilate")
-OneSourceOneDest("ProcessBinMorphOpen")
-OneSourceOneDest("ProcessBinMorphClose")
-OneSourceOneDest("ProcessBinMorphOutline")
-OneSourceOneDest("ProcessBinMorphThin")
-OneSourceOneDest("ProcessMedianConvolve")
-OneSourceOneDest("ProcessRangeConvolve")
-OneSourceOneDest("ProcessRankClosestConvolve")
-OneSourceOneDest("ProcessRankMaxConvolve")
-OneSourceOneDest("ProcessRankMinConvolve")
-OneSourceOneDest("ProcessConvolve")
-OneSourceOneDest("ProcessConvolveSep")
-OneSourceOneDest("ProcessConvolveRep")
-OneSourceOneDest("ProcessConvolveDual")
-OneSourceOneDest("ProcessCompassConvolve")
-OneSourceOneDest("ProcessMeanConvolve")
-OneSourceOneDest("ProcessGaussianConvolve")
-OneSourceOneDest("ProcessBarlettConvolve")
-OneSourceTwoDests("ProcessInterlaceSplit", nil, function (image) if (image:Height()) then return image:Height() else return image:Height()/2 end end)
-
-function im.ProcessInterlaceSplitNew(src_image)
- -- create destination image
- local dst_height1 = src_image:Height()/2
- if math.mod(src_image:Height(), 2) then
- dst_height1 = dst_height1 + 1
- end
-
- local dst_image1 = im.ImageCreateBased(src_image, nil, dst_height1)
- local dst_image2 = im.ImageCreateBased(src_image, nil, src_image:Height()/2)
-
- -- call method, repassing all parameters
- im.ProcessInterlaceSplit(src_image, dst_image1, dst_image2)
- return dst_image1, dst_image2
-end
-
-local function int_datatype (image)
- local data_type = image:DataType()
- if data_type == im.BYTE or data_type == im.USHORT then
- data_type = im.INT
- end
- return data_type
-end
-
-OneSourceOneDest("ProcessDiffOfGaussianConvolve", nil, nil, nil, int_datatype)
-OneSourceOneDest("ProcessLapOfGaussianConvolve", nil, nil, nil, int_datatype)
-OneSourceOneDest("ProcessSobelConvolve")
-OneSourceOneDest("ProcessSplineEdgeConvolve")
-OneSourceOneDest("ProcessPrewittConvolve")
-OneSourceOneDest("ProcessZeroCrossing")
-OneSourceOneDest("ProcessCanny")
-OneSourceOneDest("ProcessUnArithmeticOp")
-TwoSourcesOneDest("ProcessArithmeticOp")
-
-function im.ProcessArithmeticConstOpNew (src_image, src_const, op)
- local dst_image = im.ImageCreateBased(src_image)
- im.ProcessArithmeticConstOp(src_image, src_const, dst_image, op)
- return dst_image
-end
-
-TwoSourcesOneDest("ProcessBlendConst")
-ThreeSourcesOneDest("ProcessBlend")
-OneSourceTwoDests("ProcessSplitComplex")
-TwoSourcesOneDest("ProcessMergeComplex", nil, nil, nil, im.CFLOAT)
-
-function im.ProcessMultipleMeanNew (src_image_list, dst_image)
- local dst_image = im.ImageCreateBased(src_image_list[1])
- im.ProcessMultipleMean(src_image_list, dst_image)
- return dst_image
-end
-
-function im.ProcessMultipleStdDevNew (src_image_list, mean_image)
- local dst_image = im.ImageCreateBased(src_image_list[1])
- im.ProcessMultipleStdDev(src_image_list, mean_image, dst_image)
- return dst_image
-end
-
-TwoSourcesOneDest("ProcessAutoCovariance")
-OneSourceOneDest("ProcessMultiplyConj")
-OneSourceOneDest("ProcessQuantizeRGBUniform", nil, nil, im.MAP, nil)
-OneSourceOneDest("ProcessQuantizeGrayUniform")
-OneSourceOneDest("ProcessExpandHistogram")
-OneSourceOneDest("ProcessEqualizeHistogram")
-
-function im.ProcessSplitYChromaNew (src_image)
- local y_image = im.ImageCreateBased(src_image, nil, nil, im.GRAY, im.BYTE)
- local chroma_image = im.ImageCreateBased(src_image, nil, nil, im.RGB, im.BYTE)
- im.ProcessSplitYChroma(src_image, y_image, chroma_image)
- return y_image, chroma_image
-end
-
-OneSourceThreeDests("ProcessSplitHSI", nil, nil, im.GRAY, im.FLOAT)
-ThreeSourcesOneDest("ProcessMergeHSI", nil, nil, im.RGB, im.BYTE)
-
-function im.ProcessSplitComponentsNew (src_image)
- local depth = src_image:Depth()
- local dst_images = {}
- for i = 1, depth do
- table.insert(dst_images, im.ImageCreateBased(src_image, nil, nil, im.GRAY))
- end
- im.ProcessSplitComponents(src_image, dst_images)
- return unpack(dst_images)
-end
-
-function im.ProcessMergeComponentsNew (src_image_list)
- local dst_image = im.ImageCreateBased(src_image_list[1], nil, nil, im.RGB)
- im.ProcessMergeComponents(src_image_list, dst_image)
- return dst_image
-end
-
-OneSourceOneDest("ProcessNormalizeComponents", nil, nil, nil, im.FLOAT)
-OneSourceOneDest("ProcessReplaceColor")
-TwoSourcesOneDest("ProcessBitwiseOp")
-OneSourceOneDest("ProcessBitwiseNot")
-OneSourceOneDest("ProcessBitMask")
-OneSourceOneDest("ProcessBitPlane")
-OneSourceOneDest("ProcessToneGamut")
-OneSourceOneDest("ProcessUnNormalize", nil, nil, nil, im.BYTE)
-OneSourceOneDest("ProcessDirectConv", nil, nil, nil, im.BYTE)
-OneSourceOneDest("ProcessNegative")
-OneSourceOneDest("ProcessRangeContrastThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessLocalMaxThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessThreshold", nil, nil, im.BINARY, nil)
-TwoSourcesOneDest("ProcessThresholdByDiff")
-OneSourceOneDest("ProcessHysteresisThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessUniformErrThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessDifusionErrThreshold")
-OneSourceOneDest("ProcessPercentThreshold")
-OneSourceOneDest("ProcessOtsuThreshold")
-OneSourceOneDest("ProcessMinMaxThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessSliceThreshold", nil, nil, im.BINARY, nil)
-OneSourceOneDest("ProcessPixelate")
-OneSourceOneDest("ProcessPosterize")
-
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "im"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "im"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("libtiff/*.c"),
- matchfiles("libjpeg/*.c"),
- matchfiles("liblzf/*.c"),
- matchfiles("zlib/*.c"),
- "libpng/png.c", "libpng/pngget.c", "libpng/pngread.c", "libpng/pngrutil.c", "libpng/pngwtran.c",
- "libpng/pngerror.c", "libpng/pngmem.c", "libpng/pngrio.c", "libpng/pngset.c", "libpng/pngwio.c",
- "libpng/pngpread.c", "libpng/pngrtran.c", "libpng/pngtrans.c", "libpng/pngwrite.c", "libpng/pngwutil.c",
- matchfiles("libexif/canon/*.c"),
- matchfiles("libexif/olympus/*.c"),
- matchfiles("libexif/pentax/*.c"),
- matchfiles("libexif/*.c"),
- "old_imcolor.c", "old_imresize.c", "tiff_binfile.c", "im_converttype.cpp",
- "im_attrib.cpp", "im_format.cpp", "im_format_tga.cpp", "im_filebuffer.cpp",
- "im_bin.cpp", "im_format_all.cpp", "im_format_tiff.cpp", "im_format_raw.cpp",
- "im_binfile.cpp", "im_format_sgi.cpp", "im_datatype.cpp", "im_format_pcx.cpp",
- "im_colorhsi.cpp", "im_format_bmp.cpp", "im_image.cpp", "im_rgb2map.cpp",
- "im_colormode.cpp", "im_format_gif.cpp", "im_lib.cpp", "im_format_pnm.cpp",
- "im_colorutil.cpp", "im_format_ico.cpp", "im_palette.cpp", "im_format_png.cpp",
- "im_convertbitmap.cpp", "im_format_led.cpp", "im_counter.cpp", "im_str.cpp",
- "im_convertcolor.cpp", "im_format_jpeg.cpp", "im_fileraw.cpp", "im_format_krn.cpp",
- "im_file.cpp", "im_format_ras.cpp", "old_im.cpp", "im_compress.cpp",
-}
-
-package.includepaths = { ".", "../include", "libtiff", "libjpeg", "libexif", "libpng", "zlib" }
-package.defines = { "JPEG_SUPPORT", "ZIP_SUPPORT", "OJPEG_SUPPORT", "PIXARLOG_SUPPORT", "PNG_NO_STDIO", "PNG_TIME_RFC1123_SUPPORTED" }
-
-if (options.os == "windows") then
- tinsert(package.files, {"im_sysfile_win32.cpp", "im_dib.cpp", "im_dibxbitmap.cpp"})
-
- if (options.target ~= "gnu") then
- -- optimize PNG lib for VC
- tinsert(package.files, "libpng/pngvcrd.c")
- tinsert(package.defines, "PNG_USE_PNGVCRD")
- end
-else
- tinsert(package.files, "im_sysfile_unix.cpp")
-
- if (options.os == "linux") then
- --package.buildoptions = { "-W -Wall -ansi -pedantic" }
-
- -- optimize PNG lib for Linux in x86
- tinsert(package.files, "libpng/pnggccrd.c")
- tinsert(package.defines, "PNG_USE_PNGGCCRD")
- end
-end
-
-fixPackagePath(package.files)
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "im_process"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "process/im_arithmetic_bin.cpp", "process/im_morphology_gray.cpp", "process/im_quantize.cpp",
- "process/im_arithmetic_un.cpp", "process/im_geometric.cpp", "process/im_render.cpp",
- "process/im_color.cpp", "process/im_histogram.cpp", "process/im_resize.cpp",
- "process/im_convolve.cpp", "process/im_houghline.cpp", "process/im_statistics.cpp",
- "process/im_convolve_rank.cpp", "process/im_logic.cpp", "process/im_threshold.cpp",
- "process/im_effects.cpp", "process/im_morphology_bin.cpp", "process/im_tonegamut.cpp",
- "process/im_canny.cpp", "process/im_distance.cpp", "process/im_analyze.cpp"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "im_jp2"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("libjasper/base/*.c", "libjasper/jp2/*.c", "libjasper/jpc/*.c"),
- "jas_binfile.c", "im_format_jp2.cpp"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "libjasper" }
-package.defines = { "EXCLUDE_JPG_SUPPORT", "EXCLUDE_MIF_SUPPORT", "EXCLUDE_PNM_SUPPORT",
- "EXCLUDE_BMP_SUPPORT", "EXCLUDE_PGX_SUPPORT", "EXCLUDE_RAS_SUPPORT",
- "EXCLUDE_TIFF_SUPPORT", "JAS_GEO_OMIT_PRINTING_CODE" }
-
-tinsert(package.defines, "JAS_TYPES")
-
-if (options.os == "linux") then
- tinsert(package.defines, "HAVE_UNISTD_H")
-end
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "im_lua3.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(LUA3)/include", "$(CD)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "im_fftw"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("fftw/*.c"),
- "process/im_fft.cpp"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "fftw" }
-package.defines = { "FFTW_ENABLE_FLOAT" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "im_fftw3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("fftw3/api/*.c"),
- matchfiles("fftw3/reodft/*.c"),
- matchfiles("fftw3/kernel/*.c"),
- matchfiles("fftw3/dft/*.c", "fftw3/dft/codelets/*.c", "fftw3/dft/codelets/inplace/*.c", "fftw3/dft/codelets/standard/*.c"),
- matchfiles("fftw3/rdft/*.c", "fftw3/rdft/codelets/*.c", "fftw3/rdft/codelets/hc2r/*.c", "fftw3/rdft/codelets/r2hc/*.c", "fftw3/rdft/codelets/r2r/*.c"),
- "process/im_fft.cpp"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "fftw3/kernel", "fftw3/dft", "fftw3/rdft", "fftw3/api",
- "fftw3/reodft", "fftw3/rdft/codelets", "fftw3/dft/codelets" }
-package.defines = { "USE_FFTW3" }
-
-if (options.os == "windows") then
- if (options.target == "gnu") then
- tinsert(package.defines, "HAVE_UINTPTR_T")
- end
-end
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "lua5/imlua.c", "lua5/imlua_aux.c", "lua5/imlua_convert.c", "lua5/imlua_file.c",
- "lua5/imlua_image.c", "lua5/imlua_palette.c", "lua5/imlua_util.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "lua5", "$(LUA51)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua_cd51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "lua5/imlua_cd.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "lua5", "$(LUA51)/include", "$(CD)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua_process51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "lua5/imlua_process.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "lua5", "$(LUA51)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua_capture51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "lua5/imlua_capture.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "lua5", "$(LUA51)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "imlua_fftw51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "lua5/imlua_fftw.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "lua5", "$(LUA51)/include" }
-
----------------------------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-function tremove(t, value)
- local index = -1
- function f(i, v)
- if (v == value) then
- index = i
- end
- end
- table.foreachi(t, f)
- if (index ~= -1) then
- table.remove(t, index)
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iup"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("*.c")
-}
-
-package.includepaths = { ".", "../include" }
-
-if (options.os == "windows") then
- tinsert(package.files, matchfiles("win/*.c"))
- tinsert(package.includepaths, {"win"})
- package.defines = {"_WIN32_WINNT=0x0400"}
-else
- tinsert(package.files, matchfiles("mot/*.c"))
- tremove(package.files[2], "mot/ComboBox1.c")
- tinsert(package.includepaths, {"mot", "/usr/X11R6/include"})
- package.defines = {"LINUX"}
-end
-
-fixPackagePath(package.files)
-
-----------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iupcontrols"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- matchfiles("*.c"),
- matchfiles("mask/*.c"),
- matchfiles("matrix/*.c"),
- matchfiles("tree/*.c"),
- matchfiles("color/*.c")
-}
-
-package.includepaths = { ".", "../include", "../src", "$(CD)/include" }
-
-if (options.os == "linux") then
- package.defines = { "_MOTIF_" }
- tinsert(package.includepaths, {"/usr/X11R6/include"})
-end
-
-fixPackagePath(package.files)
-
-----------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iupgl"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.includepaths = { ".", "../include" }
-
-if (options.os == "windows") then
- package.files = { "iupglw.c" }
-else
- package.files = { "iupglx.c", "GL/GLwMDrawA.c" }
- tinsert(package.includepaths, {"/usr/X11R6/include"})
-end
-
-fixPackagePath(package.files)
-
-----------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iupim"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.includepaths = { ".", "../include", "$(IM)/include" }
-
-package.files = { "iupim.c" }
-
-fixPackagePath(package.files)
-
-----------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "ledc"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "exe"
-
-package.files =
-{
- "lex.yy.c", "y.tab.c", "main.c"
-}
-
-package.includepaths = { "." }
-
-fixPackagePath(package.files)
-
-----------------------------------------------------
--- Utilities
-
-function printvars()
- local n,v = nextvar(nil)
- print("--printvars Start--")
- while n ~= nil do
- print(tostring(n).."="..tostring(v))
- n,v = nextvar(n)
- end
- print("--printvars End--")
-end
-
-function printtable(t)
- local n,v = next(t, nil)
- print("--printtable Start--")
- while n ~= nil do
- print(tostring(n).."="..tostring(v))
- n,v = next(t, n)
- end
- print("--printtable End--")
-end
-
-function print_version_info()
- print(_VERSION .. " " .. iup._LUA_COPYRIGHT)
- if (im) then print(im._VERSION .. " " .. im._COPYRIGHT) end
- if (cd and cd._VERSION) then print(cd._VERSION .. " " .. cd._COPYRIGHT) end
- print(iup._VERSION .. " " .. iup._COPYRIGHT)
- print("")
- print("IUP Info")
- print(" System: " .. iup.GetGlobal("SYSTEM"))
- print(" System Version: " .. iup.GetGlobal("SYSTEMVERSION"))
- local mot = iup.GetGlobal("MOTIFVERSION")
- if (mot) then print(" Motif Version: ", mot) end
- print(" Screen Size: " .. iup.GetGlobal("SCREENSIZE"))
- print(" Screen Depth: " .. iup.GetGlobal("SCREENDEPTH"))
- if (iup.GL_VENDOR) then print(" OpenGL Vendor: " .. iup.GL_VENDOR) end
- if (iup.GL_RENDERER) then print(" OpenGL Renderer: " .. iup.GL_RENDERER) end
- if (iup.GL_VERSION) then print(" OpenGL Version: " .. iup.GL_VERSION) end
-end
-
--- IUPLUA Full Application
-
-lastfile = nil -- Last file open
-
-mulCommands = iupmultiline{expand=IUP_YES, size="200x120", font="COURIER_NORMAL_10"}
-poslabel = iuplabel{title="0:0", size="50x"}
-filelabel = iuplabel{title="", size="50x", expand="HORIZONTAL"}
-
-mulCommands.caretcb = function(self, lin, col)
- poslabel.title = lin..":"..col
-end
-
-butExecute = iupbutton{size="50x15", title = "Execute", action="dostring(mulCommands.value)"}
-butClearCommands = iupbutton{size="50x15", title = "Clear", action = "mulCommands.value = '' filelabel.title = '' lastfile = nil"}
-butLoadFile = iupbutton{size="50x15", title = "Load..."}
-butSaveasFile = iupbutton{size="50x15", title = "Save As..."}
-butSaveFile = iupbutton{size="50x15", title = "Save"}
-
-function butSaveFile:action()
- if (lastfile == nil) then
- butSaveasFile:action()
- else
- novoarq = openfile (lastfile, "w+")
- if (novoarq ~= nil) then
- write (novoarq,mulCommands.value)
- closefile (novoarq)
- else
- error ("Cannot Save file "..filename)
- end
- end
-end
-
-function butSaveasFile:action()
- local filedlg = iupfiledlg{dialogtype = "SAVE", title = "Save File", filter = "*.lua", filterinfo = "Lua files",allownew=yes}
- IupPopup(filedlg,IUP_LEFT, IUP_LEFT)
- local status = filedlg.status
- lastfile = filedlg.value
- filelabel.title = lastfile
- IupDestroy(filedlg)
- if status ~= "-1" then
- if (lastfile == nil) then
- error ("Cannot Save file "..lastfile)
- end
- local novoarq = openfile (lastfile, "w+")
- if (novoarq ~= nil) then
- write (novoarq,mulCommands.value)
- closefile (novoarq)
- else
- error ("Cannot Save file")
- end
- end
-end
-
-function butLoadFile:action()
- local filedlg = iupfiledlg{dialogtype="OPEN", title="Load File", filter="*.lua", filterinfo="Lua Files", allownew="NO"}
- filedlg:popup(IUP_CENTER, IUP_CENTER)
- local status = filedlg.status
- local newfile = filedlg.value
- IupDestroy(filedlg)
- if (status == "-1") or (status == "1") then
- if (status == "1") then
- error ("Cannot load file "..newfile)
- end
- else
- local fp = openfile (newfile, "r")
- if (fp == nil) then
- error ("Cannot load file "..newfile)
- else
- mulCommands.value = read (fp,"*a")
- closefile (fp)
- lastfile = newfile
- filelabel.title = lastfile
- end
- end
-end
-
-vbxConsole = iupvbox
-{
- iupframe{iuphbox{iupvbox{butLoadFile, butSaveFile, butSaveasFile, butClearCommands, butExecute; margin="0x0", gap="10"}, iupvbox{filelabel, mulCommands, poslabel; alignment="ARIGHT"}; alignment="ATOP"}; title="Commands"}
- ;alignment="ACENTER", margin="5x5", gap="5"
-}
-
--- Main Menu Definition.
-
-mnuMain = iupmenu
-{
- iupsubmenu
- {
- iupmenu
- {
- iupitem{title="Exit", action="return IUP_CLOSE"}
- }; title="File"
- },
- iupsubmenu{iupmenu
- {
- iup.item{title="Print Version Info...", action=print_version_info},
- iupitem{title="About...", action="dlgAbout:popup(IUP_CENTER, IUP_CENTER)"}
- };title="Help"}
-}
-
--- Main Dialog Definition.
-
-dlgMain = iupdialog{vbxConsole; title="Complete IupLua3 Interpreter", menu=mnuMain, close_cb = "return IUP_CLOSE"}
-
--- About Dialog Definition.
-
-dlgAbout = iupdialog
-{
- iupvbox
- {
- iuplabel{title="Complete IupLua3 Interpreter"},
- iupfill{size="5"},
- iupfill{size="5"},
- iupframe
- {
- iupvbox
- {
- iuplabel{title="Tecgraf/PUC-Rio"},
- iuplabel{title="Mark/Ovídio/Scuri"},
- iuplabel{title="iup@tecgraf.puc-rio.br"}
- }
- },
- iupfill{size="5"},
- iupbutton{title="OK", action="return IUP_CLOSE", size="50X20"}
- ;margin="10x10", alignment="ACENTER"
- }
- ;maxbox=IUP_NO, minbox=IUP_NO, resize=IUP_NO, title="About"
-}
-
--- Displays the Main Dialog
-
-dlgMain:show()
-
-IupMainLoop()
-
-IupDestroy(dlgMain)
-IupDestroy(dlgAbout)
-
--- #################################################################################
--- Constants
--- #################################################################################
-
-
-IUP_ERROR = 1 iup.ERROR = IUP_ERROR
-IUP_NOERROR = 0 iup.NOERROR = IUP_NOERROR
-IUP_OPENED = -1 iup.OPENED = IUP_OPENED
-IUP_INVALID = -1 iup.INVALID = IUP_INVALID
-
-IUP_CENTER = 65535 iup.CENTER = IUP_CENTER
-IUP_LEFT = 65534 iup.LEFT = IUP_LEFT
-IUP_RIGHT = 65533 iup.RIGHT = IUP_RIGHT
-IUP_MOUSEPOS = 65532 iup.MOUSEPOS = IUP_MOUSEPOS
-IUP_CURRENT = 65531 iup.CURRENT = IUP_CURRENT
-IUP_CENTERPARENT = 65530 iup.CENTERPARENT = IUP_CENTERPARENT
-IUP_TOP = IUP_LEFT iup.TOP = IUP_TOP
-IUP_BOTTOM = IUP_RIGHT iup.BOTTOM = IUP_BOTTOM
-IUP_ANYWHERE = IUP_CURRENT iup.ANYWHERE = IUP_ANYWHERE
-
-IUP_BUTTON1 = 49 iup.BUTTON1 = IUP_BUTTON1 -- '1'
-IUP_BUTTON2 = 50 iup.BUTTON2 = IUP_BUTTON2 -- '2'
-IUP_BUTTON3 = 51 iup.BUTTON3 = IUP_BUTTON3 -- '3'
-IUP_BUTTON4 = 52 iup.BUTTON4 = IUP_BUTTON4 -- '4'
-IUP_BUTTON5 = 53 iup.BUTTON5 = IUP_BUTTON5 -- '5'
-
-IUP_IGNORE = -1 iup.IGNORE = IUP_IGNORE
-IUP_DEFAULT = -2 iup.DEFAULT = IUP_DEFAULT
-IUP_CLOSE = -3 iup.CLOSE = IUP_CLOSE
-IUP_CONTINUE = -4 iup.CONTINUE = IUP_CONTINUE
-
-IUP_SBUP = 0 iup.SBUP = IUP_SBUP
-IUP_SBDN = 1 iup.SBDN = IUP_SBDN
-IUP_SBPGUP = 2 iup.SBPGUP = IUP_SBPGUP
-IUP_SBPGDN = 3 iup.SBPGDN = IUP_SBPGDN
-IUP_SBPOSV = 4 iup.SBPOSV = IUP_SBPOSV
-IUP_SBDRAGV = 5 iup.SBDRAGV = IUP_SBDRAGV
-IUP_SBLEFT = 6 iup.SBLEFT = IUP_SBLEFT
-IUP_SBRIGHT = 7 iup.SBRIGHT = IUP_SBRIGHT
-IUP_SBPGLEFT = 8 iup.SBPGLEFT = IUP_SBPGLEFT
-IUP_SBPGRIGHT = 9 iup.SBPGRIGHT = IUP_SBPGRIGHT
-IUP_SBPOSH = 10 iup.SBPOSH = IUP_SBPOSH
-IUP_SBDRAGH = 11 iup.SBDRAGH = IUP_SBDRAGH
-
-IUP_SHOW = 0 iup.SHOW = IUP_SHOW
-IUP_RESTORE = 1 iup.RESTORE = IUP_RESTORE
-IUP_MINIMIZE = 2 iup.MINIMIZE = IUP_MINIMIZE
-IUP_MAXIMIZE = 3 iup.MAXIMIZE = IUP_MAXIMIZE
-IUP_HIDE = 4 iup.HIDE = IUP_HIDE
-
-RED = IupRGB(1, 0, 0) iup.RED = RED
-GREEN = IupRGB(0, 1, 0) iup.GREEN = GREEN
-BLUE = IupRGB(0, 0, 1) iup.BLUE = BLUE
-BLACK = IupRGB(0, 0, 0) iup.BLACK = BLACK
-WHITE = IupRGB(1, 1, 1) iup.WHITE = WHITE
-YELLOW = IupRGB(1, 1, 0) iup.YELLOW = YELLOW
-
-IUP_ON = "ON" iup.ON = IUP_ON
-IUP_OFF = "OFF" iup.OFF = IUP_OFF
-IUP_YES = "YES" iup.YES = IUP_YES
-IUP_NO = "NO" iup.NO = IUP_NO
-IUP_APPEND = "APPEND" iup.APPEND = IUP_APPEND
-IUP_VERTICAL = "VERTICAL" iup.VERTICAL = IUP_VERTICAL
-IUP_HORIZONTAL ="HORIZONTAL" iup.HORIZONTAL =IUP_HORIZONTAL
-
-IUP_ACENTER = "ACENTER" iup.ACENTER = IUP_ACENTER
-IUP_ALEFT = "ALEFT" iup.ALEFT = IUP_ALEFT
-IUP_ARIGHT = "ARIGHT" iup.ARIGHT = IUP_ARIGHT
-IUP_ATOP = "ATOP" iup.ATOP = IUP_ATOP
-IUP_ABOTTOM = "ABOTTOM" iup.ABOTTOM = IUP_ABOTTOM
-
-IUP_NORTH = "NORTH" iup.NORTH = IUP_NORTH
-IUP_SOUTH = "SOUTH" iup.SOUTH = IUP_SOUTH
-IUP_WEST = "WEST" iup.WEST = IUP_WEST
-IUP_EAST = "EAST" iup.EAST = IUP_EAST
-IUP_NE = "NE" iup.NE = IUP_NE
-IUP_SE = "SE" iup.SE = IUP_SE
-IUP_NW = "NW" iup.NW = IUP_NW
-IUP_SW = "SW" iup.SW = IUP_SW
-
-IUP_FULL = "FULL" iup.FULL = IUP_FULL
-IUP_HALF = "HALF" iup.HALF = IUP_HALF
-IUP_THIRD = "THIRD" iup.THIRD = IUP_THIRD
-IUP_QUARTER = "QUARTER" iup.QUARTER = IUP_QUARTER
-IUP_EIGHTH = "EIGHTH" iup.EIGHTH = IUP_EIGHTH
-
-IUP_ARROW = "ARROW" iup.ARROW = IUP_ARROW
-IUP_BUSY = "BUSY" iup.BUSY = IUP_BUSY
-IUP_RESIZE_N = "RESIZE_N" iup.RESIZE_N = IUP_RESIZE_N
-IUP_RESIZE_S = "RESIZE_S" iup.RESIZE_S = IUP_RESIZE_S
-IUP_RESIZE_E = "RESIZE_E" iup.RESIZE_E = IUP_RESIZE_E
-IUP_RESIZE_W = "RESIZE_W" iup.RESIZE_W = IUP_RESIZE_W
-IUP_RESIZE_NE = "RESIZE_NE" iup.RESIZE_NE = IUP_RESIZE_NE
-IUP_RESIZE_NW = "RESIZE_NW" iup.RESIZE_NW = IUP_RESIZE_NW
-IUP_RESIZE_SE = "RESIZE_SE" iup.RESIZE_SE = IUP_RESIZE_SE
-IUP_RESIZE_SW = "RESIZE_SW" iup.RESIZE_SW = IUP_RESIZE_SW
-IUP_MOVE = "MOVE" iup.MOVE = IUP_MOVE
-IUP_HAND = "HAND" iup.HAND = IUP_HAND
-IUP_NONE = "NONE" iup.NONE = IUP_NONE
-IUP_IUP = "IUP" iup.IUP = IUP_IUP
-IUP_CROSS = "CROSS" iup.CROSS = IUP_CROSS
-IUP_PEN = "PEN" iup.PEN = IUP_PEN
-IUP_TEXT = "TEXT" iup.TEXT = IUP_TEXT
-IUP_RESIZE_C = "RESIZE_C" iup.RESIZE_C = IUP_RESIZE_C
-IUP_OPENHAND = "OPENHAND" iup.OPENHAND = IUP_OPENHAND
-
-IUP_HELVETICA_NORMAL_8 = "HELVETICA_NORMAL_8" iup.HELVETICA_NORMAL_8 = IUP_HELVETICA_NORMAL_8
-IUP_HELVETICA_ITALIC_8 = "HELVETICA_ITALIC_8" iup.HELVETICA_ITALIC_8 = IUP_HELVETICA_ITALIC_8
-IUP_HELVETICA_BOLD_8 = "HELVETICA_BOLD_8" iup.HELVETICA_BOLD_8 = IUP_HELVETICA_BOLD_8
-IUP_HELVETICA_NORMAL_10 = "HELVETICA_NORMAL_10" iup.HELVETICA_NORMAL_10 = IUP_HELVETICA_NORMAL_10
-IUP_HELVETICA_ITALIC_10 = "HELVETICA_ITALIC_10" iup.HELVETICA_ITALIC_10 = IUP_HELVETICA_ITALIC_10
-IUP_HELVETICA_BOLD_10 = "HELVETICA_BOLD_10" iup.HELVETICA_BOLD_10 = IUP_HELVETICA_BOLD_10
-IUP_HELVETICA_NORMAL_12 = "HELVETICA_NORMAL_12" iup.HELVETICA_NORMAL_12 = IUP_HELVETICA_NORMAL_12
-IUP_HELVETICA_ITALIC_12 = "HELVETICA_ITALIC_12" iup.HELVETICA_ITALIC_12 = IUP_HELVETICA_ITALIC_12
-IUP_HELVETICA_BOLD_12 = "HELVETICA_BOLD_12" iup.HELVETICA_BOLD_12 = IUP_HELVETICA_BOLD_12
-IUP_HELVETICA_NORMAL_14 = "HELVETICA_NORMAL_14" iup.HELVETICA_NORMAL_14 = IUP_HELVETICA_NORMAL_14
-IUP_HELVETICA_ITALIC_14 = "HELVETICA_ITALIC_14" iup.HELVETICA_ITALIC_14 = IUP_HELVETICA_ITALIC_14
-IUP_HELVETICA_BOLD_14 = "HELVETICA_BOLD_14" iup.HELVETICA_BOLD_14 = IUP_HELVETICA_BOLD_14
-IUP_COURIER_NORMAL_8 = "COURIER_NORMAL_8" iup.COURIER_NORMAL_8 = IUP_COURIER_NORMAL_8
-IUP_COURIER_ITALIC_8 = "COURIER_ITALIC_8" iup.COURIER_ITALIC_8 = IUP_COURIER_ITALIC_8
-IUP_COURIER_BOLD_8 = "COURIER_BOLD_8" iup.COURIER_BOLD_8 = IUP_COURIER_BOLD_8
-IUP_COURIER_NORMAL_10 = "COURIER_NORMAL_10" iup.COURIER_NORMAL_10 = IUP_COURIER_NORMAL_10
-IUP_COURIER_ITALIC_10 = "COURIER_ITALIC_10" iup.COURIER_ITALIC_10 = IUP_COURIER_ITALIC_10
-IUP_COURIER_BOLD_10 = "COURIER_BOLD_10" iup.COURIER_BOLD_10 = IUP_COURIER_BOLD_10
-IUP_COURIER_NORMAL_12 = "COURIER_NORMAL_12" iup.COURIER_NORMAL_12 = IUP_COURIER_NORMAL_12
-IUP_COURIER_ITALIC_12 = "COURIER_ITALIC_12" iup.COURIER_ITALIC_12 = IUP_COURIER_ITALIC_12
-IUP_COURIER_BOLD_12 = "COURIER_BOLD_12" iup.COURIER_BOLD_12 = IUP_COURIER_BOLD_12
-IUP_COURIER_NORMAL_14 = "COURIER_NORMAL_14" iup.COURIER_NORMAL_14 = IUP_COURIER_NORMAL_14
-IUP_COURIER_ITALIC_14 = "COURIER_ITALIC_14" iup.COURIER_ITALIC_14 = IUP_COURIER_ITALIC_14
-IUP_COURIER_BOLD_14 = "COURIER_BOLD_14" iup.COURIER_BOLD_14 = IUP_COURIER_BOLD_14
-IUP_TIMES_NORMAL_8 = "TIMES_NORMAL_8" iup.TIMES_NORMAL_8 = IUP_TIMES_NORMAL_8
-IUP_TIMES_ITALIC_8 = "TIMES_ITALIC_8" iup.TIMES_ITALIC_8 = IUP_TIMES_ITALIC_8
-IUP_TIMES_BOLD_8 = "TIMES_BOLD_8" iup.TIMES_BOLD_8 = IUP_TIMES_BOLD_8
-IUP_TIMES_NORMAL_10 = "TIMES_NORMAL_10" iup.TIMES_NORMAL_10 = IUP_TIMES_NORMAL_10
-IUP_TIMES_ITALIC_10 = "TIMES_ITALIC_10" iup.TIMES_ITALIC_10 = IUP_TIMES_ITALIC_10
-IUP_TIMES_BOLD_10 = "TIMES_BOLD_10" iup.TIMES_BOLD_10 = IUP_TIMES_BOLD_10
-IUP_TIMES_NORMAL_12 = "TIMES_NORMAL_12" iup.TIMES_NORMAL_12 = IUP_TIMES_NORMAL_12
-IUP_TIMES_ITALIC_12 = "TIMES_ITALIC_12" iup.TIMES_ITALIC_12 = IUP_TIMES_ITALIC_12
-IUP_TIMES_BOLD_12 = "TIMES_BOLD_12" iup.TIMES_BOLD_12 = IUP_TIMES_BOLD_12
-IUP_TIMES_NORMAL_14 = "TIMES_NORMAL_14" iup.TIMES_NORMAL_14 = IUP_TIMES_NORMAL_14
-IUP_TIMES_ITALIC_14 = "TIMES_ITALIC_14" iup.TIMES_ITALIC_14 = IUP_TIMES_ITALIC_14
-IUP_TIMES_BOLD_14 = "TIMES_BOLD_14" iup.TIMES_BOLD_14 = IUP_TIMES_BOLD_14
-
-
-
--- #################################################################################
--- Private functions
--- #################################################################################
-
--- maps Ihandles into Lua objects
-iup_handles = {}
-
-settagmethod(iuplua_tag, "gettable", iup_gettable)
-settagmethod(iuplua_tag, "settable", iup_settable)
-settagmethod (tag({}), "index", iup_index)
-
-function _ALERT(s)
- local bt = iupbutton{title="Ok", size="60", action="return IUP_CLOSE"}
- local ml = iupmultiline{expand="YES", readonly="YES", value=s, size="300x150"}
- local vb = iupvbox{ml, bt; alignment="ACENTER", margin="10x10", gap="10"}
- local dg = iupdialog{vb; title="Lua Error",defaultesc=bt,defaultenter=bt,startfocus=bt}
- dg:popup(IUP_CENTER, IUP_CENTER)
- dg:destroy()
-end
-
-function type_string (o)
- return type(o) == "string"
-end
-
-function type_number (o)
- return type(o) == "number"
-end
-
-function type_nil (o)
- return type(o) == "nil"
-end
-
-function type_function (o)
- return type(o) == "function"
-end
-
-function type_widget(w)
- if w then
- return iup_handles[w]
- else
- return nil
- end
-end
-
-function type_menu (o)
- return type_widget(o) and (o.parent==IUPMENU)
-end
-
-function type_item (o)
- return type_widget(o) and (o.parent==IUPITEM or o.parent==IUPSUBMENU or o.parent==IUPSEPARATOR)
-end
-
-function iupCallMethod(name, ...)
- local handle = arg[1] -- always the handle
-
- local func = handle[name] -- this is the old name
- if (not func) then
- local full_name = strlower(iup_callbacks[name][1])
- func = handle[full_name] -- check also for the full name
-
- if (not func) then
- return
- end
- end
-
- if type_function (func) then
- return call(func, arg)
- elseif type_string(func) then
- local temp = self
- self = handle
- local result = dostring(func)
- self = temp
- return result
- else
- return IUP_ERROR
- end
-end
-
-function iupSetName (handle)
- if not type_string(iup_handles[handle].IUP_name) then
- iup_handles[handle].IUP_name = format("_IUPLUA_NAME(%s)", tostring(handle))
- IupSetHandle(handle.IUP_name, handle)
- end
-end
-
-function iupCreateChildrenNames (obj)
- if obj.parent.parent == COMPOSITION then
- local i = 1
- while obj[i] do
- iupCreateChildrenNames (obj[i])
- i = i+1
- end
- elseif obj.parent == IUPFRAME then
- iupCreateChildrenNames (obj[1])
- else
- iupSetName (obj)
- end
-end
-
-
--- #################################################################################
--- Public Functions
--- #################################################################################
-
-
-function IupRGB (red, green, blue)
- return floor(red*255).." "..floor(green*255).." "..floor(blue*255)
-end
-iup.RGB = IupRGB
-
-function IupRegisterHandle(handle, typename)
- if not iup_handles[handle] then
- local obj = getglobal("IUP"..strupper(typename))
- if not obj then
- obj = WIDGET
- end
- iup_handles[handle] = { parent=obj, handle=handle }
- end
- return handle
-end
-iup.RegisterHandle = IupRegisterHandle
-
-function IupGetFromC(obj)
- local handle = IupGetHandle(obj[1])
- return IupRegisterHandle(handle, IupGetType(handle))
-end
-
-iup.GetFromC = function (name)
- local handle = IupGetHandle(name)
- return IupRegisterHandle(handle, IupGetType(handle))
-end
-
-
--- #################################################################################
--- Widgets
--- #################################################################################
-
-
--- "type" is used to check the type of each parameter in the creation table
-WIDGET = {type = {}}
-
--- called by the iupxxx functions
--- obj is a lua table
-function WIDGET:Constructor(obj)
- -- the parent of the table is the widget class used to create the control
- obj.parent = self
-
- -- check the table parameters
- self:checkParams(obj)
-
- -- create the IUP control, calling iupCreateXXX
- obj.handle = self:CreateIUPelement(obj)
-
- -- set the parameters that are attributes
- self:setAttributes(obj)
-
- -- save the table indexed by the handle
- iup_handles[obj.handle] = obj
-
- -- the returned value is the handle, not the table
- return obj.handle
-end
-
-function WIDGET:checkParams (obj)
- local type = self.type
- local param, func = next(type, nil)
- while param do
- if not func(obj[param]) then
- error("parameter " .. param .. " has wrong value or is not initialized")
- end
- param, func = next(type, param)
- end
-end
-
-function WIDGET:setAttributes (obj)
- local temp = {}
- local f = next(obj, nil)
- while f do
- temp[f] = 1
- f = next(obj, f)
- end
- f = next(temp, nil)
- while f do
- obj:set (f, obj[f])
- f = next(temp, f)
- end
-end
-
-function WIDGET:get(index)
- if type_string (index) then
- if (iup_callbacks[index]) then
- return self[index]
- else
- local INDEX = strupper (index)
- local value = IupGetAttribute (self.handle, INDEX)
- if value then
- local handle = IupGetHandle (value)
- if handle then
- return handle
- else
- return value
- end
- end
- end
- end
- return self[index]
-end
-
-function WIDGET:set(index, value)
- if type_string (index) then
- local INDEX = strupper (index)
- local cb = iup_callbacks[index]
-
- -- workaround for resize attribute in dialog
- if (index == "resize" and IupGetType(self.handle) == "dialog") then
- cb = nil
- end
-
- if (cb) then
- local func = cb[2]
- if (not func) then
- func = cb[IupGetType(self.handle)]
- end
- iupSetCallback(self.handle, cb[1], func, value)
- self[index] = value
- return
- elseif type_string(value) or type_number(value) then
- IupSetAttribute(self.handle, INDEX, value)
- return
- elseif type_nil(value) then
- local old_value = IupGetAttribute(self.handle, INDEX)
- if old_value then
- IupSetAttribute(self.handle, INDEX, value)
- return
- end
- elseif type_widget(value) then
- iupSetName(value)
- IupSetAttribute(self.handle, INDEX, value.IUP_name)
- return
- end
- end
- self[index] = value
-end
-
-function WIDGET:r_destroy()
- local i = 1
- local elem = self[i]
- while elem do
- if type_widget (elem) and elem.IUP_parent then
- if elem.IUP_parent == self then
- elem.IUP_parent = nil
- elem:r_destroy ()
- else -- wrong parent
- error ("Internal table inconsistency")
- exit()
- end
- end
-
- i = i + 1
- elem = self[i]
- end
- iup_handles[self] = nil
-end
-
-function WIDGET:destroy()
- self:r_destroy ()
- IupDestroy (self)
-end
-
-function WIDGET:detach()
- IupDetach (self)
- local parent = self.IUP_parent
- if parent then
- self.IUP_parent = nil
- local i = 1
- while parent[i] do
- if parent[i] == self then
- while parent[i+1] do
- parent[i] = parent[i+1]
- i = i+1
- end
- parent[i] = nil
- return
- end
- i = i+1
- end
- end
-end
-
-function WIDGET:append(o)
- if IupAppend (self, o) then
- o.IUP_parent = self
- local i = 1
- while self[i] do
- if self[i] == o then
- return i
- end
- i = i+1
- end
- iup_handles[self][i] = o
- return i
- else
- return nil
- end
-end
-
-function WIDGET:map()
- return IupMap(self)
-end
-
-function WIDGET:hide()
- return IupHide(self)
-end
-
-
--- ###############
-IUPTIMER = {parent = WIDGET}
-
-function IUPTIMER:CreateIUPelement (obj)
- return iupCreateTimer()
-end
-
-function iuptimer(o)
- return IUPTIMER:Constructor(o)
-end
-iup.timer = iuptimer
-
-
--- ###############
-IUPDIALOG = {parent = WIDGET, type = {type_widget}}
-
-function IUPDIALOG:CreateIUPelement (obj)
- local handle = iupCreateDialog(obj[1])
- obj[1].IUP_parent = handle
- return handle
-end
-
-function IUPDIALOG:show ()
- return IupShow(self)
-end
-
-function IUPDIALOG:showxy (x,y)
- return IupShowXY(self, x, y)
-end
-
-function IUPDIALOG:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-function iupdialog (o)
- return IUPDIALOG:Constructor (o)
-end
-iup.dialog = iupdialog
-
-
--- ###############
-IUPRADIO = {parent = WIDGET, type = {type_widget}}
-
-function IUPRADIO:CreateIUPelement (obj)
- local handle = iupCreateRadio (obj[1])
- obj[1].IUP_parent = handle
- return handle
-end
-
-function iupradio (o)
- local handle = IUPRADIO:Constructor (o)
- iupCreateChildrenNames (handle[1])
- return handle
-end
-iup.radio = iupradio
-
--- OLD STUFF
-function edntoggles (h)
- local tmp = {}
- local i = 1
- while h[i] do
- if type_string (h[i]) then
- tmp[i] = iuptoggle{title = h[i], action = h.action}
- else
- error ("option "..i.." must be a string")
- end
- i = i + 1
- end
-
- if h.value then
- local j = 1
- while h[j] and (h[j] ~= h.value) do
- j = j + 1
- end
- if h[j] then
- tmp.value = tmp[j]
- end
- elseif h.nvalue then
- tmp.value = tmp[h.nvalue]
- end
-
- return tmp
-end
-
--- OLD STUFF
-function edhradio (o)
- local toggles = edntoggles (o)
- return iupradio{edhbox (toggles); value = toggles.value}
-end
-
--- OLD STUFF
-function edvradio (o)
- local toggles = edntoggles (o)
- return iupradio{edvbox (toggles); value = toggles.value}
-end
-
-
--- ###############
-IUPMENU = {parent = WIDGET}
-
-function IUPMENU:checkParams (obj)
- local i = 1
- while obj[i] do
- local o = obj[i]
- if not type_item (o) then -- not a menu item
- if type (o) ~= 'table' then
- error("parameter " .. i .. " is not a table nor a menu item")
- elseif (o[1] and not type_string (o[1])) then
- error("parameter " .. i .. " does not have a string title")
- elseif (o[2] and not type_string (o[2]) and not type_function (o[2])
- and not type_widget (o[2])) then
- error("parameter " .. i .. " does not have an action nor a menu")
- end
- end
- i = i + 1
- end
-end
-
-function IUPMENU:CreateIUPelement (obj)
- local handle = iupCreateMenu ()
- local i = 1
- while obj[i] do
- local o = obj[i]
- local elem
- if type_widget (o) then -- predefined
- elem = o
- elseif not o[1] then -- Separator
- elem = iupseparator {}
- elseif type_widget (o[2]) then -- SubMenu
- o.title = o[1]
- o[1] = o[2]
- o[2] = nil
- elem = iupsubmenu(o)
- else -- Item
- o.title = o[1]
- o.action = o[2]
- o[1] = nil
- o[2] = nil
- elem = iupitem(o)
- end
- IupAppend (handle, elem)
- elem.IUP_parent = handle
- obj[i] = elem
- i = i + 1
- end
- return handle
-end
-
-function iupmenu (o)
- return IUPMENU:Constructor (o)
-end
-iup.menu = iupmenu
-
-function IUPMENU:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-
--- ###############
-COMPOSITION = {parent = WIDGET}
-
-function COMPOSITION:checkParams (obj)
- local i = 1
- while obj[i] do
- if not type_widget (obj[i]) then
- error("parameter " .. i .. " has wrong value or is not initialized")
- end
- i = i + 1
- end
-end
-
-function COMPOSITION:CreateIUPelement (obj)
- local handle = self:CreateBoxElement ()
- local filled = obj.filled
- local i = 1
- local n = 0
- while obj[i] do
- n = n + 1
- i = i + 1
- end
- i = 1
-
- if filled == IUP_YES then
- obj[i+n] = iupfill{}
- IupAppend (handle, obj[i+n])
- obj[i+n].IUP_parent = handle
- end
-
- while i <= n do
- IupAppend (handle, obj[i])
- obj[i].IUP_parent = handle
- i = i + 1
- if filled == IUP_YES then
- obj[i+n] = iupfill{}
- IupAppend (handle, obj[i+n])
- obj[i+n].IUP_parent = handle
- end
- end
- return handle
-end
-
-
--- ###############
-IUPHBOX = {parent = COMPOSITION}
-
-function IUPHBOX:CreateBoxElement ()
- return iupCreateHbox ()
-end
-
-function iuphbox (o)
- return IUPHBOX:Constructor (o)
-end
-iup.hbox = iuphbox
-
--- OLD STUFF
-function edhbox (o)
- o.filled = IUP_YES
- return IUPHBOX:Constructor (o)
-end
-
--- OLD STUFF
-function edfield (f)
- local l, t
- if (type_string (f.prompt) or type_number (f.prompt)) then
- l = iuplabel {title = f.prompt}
- else
- error ("parameter prompt has wrong value or is not initialized")
- end
- if f.value then
- t = iuptext {value = f.value}
- else
- t = iuptext {value = f.nvalue}
- end
- if t and l then
- return edhbox {l, t}
- else
- return nil
- end
-end
-
-
--- ###############
-IUPVBOX = {parent = COMPOSITION}
-
-function IUPVBOX:CreateBoxElement ()
- return iupCreateVbox ()
-end
-
-function iupvbox (o)
- return IUPVBOX:Constructor (o)
-end
-iup.vbox = iupvbox
-
--- OLD STUFF
-function edvbox (o)
- o.filled = IUP_YES
- return IUPVBOX:Constructor (o)
-end
-
-
--- ###############
-IUPZBOX = {parent = COMPOSITION}
-
-function IUPZBOX:CreateBoxElement ()
- return iupCreateZbox ()
-end
-
-function iupzbox (obj)
- local handle = IUPZBOX:Constructor (obj)
- local i = 1
- while obj[i] do
- iupSetName(handle[i])
- i = i+1
- end
- return handle
-end
-iup.zbox = iupzbox
-
-
--- ###############
-IUPFILL = {parent = WIDGET}
-
-function IUPFILL:CreateIUPelement (obj)
- return iupCreateFill ()
-end
-
-function iupfill (o)
- return IUPFILL:Constructor (o)
-end
-iup.fill = iupfill
-
-
--- ###############
-IUPBUTTON = {parent = WIDGET, type = {title = type_string}}
-
-function IUPBUTTON:CreateIUPelement (obj)
- if not obj.title and obj.image then
- obj.title=''
- end
- return iupCreateButton(obj.title)
-end
-
-function iupbutton (o)
- return IUPBUTTON:Constructor (o)
-end
-iup.button = iupbutton
-
-
--- ###############
-IUPTEXT = {parent = WIDGET}
-
-function IUPTEXT:CreateIUPelement (obj)
- return iupCreateText()
-end
-
-function iuptext (o)
- return IUPTEXT:Constructor (o)
-end
-iup.text = iuptext
-
-
--- ###############
-IUPMULTILINE = {parent = IUPTEXT}
-
-function IUPMULTILINE:CreateIUPelement (obj)
- return iupCreateMultiLine()
-end
-
-function iupmultiline (o)
- return IUPMULTILINE:Constructor (o)
-end
-iup.multiline = iupmultiline
-
-
--- ###############
-IUPLABEL = {parent = WIDGET, type = {title = type_string}}
-
-function IUPLABEL:CreateIUPelement (obj)
- if not obj.title and obj.image then
- obj.title=''
- end
- return iupCreateLabel (obj.title)
-end
-
-function iuplabel (o)
- return IUPLABEL:Constructor (o)
-end
-iup.label = iuplabel
-
-
--- ###############
-IUPTOGGLE = {parent = IUPBUTTON}
-
-function IUPTOGGLE:CreateIUPelement (obj)
- return iupCreateToggle (obj.title)
-end
-
-function iuptoggle (o)
- return IUPTOGGLE:Constructor (o)
-end
-iup.toggle = iuptoggle
-
-
--- ###############
-IUPITEM = {parent = IUPBUTTON}
-
-function IUPITEM:CreateIUPelement (obj)
- return iupCreateItem (obj.title)
-end
-
-function iupitem (o)
- return IUPITEM:Constructor (o)
-end
-iup.item = iupitem
-
-
--- ###############
-IUPSUBMENU = {parent = WIDGET, type = {type_menu; title = type_string}}
-
-function IUPSUBMENU:CreateIUPelement (obj)
- local h = iupCreateSubmenu (obj.title, obj[1])
- obj[1].IUP_parent = h
- return h
-end
-
-function iupsubmenu (o)
- return IUPSUBMENU:Constructor (o)
-end
-iup.submenu = iupsubmenu
-
-
--- ###############
-IUPSEPARATOR = {parent = WIDGET}
-
-function IUPSEPARATOR:CreateIUPelement (obj)
- return iupCreateSeparator ()
-end
-
-function iupseparator (o)
- return IUPSEPARATOR:Constructor (o)
-end
-iup.separator = iupseparator
-
-
--- ###############
-IUPFILEDLG = {parent = WIDGET}
-
-function IUPFILEDLG:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-function IUPFILEDLG:CreateIUPelement ()
- return iupCreateFileDlg ()
-end
-
-function iupfiledlg (o)
- return IUPFILEDLG:Constructor (o)
-end
-iup.filedlg = iupfiledlg
-
-
--- ###############
-IUPMESSAGEDLG = {parent = WIDGET}
-
-function IUPMESSAGEDLG:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-function IUPMESSAGEDLG:CreateIUPelement ()
- return iupCreateMessageDlg ()
-end
-
-function iupmessagedlg (o)
- return IUPMESSAGEDLG:Constructor (o)
-end
-iup.messagedlg = iupmessagedlg
-
-
--- ###############
-IUPCOLORDLG = {parent = WIDGET}
-
-function IUPCOLORDLG:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-function IUPCOLORDLG:CreateIUPelement ()
- return iupCreateColorDlg ()
-end
-
-function iupcolordlg (o)
- return IUPCOLORDLG:Constructor (o)
-end
-iup.colordlg = iupcolordlg
-
-
--- ###############
-IUPFONTDLG = {parent = WIDGET}
-
-function IUPFONTDLG:popup (x, y)
- return IupPopup (self, x, y)
-end
-
-function IUPFONTDLG:CreateIUPelement ()
- return iupCreateFontDlg ()
-end
-
-function iupfontdlg (o)
- return IUPFONTDLG:Constructor (o)
-end
-iup.fontdlg = iupfontdlg
-
-
--- ###############
-IUPUSER = {parent = WIDGET}
-
-function IUPUSER:CreateIUPelement ()
- return iupCreateUser ()
-end
-
-function iupuser ()
- return IUPUSER:Constructor ()
-end
-iup.user = iupuser
-
-
--- ###############
-IUPFRAME = {parent = WIDGET, type = {type_widget}}
-
-function IUPFRAME:CreateIUPelement (obj)
- local h = iupCreateFrame (obj[1])
- obj[1].IUP_parent = h
- return h
-end
-
-function iupframe (o)
- return IUPFRAME:Constructor (o)
-end
-iup.frame = iupframe
-
-
--- ###############
-IUPCANVAS = {parent = WIDGET}
-
-function IUPCANVAS:CreateIUPelement (obj)
- return iupCreateCanvas ()
-end
-
-function iupcanvas (o)
- return IUPCANVAS:Constructor (o)
-end
-iup.canvas = iupcanvas
-
-
--- ###############
-IUPLIST = {parent = WIDGET}
-
-function IUPLIST:CreateIUPelement (obj)
- return iupCreateList ()
-end
-
-function IUPLIST:get(index)
- if type (index) == 'number' then
- return IupGetAttribute (self.handle, ""..index)
- else
- return WIDGET.get(self, index)
- end
-end
-
-function IUPLIST:set (index, value)
- if type (index) == 'number' then
- if (type_string (value) or type_number (value)) then
- return IupSetAttribute (self.handle, ""..index, ""..value)
- elseif value == nil then
- return IupSetAttribute (self.handle, ""..index, value)
- end
- end
- return WIDGET.set(self, index, value)
-end
-
-function iuplist (o)
- return IUPLIST:Constructor (o)
-end
-iup.list = iuplist
-
-
--- ###############
-IUPIMAGE = {parent = WIDGET}
-
-function IUPIMAGE:checkParams (obj)
- local i = 1
- while obj[i] do
- local j = 1
- while obj[i][j] do
- if type (obj[i][j]) ~= 'number' then
- error ("non-numeric value in image definition")
- end
- j = j + 1
- end
-
- if obj.width and (j - 1) ~= obj.width then
- error ("inconsistent image lenght")
- else
- obj.width = j - 1
- end
-
- i = i + 1
- end
-
- obj.height = i - 1
-end
-
-function IUPIMAGE:CreateIUPelement (obj)
- local handle = iupCreateImage (obj.width, obj.height, obj)
- if type (obj.colors) == 'table' then
- local i = 1
- while obj.colors[i] do
- IupSetAttribute (handle, i, obj.colors[i])
- i = i + 1
- end
- end
- return handle
-end
-
-function iupimage (o)
- return IUPIMAGE:Constructor (o)
-end
-iup.image = iupimage
-
-
-IUPIMAGERGB = {parent = WIDGET}
-
-function IUPIMAGERGB:CreateIUPelement (obj)
- return iupCreateImageRGB(obj.width, obj.height, obj.pixels)
-end
-
-function iupimagergb (o)
- return IUPIMAGERGB:Constructor (o)
-end
-iup.imagergb = iupimagergb
-
-
-IUPIMAGERGBA = {parent = WIDGET}
-
-function IUPIMAGERGBA:CreateIUPelement (obj)
- return iupCreateImageRGBA(obj.width, obj.height, obj.pixels)
-end
-
-function iupimagergba (o)
- return IUPIMAGERGBA:Constructor (o)
-end
-iup.imagergba = iupimagergba
-
-
--- #################################################################################
--- Callbacks
--- #################################################################################
-
-
--- global list of callbacks
--- index is the Lua callback name
--- each callback contains the full name, and the C callback
-iup_callbacks =
-{
- action = {"ACTION", nil},
- actioncb = {"ACTION_CB", nil},
- getfocus = {"GETFOCUS_CB", iup_getfocus_cb},
- killfocus = {"KILLFOCUS_CB", iup_killfocus_cb},
- focus = {"FOCUS_CB", iup_focus_cb},
- k_any = {"K_ANY", iup_k_any},
- help = {"HELP_CB", iup_help_cb},
- caretcb = {"CARET_CB", iup_caret_cb},
- keypress = {"KEYPRESS_CB", iup_keypress_cb},
- scroll = {"SCROLL_CB", iup_scroll_cb},
- trayclick = {"TRAYCLICK_CB", iup_trayclick_cb},
- close = {"CLOSE_CB", iup_close_cb},
- open = {"OPEN_CB", iup_open_cb},
- showcb = {"SHOW_CB", iup_show_cb},
- mapcb = {"MAP_CB", iup_map_cb},
- dropfiles = {"DROPFILES_CB", iup_dropfiles_cb},
- menuclose = {"MENUCLOSE_CB", iup_menuclose_cb},
- highlight = {"HIGHLIGHT_CB", iup_highlight_cb},
- wom = {"WOM_CB", iup_wom_cb},
- wheel = {"WHEEL_CB", iup_wheel_cb},
- button = {"BUTTON_CB", iup_button_cb},
- resize = {"RESIZE_CB", iup_resize_cb},
- motion = {"MOTION_CB", iup_motion_cb},
- enterwindow = {"ENTERWINDOW_CB", iup_enterwindow_cb},
- leavewindow = {"LEAVEWINDOW_CB", iup_leavewindow_cb},
- edit = {"EDIT_CB", iup_edit_cb},
- multiselect = {"MULTISELECT_CB", iup_multiselect_cb},
- filecb = {"FILE_CB", iup_file_cb},
- mdiactivatecb = {"MDIACTIVATE_CB", iup_mdiactivate_cb},
-}
-
-iup_callbacks.action.toggle = iup_action_toggle
-iup_callbacks.action.multiline = iup_action_text
-iup_callbacks.action.text = iup_action_text
-iup_callbacks.action.button = iup_action_button
-iup_callbacks.action.list = iup_action_list
-iup_callbacks.action.item = iup_action_button
-iup_callbacks.action.canvas = iup_action_canvas
-
--- must set here because it is also used elsewhere with a different signature
-iup_callbacks.actioncb.timer = iup_action_timer
-
--- aliases for the full names
-iup_callbacks.action_cb = iup_callbacks.actioncb
-iup_callbacks.getfocus_cb = iup_callbacks.getfocus
-iup_callbacks.killfocus_cb = iup_callbacks.killfocus
-iup_callbacks.focus_cb = iup_callbacks.focus
-iup_callbacks.k_any = iup_callbacks.k_any
-iup_callbacks.help_cb = iup_callbacks.help
-iup_callbacks.caret_cb = iup_callbacks.caretcb
-iup_callbacks.keypress_cb = iup_callbacks.keypress
-iup_callbacks.scroll_cb = iup_callbacks.scroll
-iup_callbacks.trayclick_cb = iup_callbacks.trayclick
-iup_callbacks.close_cb = iup_callbacks.close
-iup_callbacks.open_cb = iup_callbacks.open
-iup_callbacks.show_cb = iup_callbacks.showcb
-iup_callbacks.map_cb = iup_callbacks.mapcb
-iup_callbacks.dropfiles_cb = iup_callbacks.dropfiles
-iup_callbacks.menuclose_cb = iup_callbacks.menuclose
-iup_callbacks.highlight_cb = iup_callbacks.highlight
-iup_callbacks.wom_cb = iup_callbacks.wom
-iup_callbacks.wheel_cb = iup_callbacks.wheel
-iup_callbacks.button_cb = iup_callbacks.button
-iup_callbacks.resize_cb = iup_callbacks.resize
-iup_callbacks.motion_cb = iup_callbacks.motion
-iup_callbacks.enterwindow_cb = iup_callbacks.enterwindow
-iup_callbacks.leavewindow_cb = iup_callbacks.leavewindow
-iup_callbacks.edit_cb = iup_callbacks.edit
-iup_callbacks.multiselect_cb = iup_callbacks.multiselect
-iup_callbacks.mdiactivate_cb = iup_callbacks.mdiactivatecb
-iup_callbacks.file_cb = iup_callbacks.filecb
-IUPCOLORBROWSER = {parent = WIDGET}
-
-function IUPCOLORBROWSER:CreateIUPelement(obj)
- return iupCreateColorBrowser(obj)
-end
-
-function iupcolorbrowser (o)
- return IUPCOLORBROWSER:Constructor (o)
-end
-iup.colorbrowser = iupcolorbrowser
-
-
-iup_callbacks.drag = {"DRAG_CB", iup_colorbrowser_drag_cb}
-iup_callbacks.change = {"CHANGE_CB", iup_colorbrowser_change_cb}
-
-iup_callbacks.drag_cb = iup_callbacks.drag
-iup_callbacks.change_cb = iup_callbacks.change
-IUPCELLS = {parent = WIDGET}
-
-function IUPCELLS:CreateIUPelement( obj )
- return iupCreateCells()
-end
-
-function IUPCELLS:redraw()
- self.repaint = IUP_YES
-end
-
-function iupcells(o)
- return IUPCELLS:Constructor(o)
-end
-iup.cells = iupcells
-
-
--- iup_callbacks.draw_cb = iup_callbacks.draw = {"DRAW_CB", iup_mat_draw_cb} -- same callback at IupMatrix
-
-iup_callbacks.mouseclick = {"MOUSECLICK_CB", iup_cells_mouseclick_cb}
-iup_callbacks.mousemotion = {"MOUSEMOTION_CB", iup_cells_mousemotion_cb}
-iup_callbacks.scrolling = {"SCROLLING_CB", iup_cells_scrolling_cb}
-iup_callbacks.width = {"WIDTH_CB", iup_cells_width_cb}
-iup_callbacks.height = {"HEIGHT_CB", iup_cells_height_cb}
-iup_callbacks.nlines = {"NLINES_CB", iup_cells_nlines_cb}
-iup_callbacks.ncols = {"NCOLS_CB", iup_cells_ncols_cb}
-iup_callbacks.hspan = {"HSPAN_CB", iup_cells_hspan_cb}
-iup_callbacks.vspan = {"VSPAN_CB", iup_cells_vspan_cb}
-
-iup_callbacks.mouseclick_cb = iup_callbacks.mouseclick
-iup_callbacks.mousemotion_cb = iup_callbacks.mousemotion
-iup_callbacks.scrolling_cb = iup_callbacks.scrolling
-iup_callbacks.width_cb = iup_callbacks.width
-iup_callbacks.height_cb = iup_callbacks.height
-iup_callbacks.nlines_cb = iup_callbacks.nlines
-iup_callbacks.ncols_cb = iup_callbacks.ncols
-iup_callbacks.hspan_cb = iup_callbacks.hspan
-iup_callbacks.vspan_cb = iup_callbacks.vspan
-IUPCOLORBAR = {parent = WIDGET}
-
-function IUPCOLORBAR:CreateIUPelement(obj)
- return iupCreateColorbar(obj)
-end
-
-function iupcolorbar (o)
- return IUPCOLORBAR:Constructor (o)
-end
-iup.colorbar = iupcolorbar
-
-
-iup_callbacks.cellcb = {"CELL_CB", iup_colorbar_cell_cb}
-iup_callbacks.selectcb = {"SELECT_CB", iup_colorbar_select_cb}
-iup_callbacks.switchcb = {"SWITCH_CB", iup_colorbar_switch_cb}
-iup_callbacks.extendedcb = {"EXTENDED_CB", iup_colorbar_extended_cb}
-
-iup_callbacks.cell_cb = iup_callbacks.cellcb
-iup_callbacks.select_cb = iup_callbacks.selectcb
-iup_callbacks.switch_cb = iup_callbacks.switchcb
-iup_callbacks.extended_cb = iup_callbacks.extendedcb
-IUPDIAL = {parent = WIDGET}
-
-function IUPDIAL:CreateIUPelement (obj)
- return iupCreateDial (obj[1])
-end
-
-function iupdial (o)
- return IUPDIAL:Constructor (o)
-end
-iup.dial = iupdial
-
-iup_callbacks.mousemove.dial = iup_val_mousemove_cb -- same callback at IupVal
-
--- iup_callbacks.buttonpress = {"BUTTON_PRESS_CB", iup_val_button_press_cb} -- same callback at IupVal
--- iup_callbacks.buttonrelease = {"BUTTON_RELEASE_CB", iup_val_button_release_cb} -- same callback at IupVal
-IUPGAUGE = {parent = WIDGET}
-
-function IUPGAUGE:CreateIUPelement (obj)
- return iupCreateGauge ()
-end
-
-function iupgauge (o)
- return IUPGAUGE:Constructor (o)
-end
-iup.gauge = iupgauge
-IUPMATRIX = {parent = WIDGET}
-
-function IUPMATRIX:CreateIUPelement (obj)
- return iupCreateMatrix ()
-end
-
-function IUPMATRIX:setcell(l,c,val)
- IupSetAttribute(self,l..":"..c,val)
-end
-
-function IUPMATRIX:getcell(l,c,val)
- return IupGetAttribute(self,l..":"..c)
-end
-
-function iupmatrix (o)
- return IUPMATRIX:Constructor (o)
-end
-iup.matrix = iupmatrix
-
-
-iup_callbacks.actioncb.matrix = iup_mat_action_cb
-iup_callbacks.mousemove.matrix = iup_mat_mousemove_cb
-
-iup_callbacks.edition = {"EDITION_CB", iup_mat_edition_cb}
-iup_callbacks.drop = {"DROP_CB", iup_mat_drop_cb}
-iup_callbacks.dropselect = {"DROPSELECT_CB", iup_mat_dropselect_cb}
-iup_callbacks.enteritem = {"ENTERITEM_CB", iup_mat_enteritem_cb}
-iup_callbacks.leaveitem = {"LEAVEITEM_CB", iup_mat_leaveitem_cb}
-iup_callbacks.click = {"CLICK_CB", iup_mat_click_cb}
-iup_callbacks.scrolltop = {"SCROLLTOP_CB", iup_mat_scrolltop_cb}
-iup_callbacks.valuecb = {"VALUE_CB", iup_mat_value_cb}
-iup_callbacks.draw = {"DRAW_CB", iup_mat_draw_cb}
-iup_callbacks.dropcheck = {"DROPCHECK_CB", iup_mat_dropcheck_cb}
-iup_callbacks.fgcolorcb = {"FGCOLOR_CB", iup_mat_fgcolor_cb}
-iup_callbacks.bgcolorcb = {"BGCOLOR_CB", iup_mat_bgcolor_cb}
-iup_callbacks.value_edit = {"VALUE_EDIT_CB", iup_mat_value_edit_cb}
-iup_callbacks.markedit_cb = {"MARKEDIT_CB", iup_mat_markedit_cb}
-iup_callbacks.mark_cb = {"MARK_CB", iup_mat_mark_cb}
-iup_callbacks.mouse_cb = {"MOUSE_CB", iup_mat_mouse_cb}
-
-iup_callbacks.edition_cb = iup_callbacks.edition
-iup_callbacks.drop_cb = iup_callbacks.drop
-iup_callbacks.dropselect_cb = iup_callbacks.dropselect
-iup_callbacks.enteritem_cb = iup_callbacks.enteritem
-iup_callbacks.leaveitem_cb = iup_callbacks.leaveitem
-iup_callbacks.click_cb = iup_callbacks.click
-iup_callbacks.scrolltop_cb = iup_callbacks.scrolltop
-iup_callbacks.value_cb = iup_callbacks.valuecb
-iup_callbacks.draw_cb = iup_callbacks.draw
-iup_callbacks.dropcheck_cb = iup_callbacks.dropcheck
-iup_callbacks.fgcolor_cb = iup_callbacks.fgcolorcb
-iup_callbacks.bgcolor_cb = iup_callbacks.bgcolorcb
-iup_callbacks.value_edit_cb = iup_callbacks.value_edit
-IUPPPLOT = {parent = WIDGET}
-
-function IUPPPLOT:CreateIUPelement (obj)
- return iupCreatePPlot ()
-end
-
-function iuppplot (o)
- return IUPPPLOT:Constructor (o)
-end
-iup.pplot = iuppplot
-
-iup_callbacks.edit_cb.pplot = iup_pplot_edit_cb
-
-iup_callbacks.editbegin_cb = {"EDITBEGIN_CB", iup_pplot_editbegin_cb}
-iup_callbacks.editend_cb = {"EDITEND_CB", iup_pplot_editend_cb}
-iup_callbacks.select_cb = {"SELECT_CB", iup_pplot_select_cb}
-iup_callbacks.selectbegin_cb = {"SELECTBEGIN_CB", iup_pplot_selectbegin_cb}
-iup_callbacks.selectend_cb = {"SELECTEND_CB", iup_pplot_selectend_cb}
-iup_callbacks.delete_cb = {"DELETE_CB", iup_pplot_delete_cb}
-iup_callbacks.deletebegin_cb = {"DELETEBEGIN_CB", iup_pplot_deletebegin_cb}
-iup_callbacks.deleteend_cb = {"DELETEEND_CB", iup_pplot_deleteend_cb}
-iup_callbacks.predraw_cb = {"PREDRAW_CB", iup_pplot_predraw_cb}
-iup_callbacks.postdraw_cb = {"POSTDRAW_CB", iup_pplot_postdraw_cb}
-IUPSBOX = {parent = WIDGET}
-
-function IUPSBOX:CreateIUPelement (obj)
- return iupCreateSbox(obj[1])
-end
-
-function iupsbox (o)
- return IUPSBOX:Constructor (o)
-end
-iup.sbox = iupsbox
-IUPSPIN = {parent = WIDGET}
-
-function IUPSPIN:CreateIUPelement (obj)
- return iupCreateSpin ()
-end
-
-function iupspin (o)
- return IUPSPIN:Constructor (o)
-end
-iup.spin = iupspin
-
-IUPSPINBOX = {parent = WIDGET}
-
-function IUPSPINBOX:CreateIUPelement (obj)
- return iupCreateSpinbox (obj[1])
-end
-
-function iupspinbox (o)
- return IUPSPINBOX:Constructor (o)
-end
-iup.spinbox = iupspinbox
-
-iup_callbacks.spincb = {"SPIN_CB", iup_spin_cb}
-iup_callbacks.spin_cb = iup_callbacks.spincb
-IUPTABS = {parent = WIDGET}
-
-function IUPTABS:CreateIUPelement (obj)
- return iupCreateTabs (obj, getn(obj))
-end
-
-function iuptabs (o)
- return IUPTABS:Constructor (o)
-end
-iup.tabs = iuptabs
-
-iup_callbacks.tabchange = {"TABCHANGE_CB", iup_tabchange_cb}
-iup_callbacks.tabchange_cb = iup_callbacks.tabchangeIUPTREE = {parent = WIDGET}
-IUPTREEREFERENCETABLE = {} -- Used in C, see luatree.c
-
-function IUPTREE:CreateIUPelement (obj)
- return iupCreateTree ()
-end
-
-function iuptree (o)
- return IUPTREE:Constructor (o)
-end
-iup.tree = iuptree
-
-function TreeSetValueRec(handle, t, id)
-
- if t == nil then return end
-
- local cont = getn(t)
-
- while cont >= 0 do
- if type (t[cont]) == "table" then
- if t[cont].branchname ~= nil then
- IupSetAttribute(handle, "ADDBRANCH"..id, t[cont].branchname)
- else
- IupSetAttribute(handle, "ADDBRANCH"..id, "")
- end
- TreeSetValueRec(handle, t[cont], id+1)
- else
- if t[cont] then
- IupSetAttribute(handle, "ADDLEAF"..id, t[cont])
- end
- end
- cont = cont - 1
- end
-end
-
-function TreeSetValue(handle, t)
- if type(t) ~= "table" then
- IupMessage("TreeLua Error", "Incorrect arguments to function TreeSetValue")
- return
- end
- if t.branchname ~= nil then
- IupSetAttribute(handle, "NAME", t.branchname)
- end
- TreeSetValueRec(handle, t, 0)
-end
-iup.TreeSetValue = TreeSetValue
-
-iup_callbacks.selection = {"SELECTION_CB", iup_tree_selection_cb}
-iup_callbacks.multiselection = {"MULTISELECTION_CB", iup_tree_multiselection_cb}
-iup_callbacks.branchopen = {"BRANCHOPEN_CB", iup_tree_branchopen_cb}
-iup_callbacks.branchclose = {"BRANCHCLOSE_CB", iup_tree_branchclose_cb}
-iup_callbacks.executeleaf = {"EXECUTELEAF_CB", iup_tree_executeleaf_cb}
-iup_callbacks.renamenode = {"RENAMENODE_CB", iup_tree_renamenode_cb}
-iup_callbacks.renamecb = {"RENAME_CB", iup_tree_renamecb_cb}
-iup_callbacks.showrenamecb = {"SHOWRENAME_CB", iup_tree_showrenamecb_cb}
-iup_callbacks.rightclick = {"RIGHTCLICK_CB", iup_tree_rightclick_cb}
-iup_callbacks.dragdrop = {"DRAGDROP_CB", iup_tree_dragdrop_cb}
-
-iup_callbacks.selection_cb = iup_callbacks.selection
-iup_callbacks.multiselection_cb = iup_callbacks.multiselection
-iup_callbacks.branchopen_cb = iup_callbacks.branchopen
-iup_callbacks.branchclose_cb = iup_callbacks.branchclose
-iup_callbacks.executeleaf_cb = iup_callbacks.executeleaf
-iup_callbacks.renamenode_cb = iup_callbacks.renamenode
-iup_callbacks.rename_cb = iup_callbacks.renamecb
-iup_callbacks.showrename_cb = iup_callbacks.showrenamecb
-iup_callbacks.rightclick_cb = iup_callbacks.rightclick
-iup_callbacks.dragdrop_cb = iup_callbacks.dragdrop
-IUPVAL = {parent = WIDGET}
-
-function IUPVAL:CreateIUPelement (obj)
- return iupCreateVal (obj[1])
-end
-
-function iupval (o)
- return IUPVAL:Constructor (o)
-end
-iup.val = iupval
-
-
--- must set here because it is also used elsewhere with a different signature
-iup_callbacks.mousemove = {"MOUSEMOVE_CB", nil}
-iup_callbacks.mousemove_cb = iup_callbacks.mousemove
-iup_callbacks.mousemove.val = iup_val_mousemove_cb
-
-iup_callbacks.buttonpress = {"BUTTON_PRESS_CB", iup_val_button_press_cb}
-iup_callbacks.buttonrelease = {"BUTTON_RELEASE_CB", iup_val_button_release_cb}
-
-iup_callbacks.button_press_cb = iup_callbacks.buttonpress
-iup_callbacks.button_release_cb = iup_callbacks.buttonrelease
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "iuplua.c", "iuplua_api.c", "iuplua_widgets.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "../src", "$(LUA3)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
--- SRCLUA = iuplua.lua
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluacontrols3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "luaval.c", "luadial.c", "luagauge.c", "luagc.c", "luacbox.c", "luacells.c",
- "luacb.c", "luatabs.c", "luamask.c", "luacontrols.c", "luagetparam.c",
- "luamatrix.c", "luatree.c", "luasbox.c", "luaspin.c", "luacolorbar.c"
-}
-fixPackagePath(package.files)
-
--- SRCLUA = luaval.lua luadial.lua luagauge.lua luacb.lua luatabs.lua luamatrix.lua luatree.lua luasbox.lua luaspin.lua luacells.lua
-
-package.includepaths = { "../include", "$(CD)/include", "$(LUA3)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua_pplot3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "luapplot.c"
-}
-fixPackagePath(package.files)
-
--- SRCLUA = luapplot.lua
-
-package.includepaths = { "../include", "$(CD)/include", "$(LUA3)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluagl3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "luaglcanvas.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(LUA3)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluaim3"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "luaim.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(LUA3)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua3exe"
-package.target = "iuplua3"
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "exe"
-package.linkflags = { "static-runtime" }
-
-package.files =
-{
- "iupluaexe.c"
-}
-fixPackagePath(package.files)
-
--- SRCLUA = console.lua
-
-package.includepaths = { "../include", "$(LUA3)/include", "$(CD)/include", "$(IM)/include" }
-package.defines = {"IUPLUA_USELOH"}
-package.links = { "imlua3", "cdluaiup3", "cdlua3",
- "iupluagl3", "iupluaim3", "iupluacontrols3", "iuplua3",
- "lualib", "lua",
- "iupgl", "iupim", "iupcontrols",
- "cdiup", "cd", "iup", "im" }
-package.libpaths = { "../lib", "$(IM)/lib", "$(CD)/lib", "$(LUA3)/lib" }
-
-if (options.os == "windows") then
- tinsert(package.links, { "comctl32", "ole32", "opengl32", "glu32", "glaux" })
-else
- tinsert(package.links, { "GLU", "GL", "Xm", "Xpm", "Xmu", "Xt", "Xext", "X11", "m" })
- tinsert(package.libpaths, { "/usr/X11R6/lib" })
-end
-
----------------------------------------------------------------------
-------------------------------------------------------------------------------
--- Button class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "button",
- parent = WIDGET,
- creation = "S-",
- callback = {
- action = "",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Button(arg.title)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Canvas class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "canvas",
- parent = WIDGET,
- creation = "-",
- callback = {
- action = "ff",
- button_cb = "nnnns",
- enterwindow_cb = "",
- leavewindow_cb = "",
- motion_cb = "nns",
- resize_cb = "nn",
- scroll_cb = "nff",
- keypress_cb = "nn",
- wom_cb = "n",
- wheel_cb = "fnns",
- mdiactivate_cb = "",
- focus_cb = "n",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Canvas()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Cbox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "cbox",
- parent = WIDGET,
- creation = "v",
- callback = {},
- include = "iupcbox.h",
- funcname = "Cboxv",
- createfunc = [[
-static int Cboxv(lua_State *L)
-{
- Ihandle **hlist = iuplua_checkihandle_array(L, 1);
- Ihandle *h = IupCboxv(hlist);
- iuplua_plugstate(L, h);
- iuplua_pushihandle_raw(L, h);
- free(hlist);
- return 1;
-}
- ]],
-}
-
-function ctrl.createElement(class, arg)
- return Cboxv(arg)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Cells class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "cells",
- parent = WIDGET,
- creation = "",
- callback = {
- mouseclick_cb = "nnnnnns",
- mousemotion_cb = "nnnns",
- scrolling_cb = "nn",
--- draw_cb = "nnnnnnn", -- already registered by the matrix
- width_cb = "n",
- height_cb = "n",
- nlines_cb = "",
- ncols_cb = "",
- hspan_cb = "nn",
- vspan_cb = "nn",
- },
- include = "iupcells.h"
-}
-
-function ctrl.redraw(handle)
- handle.repaint = "YES"
-end
-
-function ctrl.createElement(class, arg)
- return Cells()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Colorbar class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "colorbar",
- parent = WIDGET,
- creation = "",
- callback = {
- select_cb = "nn",
- cell_cb = {"n", ret = "s"},
- switch_cb = "nn",
- extended_cb = "n",
- },
- funcname = "Colorbar",
- include = "iupcolorbar.h",
-}
-
-function ctrl.createElement(class, arg)
- return Colorbar(arg.action)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- ColorBrowser class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "colorbrowser",
- parent = WIDGET,
- creation = "",
- callback = {
- drag_cb = "ccc",
- change_cb = "ccc",
- },
- funcname = "ColorBrowser",
- include = "iupcb.h",
-}
-
-function ctrl.createElement(class, arg)
- return ColorBrowser(arg.action)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- ColorDlg class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "colordlg",
- parent = WIDGET,
- creation = "",
- funcname = "ColorDlg",
- callback = {}
-}
-
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-function ctrl.createElement(class, arg)
- return ColorDlg()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-
--- Utilities
-iupluacmd = {}
-
-function iupluacmd.printtable(t)
- local n,v = next(t, nil)
- print("--printtable Start--")
- while n ~= nil do
- print(tostring(n).."="..tostring(v))
- n,v = next(t, n)
- end
- print("--printtable End--")
-end
-
-function iupluacmd.print_version_info()
- print(_VERSION .. " " .. _COPYRIGHT)
- if (im) then print("IM " .. im._VERSION .. " " .. im._COPYRIGHT) end
- if (cd) then print("CD " .. cd._VERSION .. " " .. cd._COPYRIGHT) end
- print("IUP " .. iup._VERSION .. " " .. iup._COPYRIGHT)
- print("")
- print("IUP Info")
- print(" System: " .. iup.GetGlobal("SYSTEM"))
- print(" System Version: " .. iup.GetGlobal("SYSTEMVERSION"))
- local mot = iup.GetGlobal("MOTIFVERSION")
- if (mot) then print(" Motif Version: ", mot) end
- print(" Screen Size: " .. iup.GetGlobal("SCREENSIZE"))
- print(" Screen Depth: " .. iup.GetGlobal("SCREENDEPTH"))
- if (iup.GL_VENDOR) then print(" OpenGL Vendor: " .. iup.GL_VENDOR) end
- if (iup.GL_RENDERER) then print(" OpenGL Renderer: " .. iup.GL_RENDERER) end
- if (iup.GL_VERSION) then print(" OpenGL Version: " .. iup.GL_VERSION) end
-end
-
--- IUPLUA Full Application
-
-iupluacmd.lastfilename = nil -- Last file open
-iupluacmd.mlCode = iup.multiline{expand="YES", size="200x120", font="COURIER_NORMAL_10"}
-iupluacmd.lblPosition = iup.label{title="0:0", size="50x"}
-iupluacmd.lblFileName = iup.label{title="", size="50x", expand="HORIZONTAL"}
-
-function iupluacmd.mlCode:caret_cb(lin, col)
- iupluacmd.lblPosition.title = lin..":"..col
-end
-
-iupluacmd.butExecute = iup.button{size="50x15", title="Execute",
- action="iup.dostring(iupluacmd.mlCode.value)"}
-iupluacmd.butClearCommands = iup.button{size="50x15", title="Clear",
- action="iupluacmd.mlCode.value='' iupluacmd.lblFileName.title = '' iupluacmd.lastfilename = nil"}
-iupluacmd.butLoadFile = iup.button{size="50x15", title="Load..."}
-iupluacmd.butSaveasFile = iup.button{size="50x15", title="Save As..."}
-iupluacmd.butSaveFile = iup.button{size="50x15", title="Save"}
-
-iupluacmd.butSaveFile.action = function()
- if (iupluacmd.lastfilename == nil) then
- iupluacmd.butSaveasFile:action()
- else
- newfile = io.open(iupluacmd.lastfilename, "w+")
- if (newfile ~= nil) then
- newfile:write(iupluacmd.mlCode.value)
- newfile:close()
- else
- error ("Cannot Save file "..filename)
- end
- end
-end
-
-iupluacmd.butSaveasFile.action = function()
- local fd = iup.filedlg{dialogtype="SAVE", title="Save File",
- filter="*.lua", filterinfo="Lua files",allownew=yes}
- fd:popup(iup.LEFT, iup.LEFT)
- local status = fd.status
- iupluacmd.lastfilename = fd.value
- iupluacmd.lblFileName.title = iupluacmd.lastfilename
- fd:destroy()
- if status ~= "-1" then
- if (iupluacmd.lastfilename == nil) then
- error ("Cannot Save file "..filename)
- end
- local newfile=io.open(iupluacmd.lastfilename, "w+")
- if (newfile ~= nil) then
- newfile:write(iupluacmd.mlCode.value)
- newfile:close(newfile)
- else
- error ("Cannot Save file")
- end
- end
-end
-
-iupluacmd.butLoadFile.action = function ()
- local fd=iup.filedlg{dialogtype="OPEN", title="Load File",
- filter="*.lua", filterinfo="Lua Files", allownew="NO"}
- fd:popup(iup.CENTER, iup.CENTER)
- local status = fd.status
- local filename = fd.value
- fd:destroy()
- if (status == "-1") or (status == "1") then
- if (status == "1") then
- error ("Cannot load file "..filename)
- end
- else
- local newfile = io.open (filename, "r")
- if (newfile == nil) then
- error ("Cannot load file "..filename)
- else
- iupluacmd.mlCode.value=newfile:read("*a")
- newfile:close (newfile)
- iupluacmd.lastfilename = filename
- iupluacmd.lblFileName.title = iupluacmd.lastfilename
- end
- end
-end
-
-iupluacmd.vbxConsole = iup.vbox
-{
- iup.frame{iup.hbox{iup.vbox{iupluacmd.butLoadFile,
- iupluacmd.butSaveFile,
- iupluacmd.butSaveasFile,
- iupluacmd.butClearCommands,
- iupluacmd.butExecute;
- margin="0x0", gap="10"},
- iup.vbox{iupluacmd.lblFileName,
- iupluacmd.mlCode,
- iupluacmd.lblPosition;
- alignment = "ARIGHT"};
- alignment="ATOP"}; title="Commands"}
- ;alignment="ACENTER", margin="5x5", gap="5"
-}
-
--- Main Menu Definition.
-
-iupluacmd.mnuMain = iup.menu
-{
- iup.submenu
- {
- iup.menu
- {
- iup.item{title="Exit", action="return iup.CLOSE"}
- }; title="File"
- },
- iup.submenu{iup.menu
- {
- iup.item{title="Print Version Info...", action=iupluacmd.print_version_info},
- iup.item{title="About...", action="iupluacmd.dlgAbout:popup(iup.CENTER, iup.CENTER)"}
- };title="Help"}
-}
-
--- Main Dialog Definition.
-
-iupluacmd.dlgMain = iup.dialog{iupluacmd.vbxConsole;
- title="IupLua Console",
- menu=iupluacmd.mnuMain,
- defaultenter=iupluacmd.butExecute,
- close_cb = "return iup.CLOSE"}
-
--- About Dialog Definition.
-
-iupluacmd.dlgAbout = iup.dialog
-{
- iup.vbox
- {
- iup.label{title="IupLua5 Console"},
- iup.fill{size="5"},
- iup.fill{size="5"},
- iup.frame
- {
- iup.vbox
- {
- iup.label{title="Tecgraf/PUC-Rio"},
- iup.label{title="iup@tecgraf.puc-rio.br"}
- }
- },
- iup.fill{size="5"},
- iup.button{title="OK", action="return iup.CLOSE", size="50X20"}
- ;margin="10x10", alignment="ACENTER"
- }
- ;maxbox="NO", minbox="NO", resize="NO", title="About"
-}
-
--- Displays the Main Dialog
-
-iupluacmd.dlgMain:show()
-iup.SetFocus(iupluacmd.mlCode)
-
-iup.MainLoop()
-
-iupluacmd.dlgMain:destroy()
-iupluacmd.dlgAbout:destroy()
-----------------------------------------------------------------------------
--- Callback return values
-----------------------------------------------------------------------------
-IGNORE = -1
-DEFAULT = -2
-CLOSE = -3
-CONTINUE = -4
-
-----------------------------------------------------------------------------
--- IupPopup e IupShowXY
-----------------------------------------------------------------------------
-CENTER = 65535
-LEFT = 65534
-RIGHT = 65533
-MOUSEPOS = 65532
-CURRENT = 65531
-CENTERPARENT = 65530
-TOP = LEFT
-BOTTOM = RIGHT
-ANYWHERE = CURRENT
-
-----------------------------------------------------------------------------
--- Scrollbar
-----------------------------------------------------------------------------
-SBUP = 0
-SBDN = 1
-SBPGUP = 2
-SBPGDN = 3
-SBPOSV = 4
-SBDRAGV = 5
-SBLEFT = 6
-SBRIGHT = 7
-SBPGLEFT = 8
-SBPGRIGHT = 9
-SBPOSH = 10
-SBDRAGH = 11
-
-----------------------------------------------------------------------------
--- SHOW_CB
-----------------------------------------------------------------------------
-SHOW = 0
-RESTORE = 1
-MINIMIZE = 2
-MAXIMIZE = 3
-HIDE = 4
-
-----------------------------------------------------------------------------
--- BUTTON_CB
-----------------------------------------------------------------------------
-BUTTON1 = string.byte('1')
-BUTTON2 = string.byte('2')
-BUTTON3 = string.byte('3')
-BUTTON4 = string.byte('4')
-BUTTON5 = string.byte('5')
-
-----------------------------------------------------------------------------
--- IupOpen
-----------------------------------------------------------------------------
-ERROR = 1
-NOERROR = 0
-OPENED = -1
-INVALID = -1
-------------------------------------------------------------------------------
--- Template to create control classes for IupLua5
--- The Lua module is used by the "generator.lua" to build a C module,
--- and loaded during iuplua_open to initialize the control.
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "mycontrol", -- name of the control, used in the control creation: iup.mycontrol{}
- -- also used for the generated C module
- parent = WIDGET, -- used to define a few methods used fro creation and set attribute
- creation = "nn", -- the creation parameters in Lua
- -- "n" = int
- -- "d" = double
- -- "s" = char*
- -- "S" = optional char*, can be nil
- -- "i" = Ihandle*
- -- "-" = NULL, no parameters in Lua, but a NULL parameter in C
- -- "a" = char* array in a table
- -- "t" = int array in a table
- -- "v" = Ihandle* array in a table
-
- funcname = "myControl", -- [optional] name of the function used in C
- -- default is ctrl.nick with first letter uppercase
-
- callback = { -- partial list of callbacks
- -- only the callbacks that are not already defined by other controls needs to be defined
- action = "ff",
- button_cb = "nnnns",
- enterwindow_cb = "",
- leavewindow_cb = "",
- motion_cb = "nns",
- resize_cb = "nn",
- scroll_cb = "nff",
- keypress_cb = "nn",
- wom_cb = "n",
- wheel_cb = "fnns",
- mdiactivate_cb = "",
- focus_cb = "n",
- value_cb = {"nn", ret = "s"}, -- ret is return type, default is n ("int")
-
- -- the following types can be used for callback parameters:
- -- n = "int",
- -- s = "char *",
- -- i = "Ihandle *",
- -- c = "unsigned char ",
- -- d = "double",
- -- f = "float",
- -- v = "Ihandle **",
- --
- -- Other parameters must be implemented in C using the extrafuncs module
-
- -- IMPORTANT: callbacks with the same name in different controls
- -- are assumed to have the same parameters, that's why they are defined only once
- -- When callbacks conflict using the same name, but different parameters
- -- generator.lua must be edited to include the callback in the list of conflicting callbacks
- -- "action" is a common callback that conflicts
- -- In the callback list, just declare the callback with the parameters used in that control.
- }
-
- include = "iupmycontrol.h", -- [optional] header to be included, it is where the creation function is declared.
- extrafuncs = 1, -- [optional] additional module in C called by the initialization function
-
- createfunc = [[ -- [optional] creation function in C,
- -- used if creation parameters needs some interpretation in C
- -- not to be used together with funcname
-#include<stdlib.h>
-static int myControl (lua_State * L)
-{
- xxxx;
- yyyy;
- return 1;
-}
-]]
-
- extracode = [[ -- [optional] extra fucntions to be defined in C.
-int luaopen_iupluamycontrol51(lua_State* L)
-{
- return iupmycontrollua_open(L);
-}
-]]
-
-}
-
--- must be defined so the WIDGET constructor can call it
-function ctrl.createElement(class, arg)
- return myControl()
-end
-
--- here you can add some custom methods to the class
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-iupRegisterWidget(ctrl) -- will make iup.mycontrol available
-iupSetClass(ctrl, "iup widget") -- register the class in the registry
-------------------------------------------------------------------------------
--- Dial class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "dial",
- parent = WIDGET,
- creation = "s",
- callback = {
- mousemove_cb = "d", -- already registered by the val, but has a name conflict
--- button_press_cb = "d", -- already registered by the val
--- button_release_cb = "d", -- already registered by the val
- },
- include = "iupdial.h",
-}
-
-function ctrl.createElement(class, arg)
- return Dial(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Dialog class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "dialog",
- parent = WIDGET,
- creation = "i",
- callback = {
- map_cb = "",
- close_cb = "",
- show_cb = "n",
- trayclick_cb = "nnn",
- dropfiles_cb = "snnn",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Dialog(arg[1])
-end
-
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-function ctrl.showxy(handle, x, y)
- return ShowXY(handle, x, y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- FileDlg class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "filedlg",
- parent = WIDGET,
- creation = "",
- callback = {
- file_cb = "ss",
- },
- funcname = "FileDlg"
-}
-
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-function ctrl.createElement(class, arg)
- return FileDlg()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-
-------------------------------------------------------------------------------
--- Fill class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "fill",
- parent = WIDGET,
- creation = "",
- callback = {}
-}
-
-function ctrl.createElement(class, arg)
- return Fill()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- FontDlg class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "fontdlg",
- parent = WIDGET,
- creation = "",
- funcname = "FontDlg",
- callback = {}
-}
-
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-function ctrl.createElement(class, arg)
- return FontDlg()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-
-------------------------------------------------------------------------------
--- Frame class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "frame",
- parent = WIDGET,
- creation = "i",
- callback = {}
-}
-
-function ctrl.createElement(class, arg)
- return Frame(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Gauge class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "gauge",
- parent = WIDGET,
- creation = "",
- callback = {},
- include = "iupgauge.h",
-}
-
-function ctrl.createElement(class, arg)
- return Gauge(arg.action)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-
-function dofile(f)
- pcall(loadfile(f))
-end
-
--- compatibility functions (with iuplua.lua)
-function iupSetClass(ctrl, name)
- element = ctrl
-end
-
--- dummy functions
-iupluaNewClass = function() end
-iupSetMethod = iupluaNewClass
-iupRegisterWidget = iupluaNewClass
-
-c_types = {
- n = "int",
- s = "char *",
- i = "Ihandle *",
- c = "unsigned char ",
- d = "double",
- f = "float",
- v = "Ihandle **",
-}
-
--- Adjust the callbacks table
-function adjustcallbacktable(c)
- d = {}
- for i,j in pairs(c) do
- if type(j) == "string" then
- d[i] = { j, "IUP_".. string.upper(i)}
- elseif type(j) == "table" then
- d[i] = j
- else
- print("ERROR IN CALLBACK TABLE FORMAT")
- end
- end
- return d
-end
-
-
-function header(o,i)
- io.write [[
-/******************************************************************************
- * Automatically generated file (iuplua5). Please don't change anything. *
- *****************************************************************************/
-
-#include <stdlib.h>
-
-#include <lua.h>
-#include <lauxlib.h>
-
-#include <iup.h>
-#include <iuplua.h>
-]]
- if i then io.write("#include <",i,">\n") end
- io.write('#include "il.h"\n\n\n')
-end
-
-function firstupper(name)
- return string.upper(string.sub(name,1,1)) .. string.sub(name,2,-1)
-end
-
-function write_creation(o, t)
- local aux = {n = 1}
- local u = firstupper(o)
- local v = t.creation
- local c = t.callback
- if t.funcname then
- u = t.funcname
- end
- io.write ("static int ",u,"(lua_State *L)\n")
- io.write ("{\n")
- if t.rettype == nil then io.write(" Ihandle *ih = Iup",u,"(")
- elseif t.rettype == "n" then io.write(" int n = (Iup",u,"(")
- elseif t.rettype == "s" then io.write(" char *s = (Iup",u,"(")
- end
- local max = string.len(v)
- string.gsub(v, "(.)", function(p)
- if p == "n" then io.write("luaL_checkint(L, ",aux.n,")")
- elseif p == "d" then io.write("luaL_number(L, ",aux.n,")")
- elseif p == "s" then io.write("(char *) luaL_checkstring(L, ",aux.n,")")
- elseif p == "S" then io.write("(char *) luaL_optstring(L, ",aux.n,', NULL)')
- elseif p == "i" then io.write("iuplua_checkihandle(L, ",aux.n,")")
- elseif p == "-" then io.write("NULL")
- elseif p == "a" then io.write("iuplua_checkstring_array(L, ",aux.n,")")
- elseif p == "t" then io.write("iuplua_checkint_array(L, ",aux.n,")")
- elseif p == "v" then io.write("iuplua_checkihandle_array(L, ",aux.n,")")
- else io.write("FORMAT '", p, "' NOT SUPPORTED\n")
- end
- if aux.n < max then io.write(", ") end
- aux.n = aux.n + 1
- end)
- io.write(");\n")
-
- io.write(" iuplua_plugstate(L, ih);\n")
- io.write(" iuplua_pushihandle_raw(L, ih);\n")
- io.write(" return 1;\n")
- io.write("}\n\n")
-end
-
-function write_callbacks(o, c)
- local aux = { }
- for i,v in pairs(c) do
- local s = v[1]
- local max = string.len(s)
- aux.n = 0
- io.write("static ")
- if v.ret ~= nil then
- if v.ret == "s" then
- io.write("char * ")
- end
- else
- io.write("int ")
- end
- io.write(o, "_", i, "(Ihandle *self")
- if max > 0 then io.write(", ") end
- string.gsub(s, "(.)", function(p)
- io.write(c_types[p], " p", aux.n)
- aux.n = aux.n + 1
- if aux.n < max then io.write(", ") end
- end)
- io.write(")\n{\n")
- io.write(' lua_State *L = iuplua_call_start(self, "', i, '");')
- aux.n = 0
- string.gsub(s, "(.)", function(p)
- if p == "n" or p == "f" or p == "d" or p == "c" then
- io.write("\n lua_pushnumber(L, p"..aux.n..");")
- elseif p == "s" then
- io.write("\n lua_pushstring(L, p"..aux.n..");")
- elseif p == "i" then
- io.write("\n iuplua_pushihandle(L, p"..aux.n..");")
- else
- io.write("\n ERROR !! ")
- end
- aux.n = aux.n + 1
- end)
- if v.ret ~= nil and v.ret == "s" then
- io.write("\n return iuplua_call_rs(L, " .. max .. ");")
- else
- io.write("\n return iuplua_call(L, " .. max .. ");")
- end
- io.write("\n}\n\n")
- end
-end
-
-function write_initialization(o,t)
- local aux= {n=1}
- local c = t.callback
- local u = firstupper(o)
- if t.extrafuncs then
- io.write('void iuplua_', o,'funcs_open(lua_State *L);\n\n')
- end
- if t.openfuncname then
- io.write("void ", t.openfuncname, "(lua_State * L)\n")
- else
- io.write("int iup", o,"lua_open(lua_State * L)\n")
- end
- io.write("{\n")
- io.write(" iuplua_register(L, ")
- if t.funcname then
- u = t.funcname
- end
- io.write(u, ', "', u,'");\n\n')
-
- for i,v in pairs(c) do
- local type = "NULL"
- if i == "action" or
- i == "action_cb" or
- i == "edit_cb" or
- i == "mousemove_cb" then
- type = '"'..string.lower(o)..'"'
- end
- io.write(' iuplua_register_cb(L, "',string.upper(i),'", (lua_CFunction)',o,'_',i,', ',type,');\n')
- first = 0
- end
- io.write('\n')
-
- if t.extrafuncs then
- io.write(' iuplua_', o,'funcs_open(L);\n\n')
- end
- io.write('#ifdef IUPLUA_USELOH\n')
- io.write('#ifdef TEC_BIGENDIAN\n')
- io.write('#ifdef TEC_64\n')
- io.write('#include "', o,'_be64.loh"\n')
- io.write('#else\n')
- io.write('#include "', o,'_be32.loh"\n')
- io.write('#endif\n')
- io.write('#else\n')
- io.write('#ifdef TEC_64\n')
- io.write('#ifdef WIN64\n')
- io.write('#include "', o,'_le64w.loh"\n')
- io.write('#else\n')
- io.write('#include "', o,'_le64.loh"\n')
- io.write('#endif\n')
- io.write('#else\n')
- io.write('#include "', o,'.loh"\n')
- io.write('#endif\n')
- io.write('#endif\n')
- io.write('#else\n')
- io.write(' iuplua_dofile(L, "', o,'.lua");\n')
- io.write('#endif\n\n')
- io.write(' return 0;\n')
- io.write("}\n\n")
-end
-
-dofile(arg[1])
-element.callback = adjustcallbacktable(element.callback)
-
-io.output(element.nick..".c")
-header(element.nick, element.include)
-write_callbacks(element.nick, element.callback)
-if element.createfunc == nil then
- write_creation(element.nick, element)
-else
- io.write(element.createfunc)
-end
-write_initialization(element.nick, element)
-if element.extracode then
- io.write(element.extracode)
-end
-------------------------------------------------------------------------------
--- GLCanvas class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "glcanvas",
- parent = WIDGET,
- creation = "-",
- funcname = "GLCanvas",
- include = "iupgl.h",
- callback = {
- action = "nn",
- },
- extrafuncs = 1,
- extracode = [[
-int iupgllua_open(lua_State * L)
-{
- if (iuplua_opencall_internal(L))
- IupGLCanvasOpen();
-
- iuplua_changeEnv(L);
- iupglcanvaslua_open(L);
- iuplua_returnEnv(L);
- return 0;
-}
-
-/* obligatory to use require"iupluagl" */
-int luaopen_iupluagl(lua_State* L)
-{
- return iupgllua_open(L);
-}
-
-/* obligatory to use require"iupluagl51" */
-int luaopen_iupluagl51(lua_State* L)
-{
- return iupgllua_open(L);
-}
-
-]]
-}
-
-function ctrl.createElement(class, arg)
- return GLCanvas()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- HBox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "hbox",
- parent = BOX,
- creation = "-",
- callback = {}
-}
-
-function ctrl.append(handle, elem)
- Append(handle, elem)
-end
-
-function ctrl.createElement(class, arg)
- return Hbox()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Image class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "image",
- parent = WIDGET,
- creation = "nns", -- fake definition
- callback = {},
- createfunc = [[
-#include<stdlib.h>
-static int Image (lua_State * L)
-{
- int w, h, i, j;
- char *img;
- Ihandle *image;
-
- h = luaL_getn(L, 1);
- lua_pushnumber(L, 1);
- lua_gettable(L, 1);
- w = luaL_getn(L, -1);
- lua_pop(L, 1);
-
- img = (char *) malloc (h*w);
-
- for (i=1; i<=h; i++)
- {
- lua_pushnumber(L, i);
- lua_gettable(L, 1);
- for (j=1; j<=w; j++)
- {
- int idx = (i-1)*w+(j-1);
- lua_pushnumber(L, j);
- lua_gettable(L, -2);
- img[idx] = (char)lua_tonumber(L, -1);
- lua_pop(L, 1);
- }
- lua_pop(L, 1);
- }
-
- image = IupImage(w,h,img);
- free(img);
-
- w = luaL_getn(L, 2);
-
- for(i=1; i<=w; i++)
- {
- lua_pushnumber(L,i);
- lua_pushnumber(L,i);
- lua_gettable(L, 2);
- IupStoreAttribute(image, (char *) lua_tostring(L,-2), (char *) lua_tostring(L,-1));
- lua_pop(L, 2);
- }
-
- iuplua_plugstate(L, image);
- iuplua_pushihandle_raw(L, image);
- return 1;
-}
-
-]]
-}
-
-function ctrl.createElement(class, arg)
- return Image(arg, arg.colors)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- ImageRGB class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "imagergb",
- parent = WIDGET,
- creation = "nns", -- fake definition
- funcname = "ImageRGB",
- callback = {},
- createfunc = [[
-static int ImageRGB(lua_State *L)
-{
- int w = luaL_checkint(L, 1);
- int h = luaL_checkint(L, 2);
- unsigned char *pixels = iuplua_checkuchar_array(L, 3, w*h*3);
- Ihandle *ih = IupImageRGB(w, h, pixels);
- iuplua_plugstate(L, ih);
- iuplua_pushihandle_raw(L, ih);
- free(pixels);
- return 1;
-}
-
-]]
-}
-
-function ctrl.createElement(class, arg)
- return ImageRGB(arg.width, arg.height, arg.pixels)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- ImageRGBA class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "imagergba",
- parent = WIDGET,
- creation = "nns", -- fake definition
- funcname = "ImageRGBA",
- callback = {},
- createfunc = [[
-static int ImageRGBA(lua_State *L)
-{
- int w = luaL_checkint(L, 1);
- int h = luaL_checkint(L, 2);
- unsigned char *pixels = iuplua_checkuchar_array(L, 3, w*h*4);
- Ihandle *ih = IupImageRGBA(w, h, pixels);
- iuplua_plugstate(L, ih);
- iuplua_pushihandle_raw(L, ih);
- free(pixels);
- return 1;
-}
-
-]]
-}
-
-function ctrl.createElement(class, arg)
- return ImageRGBA(arg.width, arg.height, arg.pixels)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Item class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "item",
- parent = WIDGET,
- creation = "S-",
- callback = {
- action = "",
- highlight_cb = "",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Item(arg.title)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
--- This file is executed with the "iup" table already as the globalindex
-
-------------------------------------------------------------------------------
--- Callback handler
-------------------------------------------------------------------------------
-
-callbacks = {}
-
-function iupCallMethod(name, ...)
- local handle = arg[1] -- always the handle
- local func = handle[name]
- if (not func) then
- return
- end
-
- if type(func) == "function" then
- return func(unpack(arg))
- elseif type(func) == "string" then
- local temp = self
- self = handle
- local result = iup.dostring(func)
- self = temp
- return result
- else
- return iup.ERROR
- end
-end
-
-function RegisterCallback(name, func, type)
- if not callbacks[name] then callbacks[name] = {} end
- local cb = callbacks[name]
- if type then
- cb[type] = func
- else
- cb[1] = func
- end
-end
-
-------------------------------------------------------------------------------
--- Meta Methods
-------------------------------------------------------------------------------
-
-
-local widget_gettable = function(object, index)
- local p = object
- local v
- while 1 do
- v = rawget(p, index)
- if v then return v end
- p = rawget(p, "parent")
- if not p then return nil end
- end
-end
-
-iupNewClass("iup widget")
-iupSetMethod("iup widget", "__index", widget_gettable)
-
-
-local ihandle_gettable = function(handle, index)
- local INDEX = string.upper(index)
- if (callbacks[INDEX]) then
- local object = iupGetWidget(handle)
- if (not object or type(object)~="table") then error("invalid iup handle") end
- return object[index]
- else
- local value = GetAttribute(handle, INDEX)
- if (not value) then
- local object = iupGetWidget(handle)
- if (not object or type(object)~="table") then error("invalid iup handle") end
- return object[index]
- elseif type(value)== "number" or type(value) == "string" then
- local ih = GetHandle(value)
- if ih then return ih
- else return value end
- else
- return value
- end
- end
-end
-
-local ihandle_settable = function(handle, index, value)
- local ti = type(index)
- local tv = type(value)
- local object = iupGetWidget(handle)
- if (not object or type(object)~="table") then error("invalid iup handle") end
- if ti == "number" or ti == "string" then -- check if a valid C name
- local INDEX = string.upper(index)
- local cb = callbacks[INDEX]
- if (cb) then -- if a callback name
- local func = cb[1]
- if (not func) then
- func = cb[GetType(handle)]
- end
- iupSetCallback(handle, INDEX, func, value) -- register the pre-defined C callback
- object[index] = value -- store also in Lua
- elseif iupGetClass(value) == "iup handle" then -- if a iup handle
- local name = ihandle_setname(value)
- StoreAttribute(handle, INDEX, name)
- object[index] = nil -- if there was something in Lua remove it
- elseif tv == "string" or tv == "number" or tv == "nil" then -- if a common value
- StoreAttribute(handle, INDEX, value)
- object[index] = nil -- if there was somthing in Lua remove it
- else
- object[index] = value -- store also in Lua
- end
- else
- object[index] = value -- store also in Lua
- end
-end
-
-iupNewClass("iup handle")
-iupSetMethod("iup handle", "__index", ihandle_gettable)
-iupSetMethod("iup handle", "__newindex", ihandle_settable)
-iupSetMethod("iup handle", "__tostring", ihandle_tostring)
-iupSetMethod("iup handle", "__eq", ihandle_compare) -- implemented in C
-
-
-------------------------------------------------------------------------------
--- Utilities
-------------------------------------------------------------------------------
-
-function ihandle_setname(v) -- used also by radio and zbox
- local name = GetName(v)
- if not name then
- local autoname = string.format("_IUPLUA_NAME(%s)", tostring(v))
- SetHandle(autoname, v)
- return autoname
- end
- return name
-end
-
-function iupRegisterWidget(ctrl) -- called by all the controls initialization functions
- iup[ctrl.nick] = function(arg)
- return ctrl:constructor(arg)
- end
-end
-
-function RegisterHandle(handle, typename)
-
- iupSetClass(handle, "iup handle")
-
- local object = iupGetWidget(handle)
- if not object then
-
- local class = iup[string.upper(typename)]
- if not class then
- class = WIDGET
- end
-
- local object = { parent=class, handle=handle }
- iupSetClass(object, "iup widget")
- iupSetWidget(handle, object)
- end
-
- return handle
-end
-
-------------------------------------------------------------------------------
--- Widget class (top class)
-------------------------------------------------------------------------------
-
-WIDGET = {
- callback = {}
-}
-
-function WIDGET.show(object)
- Show(object.handle)
-end
-
-function WIDGET.hide(object)
- Hide(object.handle)
-end
-
-function WIDGET.map(object)
- Map(object.handle)
-end
-
-function WIDGET.constructor(class, arg)
- local handle = class:createElement(arg)
- local object = {
- parent = class,
- handle = handle
- }
- iupSetClass(handle, "iup handle")
- iupSetClass(object, "iup widget")
- iupSetWidget(handle, object)
- object:setAttributes(arg)
- return handle
-end
-
-function WIDGET.setAttributes(object, arg)
- local handle = object.handle
- for i,v in pairs(arg) do
- if type(i) == "number" and iupGetClass(v) == "iup handle" then
- -- We should not set this or other elements (such as iuptext)
- -- will erroneosly inherit it
- rawset(object, i, v)
- else
- -- this will call settable metamethod
- handle[i] = v
- end
- end
-end
-
--- all the objects in the hierarchy must be "iup widget"
--- Must repeat this call for every new widget
-iupSetClass(WIDGET, "iup widget")
-
-
-------------------------------------------------------------------------------
--- Box class (inherits from WIDGET)
-------------------------------------------------------------------------------
-
-BOX = {
- parent = WIDGET
-}
-
-function BOX.setAttributes(object, arg)
- local handle = rawget(object, "handle")
- local n = table.getn(arg)
- for i = 1, n do
- if iupGetClass(arg[i]) == "iup handle" then
- Append(handle, arg[i])
- end
- end
- WIDGET.setAttributes(object, arg)
-end
-
-iupSetClass(BOX, "iup widget")
-
-
-------------------------------------------------------------------------------
--- Compatibility functions.
-------------------------------------------------------------------------------
-
-error_message_popup = nil
-
-function _ERRORMESSAGE(err)
- if (error_message_popup) then
- error_message_popup.value = err
- else
- local bt = button{title="Ok", size="60", action="error_message_popup = nil; return iup.CLOSE"}
- local ml = multiline{expand="YES", readonly="YES", value=err, size="300x150"}
- local vb = vbox{ml, bt; alignment="ACENTER", margin="10x10", gap="10"}
- local dg = dialog{vb; title="Error Message",defaultesc=bt,defaultenter=bt,startfocus=bt}
- error_message_popup = ml
- dg:popup(CENTER, CENTER)
- dg:destroy()
- error_message_popup = nil
- end
-end
-
-pack = function (...) return arg end
-
-function protectedcall_(f, err)
- if not f then
- _ERRORMESSAGE(err)
- return
- end
- local ret = pack(pcall(f))
- if not ret[1] then
- _ERRORMESSAGE(ret[2])
- return
- else
- table.remove(ret, 1)
- return unpack(ret)
- end
-end
-
-function dostring(s) return protectedcall_(loadstring(s)) end
-function dofile(f) return protectedcall_(loadfile(f)) end
-
-function RGB(r, g, b)
- return string.format("%d %d %d", 255*r, 255*g, 255*b)
-end
-------------------------------------------------------------------------------
--- Label class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "label",
- parent = WIDGET,
- creation = "S",
- callback = {}
-}
-
-function ctrl.createElement(class, arg)
- return Label(arg.title)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- List class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "list",
- parent = WIDGET,
- creation = "-",
- callback = {
- action = "snn",
- multiselect_cb = "s",
- edit_cb = "ns",
- }
-}
-
-function ctrl.createElement(class, arg)
- return List()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Matrix class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "matrix",
- parent = WIDGET,
- creation = "-",
- callback = {
- action_cb = "nnnns",
- click_cb = "nns",
- release_cb = "nns",
- drop_cb = "inn",
- dropcheck_cb = "nn",
- draw_cb = "nnnnnnn", -- fake definitions to be replaced by matrixfuncs module
- dropselect_cb = "nnisnn",
- edition_cb = "nnn",
- enteritem_cb = "nn",
- leaveitem_cb = "nn",
- mousemove_cb = "nn",
- scrolltop_cb = "nn",
- fgcolor_cb = "nn", -- fake definitions to be replaced by matrixfuncs module
- bgcolor_cb = "nn",
- value_cb = {"nn", ret = "s"}, -- ret is return type
- value_edit_cb = "nns",
- mark_cb = "nn",
- markedit_cb = "nnn",
- },
- include = "iupmatrix.h",
- extrafuncs = 1,
-}
-
-function ctrl.createElement(class, arg)
- return Matrix(arg.action)
-end
-
-function ctrl.setcell(handle, l, c, val)
- SetAttribute(handle,l..":"..c,val)
-end
-
-function ctrl.getcell(handle, l, c)
- return GetAttribute(handle,l..":"..c)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Menu class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "menu",
- parent = BOX,
- creation = "-",
- callback = {
- open_cb = "",
- menuclose_cb = "",
- }
-}
-
-function ctrl.popup(handle, x, y)
- Popup(handle, x, y)
-end
-
-function ctrl.append(handle, elem)
- Append(handle, elem)
-end
-
-function ctrl.createElement(class, arg)
- local n = table.getn(arg)
- for i=1,n do
- if type(arg[i]) == "table" then
- itemarg = {}
- for u,v in pairs(arg[i]) do
- if type(u) ~= "number" then
- itemarg[u] = v
- end
- end
- if type(arg[i][1]) == "string" and (type(arg[i][2]) == "function" or type(arg[i][2]) == "string") then
- itemarg.title = arg[i][1]
- itemarg.action = arg[i][2]
- arg[i] = item(itemarg)
- elseif type(arg[i][1]) == "string" and type(arg[i][2]) == "userdata" then
- itemarg[1] = arg[i][2]
- itemarg.title = arg[i][1]
- arg[i] = submenu(itemarg)
- end
- end
- end
- return Menu()
-end
-
-function ctrl.showxy(handle, x, y)
- return ShowXY(handle, x, y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- MessageDlg class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "messagedlg",
- parent = WIDGET,
- creation = "",
- funcname = "MessageDlg",
- callback = {}
-}
-
-function ctrl.popup(handle, x, y)
- Popup(handle,x,y)
-end
-
-function ctrl.destroy(handle)
- return Destroy(handle)
-end
-
-function ctrl.createElement(class, arg)
- return MessageDlg()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-
-------------------------------------------------------------------------------
--- Multiline class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "multiline",
- parent = WIDGET,
- creation = "-",
- callback = {
- action = "ns",
- },
- funcname = "MultiLine",
-}
-
-function ctrl.createElement(class, arg)
- return MultiLine()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- OleControl class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "olecontrol",
- parent = WIDGET,
- creation = "s",
- funcname = "OleControl",
- callback = {},
- include = "iupole.h",
- extracode = [[
-int iupolelua_open(lua_State* L)
-{
- if (iuplua_opencall_internal(L))
- IupOleControlOpen();
-
- iuplua_changeEnv(L);
- iupolecontrollua_open(L);
- iuplua_returnEnv(L);
- return 0;
-}
-
-/* obligatory to use require"iupluaole" */
-int luaopen_iupluaole(lua_State* L)
-{
- return iupolelua_open(L);
-}
-
-/* obligatory to use require"iupluaole51" */
-int luaopen_iupluaole51(lua_State* L)
-{
- return iupolelua_open(L);
-}
-
-]]
-}
-
-function ctrl.createElement(class, arg)
- local ctl = OleControl(arg[1])
-
- -- if luacom is loaded, use it to access methods and properties
- -- of the control
- if luacom then
- local punk = ctl.iunknown
- if punk then
- ctl.com = luacom.MakeLuaCOM(luacom.MakeIUnknown(punk))
- end
- end
-
- return ctl
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- PPlot class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "pplot",
- parent = WIDGET,
- creation = "",
- funcname = "PPlot",
- callback = {
- select_cb = "nnffn",
- selectbegin_cb = "",
- selectend_cb = "",
- predraw_cb = "n", -- fake definitions to be replaced by pplotfuncs module
- postdraw_cb = "n", -- fake definitions to be replaced by pplotfuncs module
- edit_cb = "nnffff", -- fake definitions to be replaced by pplotfuncs module
- editbegin_cb = "",
- editend_cb = "",
- delete_cb = "nnff",
- deletebegin_cb = "",
- deleteend_cb = "",
- },
- include = "iup_pplot.h",
- extrafuncs = 1,
-}
-
-function ctrl.createElement(class, arg)
- return PPlot(arg.action)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "iuplua.c", "scanf.c", "iuplua_api.c", "fontdlg.c",
- "button.c", "canvas.c", "dialog.c", "messagedlg.c",
- "filedlg.c", "fill.c", "frame.c", "hbox.c",
- "item.c", "image.c", "label.c", "menu.c", "multiline.c",
- "list.c", "separator.c", "radio.c", "colordlg.c",
- "submenu.c", "text.c", "toggle.c", "vbox.c", "zbox.c", "timer.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "../src", "$(LUA51)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
---SRCLUA = iuplua.lua constants.lua $(CTRLUA)
---GC = $(addsuffix .c, $(basename $(CTRLUA)))
---$(GC) : %.c : %.lua %.loh generator.lua
--- lua5 generator.lua $<
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluacontrols51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "val.c", "dial.c", "gauge.c", "gc.c", "cbox.c", "cells.c", "getparam.c",
- "colorbrowser.c", "tabs.c", "mask.c", "colorbar.c",
- "matrix.c", "tree.c", "sbox.c", "spin.c", "spinbox.c",
- "controls.c", "mask.c", "treefuncs.c", "matrixfuncs.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(CD)/include", "$(LUA51)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
---SRCLUA = val.lua dial.lua gauge.lua colorbrowser.lua tabs.lua sbox.lua matrix.lua tree.lua spin.lua spinbox.lua
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua_pplot51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "pplot.c", "pplotfuncs.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(CD)/include", "$(LUA51)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
---SRCLUA = pplot.lua
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluagl51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "glcanvas.c", "glcanvasfuncs.c"
-}
-fixPackagePath(package.files)
-
--- SRCLUA = glcanvas.lua
-
-package.includepaths = { "../include", "$(LUA51)/include" }
-package.defines = {"IUPLUA_USELOH"}
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iupluaim51"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.files =
-{
- "iupluaim.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { "../include", "$(LUA51)/include" }
-
----------------------------------------------------------------------
-
-package = newpackage()
-package.name = "iuplua51exe"
-package.target = "iuplua51"
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "exe"
-package.linkflags = { "static-runtime" }
-
-package.files =
-{
- "iupluaexe51.c"
-}
-fixPackagePath(package.files)
-
--- SRCLUA = console.lua
-
-package.includepaths = { "../include", "$(LUA51)/include", "$(CD)/include", "$(IM)/include" }
-
-package.links = { "imlua_process51", "im_process", "imlua_cd51", "imlua51",
- "cdluaiup51", "cdlua51",
- "iupluagl51", "iupluaim51", "iuplua_pplot51.lib", "iupluacontrols51", "iuplua51",
- "lua5.1",
- "iupgl", "iupim", "iup_pplot.lib", "iupcontrols",
- "cdiup", "cd", "iup", "im" }
-package.libpaths = { "../lib", "$(IM)/lib", "$(CD)/lib", "$(LUA51)/lib", }
-
-if (options.os == "windows") then
- tinsert(package.links, { "cdgdiplus", "gdiplus", "comctl32", "opengl32", "glu32", "glaux" })
-else
- tinsert(package.links, { "GLU", "GL", "Xm", "Xpm", "Xmu", "Xt", "Xext", "X11", "m" })
- tinsert(package.libpaths, { "/usr/X11R6/lib" })
-end
-
----------------------------------------------------------------------
-------------------------------------------------------------------------------
--- Radio class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "radio",
- parent = WIDGET,
- creation = "i",
- callback = {}
-}
-
-function ctrl.CreateChildrenNames(obj)
- if obj then
- if obj.parent.parent == BOX then
- local i = 1
- while obj[i] do
- ctrl.CreateChildrenNames (obj[i])
- i = i+1
- end
- elseif obj.parent == IUPFRAME then
- ctrl.CreateChildrenNames (obj[1])
- else
- ihandle_setname(obj)
- end
- end
-end
-
-function ctrl.createElement(class, arg)
- ctrl.CreateChildrenNames(arg[1])
- return Radio(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Sbox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "sbox",
- parent = WIDGET,
- creation = "i",
- callback = {},
- include="iupsbox.h"
-}
-
-function ctrl.createElement(class, arg)
- return Sbox(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Separator class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "separator",
- parent = WIDGET,
- creation = "",
- callback = {}
-}
-
-function ctrl.createElement(class, arg)
- return Separator()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Spin class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "spin",
- parent = WIDGET,
- creation = "",
- callback = {
- spin_cb = "n",
- },
- include = "iupspin.h",
-}
-
-function ctrl.createElement(class, arg)
- return Spin(arg.action)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- SpinBox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "spinbox",
- parent = WIDGET,
- creation = "i",
- callback = {
- spin_cb = "n",
- },
- include = "iupspin.h",
-}
-
-function ctrl.createElement(class, arg)
- return Spinbox(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Submenu class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "submenu",
- parent = WIDGET,
- creation = "Si",
- callback = {
--- open_cb = "", -- already registered by the menu
--- menuclose_cb = "", -- already registered by the menu
- }
-}
-
-function ctrl.createElement(class, arg)
- return Submenu(arg.title, arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Tabs class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "tabs",
- parent = WIDGET,
- creation = "v",
- callback = {
- tabchange_cb = "ii",
- },
- include = "iuptabs.h",
- funcname = "Tabsv",
- createfunc = [[
-static int Tabsv(lua_State *L)
-{
- Ihandle **hlist = iuplua_checkihandle_array(L, 1);
- Ihandle *h = IupTabsv(hlist);
- iuplua_plugstate(L, h);
- iuplua_pushihandle_raw(L, h);
- free(hlist);
- return 1;
-}
-
-]],
-}
-
-function ctrl.createElement(class, arg)
- return Tabsv(arg)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Text class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "text",
- parent = WIDGET,
- creation = "-",
- callback = {
- action = "ns",
- caret_cb = "nn",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Text()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Timer class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "timer",
- parent = WIDGET,
- creation = "",
- callback = {
- action_cb = "",
- },
-}
-
-function ctrl.createElement(class, arg)
- return Timer()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Toggle class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "toggle",
- parent = WIDGET,
- creation = "S-",
- callback = {
- action = "n",
- }
-}
-
-function ctrl.createElement(class, arg)
- return Toggle(arg.title)
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Tree class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "tree",
- parent = WIDGET,
- creation = "",
- callback = {
- selection_cb = "nn",
- multiselection_cb = "nn", -- fake definition to be replaced by treefuncs module
- branchopen_cb = "n",
- branchclose_cb = "n",
- executeleaf_cb = "n",
- renamenode_cb = "ns",
- rename_cb = "ns",
- showrename_cb = "n",
- rightclick_cb = "n",
- dragdrop_cb = "nnnn",
- },
- include = "iuptree.h",
- extrafuncs = 1,
-}
-
-function TreeSetValueRec(handle, t, id)
- if t == nil then return end
- local cont = table.getn(t)
- while cont >= 0 do
- if type (t[cont]) == "table" then
- if t[cont].branchname ~= nil then
- SetAttribute(handle, "ADDBRANCH"..id, t[cont].branchname)
- TreeSetValueRec(handle, t[cont], id+1)
- end
- else
- if t[cont] then
- SetAttribute(handle, "ADDLEAF"..id, t[cont])
- end
- end
- cont = cont - 1
- end
-end
-
-function TreeSetValue(handle, t)
- if t.branchname ~= nil then
- SetAttribute(handle, "NAME", t.branchname)
- end
- TreeSetValueRec(handle, t, 0)
-end
-
-function ctrl.createElement(class, arg)
- return Tree()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- Val class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "val",
- parent = WIDGET,
- creation = "s",
- callback = {
- mousemove_cb = "d",
- button_press_cb = "d",
- button_release_cb = "d",
- },
- include = "iupval.h",
-}
-
-function ctrl.createElement(class, arg)
- return Val(arg[1])
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- VBox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "vbox",
- parent = BOX,
- creation = "-",
- callback = {}
-}
-
-function ctrl.append (handle, elem)
- Append(handle, elem)
-end
-
-function ctrl.createElement(class, arg)
- return Vbox()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-------------------------------------------------------------------------------
--- ZBox class
-------------------------------------------------------------------------------
-local ctrl = {
- nick = "zbox",
- parent = BOX,
- creation = "-",
- callback = {}
-}
-
-function ctrl.append (handle, elem)
- ihandle_setname(elem)
- Append(handle, elem)
-end
-
-function ctrl.SetChildrenNames(obj)
- if obj then
- local i = 1
- while obj[i] do
- ihandle_setname(obj[i])
- i = i+1
- end
- end
-end
-
-function ctrl.createElement(class, arg)
- ctrl.SetChildrenNames(arg)
- return Zbox()
-end
-
-iupRegisterWidget(ctrl)
-iupSetClass(ctrl, "iup widget")
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iup_pplot"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "lib"
-package.buildflags = { "static-runtime" }
-
-package.includepaths = { ".", "../include" }
-
-package.files = { "iup_pplot.cpp", "PPlot.cpp", "PPlotInteraction.cpp" }
-fixPackagePath(package.files)
-
-----------------------------------------------------
-----------------------------------------------------
--- The main porpouse of this file is to build linux gcc makefiles.
--- Must have Premake version 3 installed.
--- Original Premake was changed to remove some parameters and add others.
--- Default parameters:
--- premake3s --target gnu --os linux
--- But it can build windows gcc makefiles, and visual studio projects.
--- premake3s --target gnu --os windows
--- premake3s --target gnu --os macosx
--- premake3s --target vs6
--- premake3s --target vs2002
--- premake3s --target vs2003
--- premake3s --target vs2005
--- In Linux the generated makefiles will not correctly build libraries in 64-bits.
--- must add "-m64 -fPIC" flags
-----------------------------------------------------
-
-if (not options.target) then
- options.target = "gnu"
-end
-
-if (not options.os) then
- if (options.target ~= "gnu") then
- options.os = "windows"
- else
- options.os = "linux"
- end
-end
-
-function fixPackagePath(package_files)
- if (options.os ~= "linux") then
- for i, file in package_files do
- package_files[i] = "../src/"..file
- end
- end
-end
-
-----------------------------------------------------
-
-project.name = "iup"
-project.bindir = "../bin"
-project.libdir = "../lib"
-
-if (options.os ~= "linux") then
- if (options.os == "macosx") then
- project.path = "../mak.macosx"
- else
- project.path = "../mak."..options.target
- end
-end
-
-----------------------------------------------------
-
-package = newpackage()
-package.name = "iupview"
-package.target = package.name
-package.objdir = "../obj/"..package.name
-package.language = "c++"
-package.kind = "winexe"
-package.linkflags = { "static-runtime" }
-
-package.files =
-{
- "iupview.c"
-}
-fixPackagePath(package.files)
-
-package.includepaths = { ".", "../include", "$(CD)/include" }
-package.links = { "iupgl", "iupim", "iupimglib", "iupcontrols", "cdiup", "cd", "iup", "im" }
-package.libpaths = { "../lib", "$(IM)/lib", "$(CD)/lib" }
-
-if (options.os == "windows") then
- tinsert(package.links, { "comctl32", "opengl32", "glu32", "glaux" })
-else
- tinsert(package.links, { "GLU", "GL", "Xm", "Xpm", "Xmu", "Xt", "Xext", "X11", "m" })
- tinsert(package.libpaths, { "/usr/X11R6/lib" })
-end
-
-----------------------------------------------------
-
-l = iup.label{title="1", size="200x"}
-
-function idle_cb()
- local v = tonumber(l.title) + 1
- l.title = v
- if v == 10000 then
- iup.SetIdle(nil)
- end
- return iup.DEFAULT
-end
-
-dlg = iup.dialog{l; title = "Idle Test"}
-
-dlg:showxy(iup.CENTER, iup.CENTER)
-
--- Registers idle callback
-iup.SetIdle(idle_cb)
-
--- Creates a IupColorBrowser control and updates, through
--- callbacks, the values of texts representing the R, G and B
--- components of the selected color.
-
-text_red = iup.text{}
-text_green = iup.text{}
-text_blue = iup.text{}
-
-cb = iup.colorbrowser{}
-
-function update(r, g, b)
- text_red.value = r
- text_green.value = g
- text_blue.value = b
-end
-
-function cb:drag_cb(r, g ,b)
- update(r,g,b)
-end
-
-function cb:change_cb(r, g ,b)
- update(r,g,b)
-end
-
-vbox = iup.vbox {
- iup.fill {},
- text_red,
- iup.fill {},
- text_green,
- iup.fill {},
- text_blue,
- iup.fill {}
- }
-
-dlg = iup.dialog{iup.hbox {cb, iup.fill{}, vbox}; title = "ColorBrowser"}
-dlg:showxy(iup.CENTER, iup.CENTER)
---IupDial Example in IupLua
-
-lbl_h = iup.label{title = "0", alignment = "ACENTER", size = "100x10"}
-lbl_v = iup.label{title = "0", alignment = "ACENTER", size = "100x10"}
-lbl_c = iup.label{title = "0", alignment = "ACENTER", size = "100x10"}
-
-dial_v = iup.dial{"VERTICAL"; size="100x100"}
-dial_h = iup.dial{"HORIZONTAL"; density=0.3}
-
-function dial_v:mousemove_cb(a)
- lbl_v.title = a
- return iup.DEFAULT
-end
-
-function dial_v:button_press_cb(a)
- lbl_v.bgcolor = "255 0 0"
- return iup.DEFAULT
-end
-
-function dial_v:button_release_cb(a)
- lbl_v.bgcolor = nil
- return iup.DEFAULT
-end
-
-function dial_h:mousemove_cb(a)
- lbl_h.title = a
- return iup.DEFAULT
-end
-
-function dial_h:button_press_cb(a)
- lbl_h.bgcolor = "255 0 0"
- return iup.DEFAULT
-end
-
-function dial_h:button_release_cb(a)
- lbl_h.bgcolor = nil
- return iup.DEFAULT
-end
-
-dlg = iup.dialog
-{
- iup.hbox
- {
- iup.fill{},
- iup.vbox
- {
- iup.fill{},
- iup.frame
- {
- iup.vbox
- {
- iup.hbox
- {
- iup.fill{},
- dial_v,
- iup.fill{}
- } ,
- iup.hbox
- {
- iup.fill{},
- lbl_v,
- iup.fill{}
- }
- }
- },
- iup.fill{},
- iup.frame
- {
- iup.vbox
- {
- iup.hbox
- {
- iup.fill{},
- dial_h,
- iup.fill{}
- } ,
- iup.hbox
- {
- iup.fill{},
- lbl_h,
- iup.fill{}
- } ,
- }
- },
- iup.fill{},
- },
- iup.fill{}
- }; title="IupDial"
-}
-
-dlg:showxy(iup.CENTER,iup.CENTER)
-
-
-function idle_cb()
- local value = gauge.value
- value = value + 0.0001;
- if value > 1.0 then
- value = 0.0
- end
- gauge.value = value
- return iup.DEFAULT
-end
-
-gauge = iup.gauge{}
-gauge.size = "QUARTERxEIGHTH"
-gauge.show_text = "YES"
-
-dlg = iup.dialog{gauge; title = "IupGauge"}
-
--- Registers idle callback
-iup.SetIdle(idle_cb)
-
-dlg:showxy(iup.CENTER, iup.CENTER)
---
--- IupGetColor Example in IupLua
---
--- Creates a predefined color selection dialog which returns the
--- selected color in the RGB format.
---
-
-r, g, b = iup.GetColor(100, 100, 255, 255, 255)
-if (r) then
- print("r="..r.." g="..g.." b="..b)
-end
--- IupGetParam Example in IupLua
--- Shows a dialog with all possible fields.
-
-iup.SetLanguage("ENGLISH")
-
-function param_action(dialog, param_index)
- if (param_index == -1) then
- print("OK")
- elseif (param_index == -2) then
- print("Map")
- elseif (param_index == -3) then
- print("Cancel")
- else
- local param = iup.GetParamParam(dialog, param_index)
- print("PARAM"..param_index.." = "..param.value)
- end
- return 1
-end
-
--- set initial values
-pboolean = 1
-pinteger = 3456
-preal = 3.543
-pinteger2 = 192
-preal2 = 0.5
-pangle = 90
-pstring = "string text"
-plist = 2
-pstring2 = "second text\nsecond line"
-
-ret, pboolean, pinteger, preal, pinteger2, preal2, pangle, pstring, plist, pstring2 =
- iup.GetParam("Title", param_action,
- "Boolean: %b\n"..
- "Integer: %i\n"..
- "Real 1: %r\n"..
- "Sep1 %t\n"..
- "Integer: %i[0,255]\n"..
- "Real 2: %r[-1.5,1.5]\n"..
- "Sep2 %t\n"..
- "Angle: %a[0,360]\n"..
- "String: %s\n"..
- "List: %l|item1|item2|item3|\n"..
- "Sep3 %t\n"..
- "Multiline: %m\n",
- pboolean, pinteger, preal, pinteger2, preal2, pangle, pstring, plist, pstring2)
-if (ret == 0) then
- return
-end
-
-iup.Message("IupGetParam",
- "Boolean Value: "..pboolean.."\n"..
- "Integer: "..pinteger.."\n"..
- "Real 1: "..preal.."\n"..
- "Integer: "..pinteger2.."\n"..
- "Real 2: "..preal2.."\n"..
- "Angle: "..pangle.."\n"..
- "String: "..pstring.."\n"..
- "List Index: "..plist.."\n"..
- "String: "..pstring2)
--- Example IupGLCanvas in Lua
--- Creates a OpenGL canvas and draws a line in it.
--- This example uses gllua binding of OpenGL to Lua.
-
-cv = iup.glcanvas{buffer="DOUBLE", rastersize = "300x300"}
-
-function cv:action(x, y)
- iup.GLMakeCurrent(self)
- --glClearColor(1.0, 1.0, 1.0, 1.0)
- --glClear(GL_COLOR_BUFFER_BIT)
- --glClear(GL_DEPTH_BUFFER_BIT)
- --glMatrixMode( GL_PROJECTION )
- --glViewport(0, 0, 300, 300)
- --glLoadIdentity()
- --glBegin( GL_LINES )
- --glColor(1.0, 0.0, 0.0)
- --glVertex(0.0, 0.0)
- --glVertex(10.0, 10.0)
- --glEnd()
- iup.GLSwapBuffers(self)
- return iup.DEFAULT
-end
-
-dg = iup.dialog{cv; title="IupGLCanvas Example"}
-
-function cv:k_any(c)
- if c == iup.K_q then
- return iup.CLOSE
- else
- return iup.DEFAULT
- end
-end
-
-
-dg:show()
-
-canvas = iup.glcanvas{buffer="DOUBLE", rastersize = "640x480"}
-
-function canvas:resize_cb(width, height)
- iup.GLMakeCurrent(self)
-
- gl.Viewport(0, 0, width, height)
-
- gl.MatrixMode('PROJECTION')
- gl.LoadIdentity()
-
- gl.MatrixMode('MODELVIEW')
- gl.LoadIdentity()
-
-end
-
-function canvas:action()
- iup.GLMakeCurrent(self)
-
- gl.MatrixMode("PROJECTION")
- gl.LoadIdentity()
- gl.Ortho(0, 1, 1, 0, -1.0, 1.0)
- gl.MatrixMode("MODELVIEW")
- gl.LoadIdentity()
- gl.PushMatrix()
- gl.Translate(0.25,0.5, 0)
- gl.Scale(0.2, 0.2, 1)
-
- gl.BlendFunc("SRC_ALPHA", "ONE_MINUS_SRC_ALPHA")
-
- gl.ClearColor(0,0,0,1)
- gl.Clear("DEPTH_BUFFER_BIT,COLOR_BUFFER_BIT")
- gl.Enable("BLEND")
-
- -- draw rectangle
- gl.Color( {1, 1, 0, 0.8} )
- gl.Rect(-1,-1,1,1)
-
- --------------------------------------------------------
- -- Create List That Draws the Circle
- --------------------------------------------------------
-
- planet = 1
- orbit = 2
- pi =
-
- gl.NewList(planet, "COMPILE")
- gl.Begin("POLYGON")
- for i=0, 100 do
- cosine = math.cos(i * 2 * math.pi/100.0)
- sine = math.sin(i * 2 * math.pi/100.0)
- gl.Vertex(cosine,sine)
- end
- gl.End()
- gl.EndList()
-
- gl.NewList(orbit, "COMPILE")
- gl.Begin("LINE_LOOP")
- for i=0, 100 do
- cosine = math.cos(i * 2 * math.pi/100.0)
- sine = math.sin(i * 2 * math.pi/100.0)
- gl.Vertex(cosine, sine)
- end
- gl.End()
- gl.EndList()
-
- --------------------------------------------------------
-
- gl.Color( {0, 0.5, 0, 0.8} )
- gl.CallList(planet)
-
- gl.Color( {0, 0, 0, 1} )
- lists = { orbit }
- gl.CallLists(lists)
-
- gl.EnableClientState ("VERTEX_ARRAY")
-
- vertices = { {-3^(1/2)/2, 1/2}, {3^(1/2)/2, 1/2}, {0, -1}, {-3^(1/2)/2, -1/2}, {3^(1/2)/2, -1/2}, {0, 1} }
-
- gl.VertexPointer (vertices)
-
- -- draw first triangle
- gl.Color( {0, 0, 1, 0.5} )
-
- gl.Begin("TRIANGLES")
- gl.ArrayElement (0)
- gl.ArrayElement (1)
- gl.ArrayElement (2)
- gl.End()
-
- -- draw second triangle
- gl.Color( {1, 0, 0, 0.5} )
- gl.VertexPointer (vertices)
- gl.DrawArrays("TRIANGLES", 3, 3)
-
- -- draw triangles outline
- gl.Color(1,1,1,1)
- elements = { 0, 1, 2} gl.DrawElements("LINE_LOOP", elements)
- elements = { 3, 4, 5} gl.DrawElements("LINE_LOOP", elements)
-
- gl.DisableClientState ("VERTEX_ARRAY")
-
- gl.PopMatrix()
- gl.Translate(0.75,0.5, 0)
- gl.Scale(0.2, 0.2, 1)
-
- ----------------------------------------------------------------------------
-
- gl.BlendFunc("SRC_ALPHA", "ONE_MINUS_SRC_ALPHA")
-
- -- draw rectangle
- gl.Color( {1, 1, 0, 0.8} )
-
- gl.Begin("QUADS")
- gl.Vertex(-1,-1)
- gl.Vertex( 1,-1)
- gl.Vertex( 1, 1)
- gl.Vertex(-1, 1)
- gl.End()
- -------------------------------
- gl.Color( {0, 0.5, 0, 0.8} )
- gl.Begin("POLYGON")
- for i=0, 100 do
- cosine = math.cos(i * 2 * math.pi/100.0)
- sine = math.sin(i * 2 * math.pi/100.0)
- gl.Vertex(cosine,sine)
- end
- gl.End()
-
- gl.Color( {0, 0, 0, 1} )
- gl.Begin("LINE_LOOP")
- for i=0, 100 do
- cosine = math.cos(i * 2 * math.pi/100.0)
- sine = math.sin(i * 2 * math.pi/100.0)
- gl.Vertex(cosine, sine)
- end
- gl.End()
-
- -- draw first triangle
- gl.Color( {0, 0, 1, 0.5} )
- gl.Begin("TRIANGLES")
- gl.Vertex (vertices[1])
- gl.Vertex (vertices[2])
- gl.Vertex (vertices[3])
- gl.End()
- -- draw second triangle
- gl.Color( {1, 0, 0, 0.5} )
- gl.Begin("TRIANGLES")
- gl.Vertex (vertices[4])
- gl.Vertex (vertices[5])
- gl.Vertex (vertices[6])
- gl.End()
- -- draw triangles outline
- gl.Color(1,1,1,1)
- gl.Begin("LINE_LOOP")
- gl.Vertex (vertices[1])
- gl.Vertex (vertices[2])
- gl.Vertex (vertices[3])
- gl.End()
- gl.Begin("LINE_LOOP")
- gl.Vertex (vertices[4])
- gl.Vertex (vertices[5])
- gl.Vertex (vertices[6])
- gl.End()
-
- iup.GLSwapBuffers(self)
- gl.Flush()
-
-end
-
-dialog = iup.dialog{canvas; title="Lua GL Test Application"}
-dialog:show()
--- IupMask Example in Lua
--- Creates an IupText that accepts only numbers.
-
-txt = iup.text{}
-iup.maskSet(txt, "/d*", 0, 1) ;
-dg = iup.dialog{txt}
-dg:show()mat= iup.matrix{numlin=3, numcol=3}
-mat:setcell(1,1,"Only numbers")
-iup.maskMatSet(mat, "/d*", 0, 1, 1, 1) ;
-dg = iup.dialog{mat}
-dg:show()
-
-mat = iup.matrix {numcol=5, numlin=3,numcol_visible=5, numlin_visible=3, widthdef=34}
-mat.resizematrix = "YES"
-mat:setcell(0,0,"Inflation")
-mat:setcell(1,0,"Medicine")
-mat:setcell(2,0,"Food")
-mat:setcell(3,0,"Energy")
-mat:setcell(0,1,"January 2000")
-mat:setcell(0,2,"February 2000")
-mat:setcell(1,1,"5.6")
-mat:setcell(2,1,"2.2")
-mat:setcell(3,1,"7.2")
-mat:setcell(1,2,"4.6")
-mat:setcell(2,2,"1.3")
-mat:setcell(3,2,"1.4")
-dlg = iup.dialog{iup.vbox{mat; margin="10x10"}}
-dlg:showxy(iup.CENTER, iup.CENTER)
-matrix = iup.matrix
-{
- numlin=3,
- numcol=3,
- numcol_visible=3,
- height0=10,
- widthdef=30,
- scrollbar="VERTICAL",
-}
-
-data = {
- {"1:1", "1:2", "1:3"},
- {"2:1", "2:2", "2:3"},
- {"3:1", "3:2", "3:3"},
- }
-
-function matrix:value_cb(l, c)
- if l == 0 or c == 0 then
- return "title"
- end
- return data[l][c]
-end
-
-function matrix:value_edit_cb(l, c, newvalue)
- data[l][c] = newvalue
-end
-
-dlg=iup.dialog{matrix; title="IupMatrix in Callback Mode" }
-dlg:show()
-
-bt = iup.button{title="Test"}
-bt.expand = "YES"
-box = iup.sbox{bt}
-box.direction = "SOUTH"
-box.color = "0 0 255"
-
-ml = iup.multiline{}
-ml.expand = "YES"
-vbox = iup.vbox{box, ml}
-
-lb = iup.label{title="Label"}
-lb.expand = "YES"
-dg = iup.dialog{iup.hbox{vbox, lb}}
-dg:show()
---IupSpeech Example in Lua
-
-label = iuplabel{title="Possible commands are defined in xml1.xml"}
-text = iuptext {size="200"}
-
-function reco(self, msg)
- text.value = msg
-end
-
-sk = iupspeech{action=reco, grammar="xml1.xml", say="xml1 loaded"}
-
-dg = iupdialog{iupvbox{label, text}; title = "IupSpeech Test"}
-dg:show()
--- Creates boxes
-vboxA = iup.vbox{iup.label{title="TABS AAA"}, iup.button{title="AAA"}}
-vboxB = iup.vbox{iup.label{title="TABS BBB"}, iup.button{title="BBB"}}
-
--- Sets titles of the vboxes
-vboxA.tabtitle = "AAAAAA"
-vboxB.tabtitle = "BBBBBB"
-
--- Creates tabs
-tabs = iup.tabs{vboxA, vboxB}
-
--- Creates dialog
-dlg = iup.dialog{tabs; title="Test IupTabs", size="200x80"}
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER, iup.CENTER)-- IupTree Example in IupLua
--- Creates a tree with some branches and leaves.
--- Two callbacks are registered: one deletes marked nodes when the Del key
--- is pressed, and the other, called when the right mouse button is pressed,
--- opens a menu with options.
-
-tree = iup.tree{}
-
--- Creates rename dialog
-ok = iup.button{title = "OK",size="EIGHTH"}
-cancel = iup.button{title = "Cancel",size="EIGHTH"}
-
-text = iup.text{border="YES",expand="YES"}
-dlg_rename = iup.dialog{iup.vbox{text,iup.hbox{ok,cancel}};
- defaultenter=ok,
- defaultesc=cancel,
- title="Enter node's name",
- size="QUARTER",
- startfocus=text}
-
--- Creates menu displayed when the right mouse button is pressed
-addleaf = iup.item {title = "Add Leaf"}
-addbranch = iup.item {title = "Add Branch"}
-renamenode = iup.item {title = "Rename Node"}
-menu = iup.menu{addleaf, addbranch, renamenode}
-
--- Callback of the right mouse button click
-function tree:rightclick_cb(id)
- tree.value = id
- menu:popup(iup.MOUSEPOS,iup.MOUSEPOS)
- return iup.DEFAULT
-end
-
--- Callback called when a node will be renamed
-function tree:renamenode_cb(id)
- text.value = tree.name
-
- dlg_rename:popup(iup.CENTER, iup.CENTER)
- iup.SetFocus(tree)
-
- return iup.DEFAULT
-end
-
--- Callback called when the rename operation is cancelled
-function cancel:action()
- return iup.CLOSE
-end
-
--- Callback called when the rename operation is confirmed
-function ok:action()
- tree.name = text.value
-
- return iup.CLOSE
-end
-
-function tree:k_any(c)
- if c == 339 then tree.delnode = "MARKED" end
- return iup.DEFAULT
-end
-
--- Callback called when a leaf is added
-function addleaf:action()
- tree.addleaf = ""
- tree.redraw = "YES"
- return iup.DEFAULT
-end
-
--- Callback called when a branch is added
-function addbranch:action()
- tree.addbranch = ""
- tree.redraw = "YES"
- return iup.DEFAULT
-end
-
--- Callback called when a branch will be renamed
-function renamenode:action()
- tree:renamenode_cb(tree.value)
- tree.redraw = "YES"
- return iup.DEFAULT
-end
-
-function init_tree_atributes()
- tree.font = "COURIER_NORMAL_10"
- tree.name = "Figures"
- tree.addbranch = "3D"
- tree.addbranch = "2D"
- tree.addbranch1 = "parallelogram"
- tree.addleaf2 = "diamond"
- tree.addleaf2 = "square"
- tree.addbranch1 = "triangle"
- tree.addleaf2 = "scalenus"
- tree.addleaf2 = "isoceles"
- tree.value = "6"
- tree.ctrl = "YES"
- tree.shift = "YES"
- tree.addexpanded = "NO"
- tree.redraw = "YES"
-end
-
-dlg = iup.dialog{tree; title = "IupTree", size = "QUARTERxTHIRD"}
-dlg:showxy(iup.CENTER,iup.CENTER)
-init_tree_atributes()--IupTree Example in IupLua
---Creates a tree with some branches and leaves. Uses a Lua Table to define the IupTree structure.
-
-tree = iup.tree{}
-dlg = iup.dialog{tree ; title = "TableTree result", size = "200x200"}
-dlg:showxy(iup.CENTER,iup.CENTER)
-
-t = {
- {
- "Horse",
- "Whale";
- branchname = "Mammals"
- },
- {
- "Shrimp",
- "Lobster";
- branchname = "Crustaceans"
- };
- branchname = "Animals"
-}
-iup.TreeSetValue(tree, t)
-
-tree.redraw = "YES"
--- IupTree Example in IupLua
--- Creates a tree with some branches and leaves.
--- Two callbacks are registered: one deletes marked nodes when the Del key
--- is pressed, and the other, called when the right mouse button is pressed,
--- opens a menu with options.
-
-
-tree = iup.tree{}
-
-
-function tree:showrename_cb(id)
- print("SHOWRENAME")
- return iup.DEFAULT
-end
--- Callback called when a node will be renamed
-function tree:renamenode_cb(id)
- print("RENAMENODE")
- return iup.DEFAULT
-end
-
-
-function tree:k_any(c)
- if c == 316 then tree.delnode = "MARKED" end
- return iup.DEFAULT
-end
-
-
-function init_tree_atributes()
- tree.font = "COURIER_NORMAL_10"
- tree.name = "Figures"
- tree.addbranch = "3D"
- tree.addbranch = "2D"
- tree.addbranch1 = "parallelogram"
- tree.addleaf2 = "diamond"
- tree.addleaf2 = "square"
- tree.addbranch1 = "triangle"
- tree.addleaf2 = "scalenus"
- tree.addleaf2 = "isoceles"
- tree.value = "6"
- tree.ctrl = "YES"
- tree.shift = "YES"
- tree.addexpanded = "NO"
- tree.redraw = "YES"
- tree.showrename = "NO"
-end
-
-
-dlg = iup.dialog{tree; title = "IupTree", size = "QUARTERxTHIRD"}
-dlg:showxy(iup.CENTER,iup.CENTER)
-init_tree_atributes()-- IupVal Example in IupLua
--- Creates two Valuator controls, exemplifying the two possible types.
--- When manipulating the Valuator, the label's value changes.
-
-if not string then
- string = {}
- string.format = format
-end
-
-function fbuttonpress(self)
- if(self.type == "VERTICAL") then
- lbl_v.fgcolor = "255 0 0"
- else
- lbl_h.fgcolor = "255 0 0"
- end
- return iup.DEFAULT
-end
-
-function fbuttonrelease(self)
- if(self.type == "VERTICAL") then
- lbl_v.fgcolor = "0 0 0"
- else
- lbl_h.fgcolor = "0 0 0"
- end
- return iup.DEFAULT
-end
-
-function fmousemove(self, val)
- local buffer = "iup.VALUE="..string.format('%.2f', val)
- if (self.type == "VERTICAL") then
- lbl_v.title=buffer
- else
- lbl_h.title=buffer
- end
- return iup.DEFAULT
-end
-
-val_v = iup.val{"VERTICAL"; min=0, max=1, value="0.3",
- mousemove_cb=fmousemove,
- button_press_cb=fbuttonpress,
- button_release_cb=fbuttonrelease
-}
-
-lbl_v = iup.label{title="VALUE= ", size=70, type="1"}
-
-val_h = iup.val{"HORIZONTAL"; min=0, max=1, value=0,
- mousemove_cb=fmousemove,
- button_press_cb=fbuttonpress,
- button_release_cb=fbuttonrelease
-}
-
-lbl_h = iup.label{title="VALUE= ", size=70, type="2"}
-
-dlg_val = iup.dialog
-{
- iup.hbox
- {
- iup.frame
- {
- iup.vbox
- {
- val_v,
- lbl_v
- }
- },
- iup.frame
- {
- iup.vbox
- {
- val_h,
- lbl_h
- }
- }
- };
- title="Valuator Test"
-}
-
-dlg_val:show()
-
--- IupAlarm Example in IupLua
--- Shows a dialog similar to the one shown when you exit a program
--- without saving.
-
-b = iup.Alarm("IupAlarm Example", "File not saved! Save it now?" ,"Yes" ,"No" ,"Cancel")
-
--- Shows a message for each selected button
-if b == 1 then
- iup.Message("Save file", "File saved sucessfully - leaving program")
-elseif b == 2 then
- iup.Message("Save file", "File not saved - leaving program anyway")
-elseif b == 3 then
- iup.Message("Save file", "Operation canceled")
-end-- IupFileDlg Example in IupLua
--- Shows a typical file-saving dialog.
-
--- Creates a file dialog and sets its type, title, filter and filter info
-filedlg = iup.filedlg{dialogtype = "SAVE", title = "File save",
- filter = "*.bmp", filterinfo = "Bitmap files",
- directory="c:\\windows"}
-
--- Shows file dialog in the center of the screen
-filedlg:popup (iup.ANYWHERE, iup.ANYWHERE)
-
--- Gets file dialog status
-status = filedlg.status
-
-if status == "1" then
- iup.Message("New file",filedlg.value)
-elseif status == "0" then
- iup.Message("File already exists", filedlg.value)
-elseif status == "-1" then
- iup.Message("IupFileDlg","Operation canceled")
-end-- IupGetFile Example in IupLua
--- Shows a typical file-selection dialog.
-
-iup.SetLanguage("ENGLISH")
-f, err = iup.GetFile("*.txt")
-if err == 1 then
- iup.Message("New file", f)
-elseif err == 0 then
- iup.Message("File already exists", f)
-elseif err == -1 then
- iup.Message("IupFileDlg", "Operation canceled")
-elseif err == -2 then
- iup.Message("IupFileDlg", "Allocation errr")
-elseif err == -3 then
- iup.Message("IupFileDlg", "Invalid parameter")
-end-- IupListDialog Example in IupLua
--- Shows a color-selection dialog.
-
-iup.SetLanguage("ENGLISH")
-size = 8
-marks = { 0,0,0,0,1,1,0,0 }
-options = {"Blue", "Red", "Green", "Yellow", "Black", "White", "Gray", "Brown"}
-
-error = iup.ListDialog(2,"Color selection",size,options,0,16,5,marks);
-
-if error == -1 then
- iup.Message("IupListDialog", "Operation canceled")
-else
- local selection = ""
- local i = 1
- while i ~= size+1 do
- if marks[i] ~= 0 then
- selection = selection .. options[i] .. "\n"
- end
- i = i + 1
- end
- if selection == "" then
- iup.Message("IupListDialog","No option selected")
- else
- iup.Message("Selected options",selection)
- end
-end-- IupMessage Example in IupLua
--- Shows a dialog with the message: “Click the button”.
-
-iup.Message ("IupMessage", "Press the button")-- IupScanf Example in IupLua
--- Shows a dialog with three fields to be filled.
--- One receives a string, the other receives a real number and
--- the last receives an integer number.
--- Note: In Lua, the function does not return the number of successfully read characters.
-
-iup.SetLanguage("ENGLISH")
-local integer = 12
-local real = 1e-3
-local text ="This is a vector of characters"
-local fmt = "IupScanf\nText:%300.40%s\nReal:%20.10%g\nInteger:%20.10%d\n"
-
-text, real, integer = iup.Scanf (fmt, text, real, integer)
-
-if text then
- local string = "Text: "..text.."\nReal: "..real.."\nInteger: "..integer
- iup.Message("IupScanf", string)
-else
- iup.Message("IupScanf", "Operation canceled");
-end
--- Creates four buttons. The first uses images, the second turns the first
--- on and off, the third exits the application and the last does nothing
-
--- defines released button image
-img_release = iup.image {
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
- {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
- colors = { "215 215 215", "40 40 40", "30 50 210", "240 0 0" }
-}
-
--- defines pressed button image
-img_press = iup.image {
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,4,4,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,4,4,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
- {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
- colors = { "40 40 40", "215 215 215", "0 20 180", "210 0 0" }
-}
-
--- defines deactivated button image
-img_inactive = iup.image {
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2},
- {1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2},
- {1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
- {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
- colors = { "215 215 215", "40 40 40", "100 100 100", "200 200 200" }
-}
-
--- creates a text box
-text = iup.text{ readonly = "YES", SIZE = "EIGHTH" }
-
--- creates a button with image
-btn_image = iup.button{ title = "Button with image", image = img_release, impress = img_press, iminactive = img_inactive }
-
--- creates a button
-btn_big = iup.button{ title = "Big useless button", size = "EIGHTHxEIGHTH" }
-
--- creates a button entitled Exit
-btn_exit = iup.button{ title = "Exit" }
-
--- creates a button entitled Activate
-btn_on_off = iup.button{ title = "Activate" }
-
--- creates a dialog and sets dialog's title and turns off resize, menubox, maximize and minimize
-dlg = iup.dialog{ iup.vbox{ iup.hbox{ iup.fill{}, btn_image, btn_on_off, btn_exit, iup.fill{} }, text, btn_big }; title = "IupButton", resize = "NO", menubox = "NO", maxbox = "NO", minbox = "NO" }
-
--- callback called when activate button is activated
-function btn_on_off:action()
- if btn_image.active == "YES" then
- btn_image.active = "NO"
- else
- btn_image.active = "YES"
- end
-
- return iup.DEFAULT
-end
-
--- callback called when the button is pressed or released
-function btn_image:button( b, e )
- if( b == iup.BUTTON1 ) then
- if( e == 1 ) then
- -- botão pressionado
- text.value = "Red button pressed"
- else
- -- botão solto
- text.value = "Red button released"
- end
- end
- return iup.DEFAULT
-end
-
--- callback called when the exit button is activated
-function btn_exit:action()
- dlg:hide()
-end
-
--- shows dialog
-dlg:showxy( iup.CENTER, iup.CENTER)--IupCanvas Example in IupLua
-
-cv = iup.canvas {size="300x100", xmin=0, xmax=99, posx=0, dx=10}
-dg = iup.dialog{iup.frame{cv}; title="IupCanvas"}
-
-function cv:motion_cb(x, y, r)
- print(x, y, r)
- return iup.DEFAULT
-end
-
-dg:showxy(iup.CENTER, iup.CENTER)
---IupDialog Example in IupLua
---Creates a simple dialog.
-
-vbox = iup.vbox { iup.label {title="Label"}, iup.button { title="Test" } }
-dlg = iup.dialog{vbox; title="Dialog"}
-dlg:show()
-
-tecgraf = iup.image{
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 02, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 04, 05, 05, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 11, 05, 05, 05, 05, 12, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 10, 06, 05, 03, 05, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 05, 01, 01, 03, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 05, 01, 01, 03, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 02, 09, 09, 01, 01, 03, 07, 06, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 06, 01, 01, 01, 01, 02, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 06, 01, 01, 01, 01, 04, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 07, 06, 01, 01, 01, 01, 04, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 11, 02, 07, 05, 04, 04, 04, 04, 04, 04, 11, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 07, 04, 04, 04, 06, 03, 03, 07, 05, 05, 07, 07, 04, 04, 04, 04, 10, 10, 10, 10, 10, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 04, 04, 04, 09, 09, 06, 05, 04, 08, 07, 05, 01, 01, 01, 01, 07, 05, 06, 03, 03, 03, 03, 04, 10, 07, 09, 01, 01, },
- { 01, 01, 01, 04, 04, 06, 06, 08, 01, 01, 01, 01, 01, 10, 05, 01, 01, 01, 01, 10, 06, 01, 01, 01, 01, 01, 03, 03, 07, 07, 07, 01, },
- { 01, 01, 02, 04, 04, 05, 01, 01, 01, 01, 01, 01, 01, 04, 05, 01, 01, 01, 01, 07, 09, 01, 01, 01, 01, 01, 01, 01, 07, 07, 05, 01, },
- { 01, 01, 01, 03, 04, 04, 04, 01, 01, 01, 01, 01, 01, 04, 05, 01, 01, 01, 01, 07, 06, 01, 01, 01, 01, 01, 07, 07, 07, 09, 07, 01, },
- { 01, 01, 01, 01, 03, 03, 03, 04, 10, 10, 10, 11, 01, 04, 05, 01, 01, 01, 01, 05, 06, 15, 05, 07, 07, 07, 09, 06, 05, 05, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 03, 03, 03, 03, 03, 02, 04, 07, 05, 05, 05, 05, 06, 09, 14, 14, 06, 05, 05, 05, 07, 12, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 06, 03, 03, 02, 02, 02, 04, 04, 02, 02, 10, 16, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 02, 05, 01, 01, 01, 01, 06, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 02, 05, 01, 01, 01, 01, 06, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 02, 05, 01, 01, 01, 01, 06, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 03, 07, 09, 01, 01, 04, 09, 05, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 12, 03, 05, 01, 01, 05, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 03, 05, 01, 01, 07, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 03, 05, 05, 04, 07, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 09, 03, 05, 07, 07, 13, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 03, 07, 07, 07, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 03, 04, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, },
- { 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01 };
- colors = {
- "BGCOLOR",
- "079 086 099",
- "040 045 053",
- "104 113 129",
- "136 147 170",
- "155 164 179",
- "121 136 167",
- "239 239 243",
- "176 190 214",
- "127 133 143",
- "207 209 214",
- "247 255 255",
- "244 247 249",
- "212 217 225",
- "215 226 241",
- "231 237 245"
- },
-}
-
-dg = iup.dialog{iup.label{title="Tray example"}; title="Tray",
- tray = "YES", traytip = "This is a tip at tray", trayimage = tecgraf}
-dg:show()
-
-dg.hidetaskbar = "YES"
-
-dg.trayclick_cb = function(self, b, press, dclick)
- if b == 1 and press then
- item_show = iup.item {title = "Show", action = function() dg:show() end}
- item_exit = iup.item {title = "Exit", action = function() dg.tray = "NO" dg:hide() end}
- menu = iup.menu{item_show, item_exit}
- menu:popup(iup.MOUSEPOS, iup.MOUSEPOS)
- end
- return iup.DEFAULT
-end
--- IupFill Example in IupLua
--- Uses the Fill element to horizontally centralize a button and to
--- justify it to the left and right.
-
--- Creates frame with left aligned button
-frame_left = iup.frame
-{
- iup.hbox
- {
- iup.button{ title = "Ok" },
- iup.fill{},
- }; title = "Left aligned" -- Sets frame's title
-}
-
--- Creates frame with centered button
-frame_center = iup.frame
-{
- iup.hbox
- {
- iup.fill{},
- iup.button{ title = "Ok" },
- iup.fill{},
- } ; title = "Centered" -- Sets frame's title
-}
-
--- Creates frame with right aligned button
-frame_right = iup.frame
-{
- iup.hbox
- {
- iup.fill {},
- iup.button { title = "Ok" },
-
- } ; title = "Right aligned" -- Sets frame's title
-}
-
--- Creates dialog with these three frames
-dialog = iup.dialog
-{
- iup.vbox{frame_left, frame_center, frame_right,};
- size = 120, title = "IupFill"
-}
-
--- Shows dialog in the center of the screen
-dialog:showxy(iup.CENTER, iup.CENTER)-- IupFrame Example in IupLua
--- Draws a frame around a button. Note that FGCOLOR is added to the frame but
--- it is inherited by the button.
-
--- Creates frame with a label
-frame = iup.frame
- {
- iup.hbox
- {
- iup.fill{},
- iup.label{title="IupFrame Test"},
- iup.fill{},
- NULL
- }
- } ;
-
--- Sets label's attributes
-frame.fgcolor = "255 0 0"
-frame.size = EIGHTHxEIGHTH
-frame.title = "This is the frame"
-frame.margin = "10x10"
-
--- Creates dialog
-dialog = iup.dialog{frame};
-
--- Sets dialog's title
-dialog.title = "IupFrame"
-
-dialog:showxy(iup.CENTER,iup.CENTER) -- Shows dialog in the center of the screen -- IupHbox Example in IupLua
--- Creates a dialog with buttons placed side by side, with the purpose
--- of showing the organization possibilities of elements inside an hbox.
--- The ALIGNMENT attribute is explored in all its possibilities to obtain
--- the given effect.
-
-fr1 = iup.frame
-{
- iup.hbox
- {
- iup.fill{},
- iup.button{title="1", size="30x30"},
- iup.button{title="2", size="30x40"},
- iup.button{title="3", size="30x50"},
- iup.fill{};
- alignment = "ATOP"
- };
- title = "Alignment = ATOP"
-}
-
-fr2 = iup.frame
-{
- iup.hbox
- {
- iup.fill{},
- iup.button{title="1", size="30x30", action=""},
- iup.button{title="2", size="30x40", action=""},
- iup.button{title="3", size="30x50", action=""},
- iup.fill{};
- alignment = "ACENTER"
- };
- title = "Alignment = ACENTER"
-}
-
-fr3 = iup.frame
-{
- iup.hbox
- {
- iup.fill{},
- iup.button{title="1", size="30x30", action=""},
- iup.button{title="2", size="30x40", action=""},
- iup.button{title="3", size="30x50", action=""},
- iup.fill{};
- alignment = "ABOTTOM"
- };
- title = "Alignment = ABOTTOM"
-}
-
-dlg = iup.dialog
-{
- iup.frame
- {
- iup.vbox
- {
- fr1,
- fr2,
- fr3
- }; title="HBOX",
- };
- title="Alignment",
- size=140
-}
-
-dlg:show()-- IupImage Example in IupLua
--- Creates a button, a label, a toggle and a radio using an image.
--- Uses an image for the cursor as well.
-
--- Defines an "X" image
-img_x = iup.image{
- { 1,2,3,3,3,3,3,3,3,2,1 },
- { 2,1,2,3,3,3,3,3,2,1,2 },
- { 3,2,1,2,3,3,3,2,1,2,3 },
- { 3,3,2,1,2,3,2,1,2,3,3 },
- { 3,3,3,2,1,2,1,2,3,3,3 },
- { 3,3,3,3,2,1,2,3,3,3,3 },
- { 3,3,3,2,1,2,1,2,3,3,3 },
- { 3,3,2,1,2,3,2,1,2,3,3 },
- { 3,2,1,2,3,3,3,2,1,2,3 },
- { 2,1,2,3,3,3,3,3,2,1,2 },
- { 1,2,3,3,3,3,3,3,3,2,1 }
- -- Sets "X" image colors
- ; colors = { "0 1 0", "255 0 0", "255 255 0" }
-}
-
--- Defines a cursor image
-img_cursor = iup.image{
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,2,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
- -- Sets cursor image colors
- ; colors = { "255 0 0", "128 0 0" }, hotspot = "21:10"
-}
-
--- Creates a button entitled "Dummy" and associates image img_x to it
-btn = iup.button{ title = "", image = img_x }
-
--- Creates a label entitled "Dummy" and associates image img_x to it
-lbl = iup.label{ title = "", image = img_x }
-
--- Creates toggle entitled "Dummy" and associates image img_x to it
-tgl = iup.toggle{ title = "", image = img_x }
-
--- Creates two toggles entitled "Dummy" and associates image img_x to them
-tgl_radio_1 = iup.toggle{ title = "", image = img_x }
-tgl_radio_2 = iup.toggle{ title = "", image = img_x }
-
--- Creates label showing image size
-lbl_size = iup.label{ title = '"X" image width = '..img_x.width..'; "X" image height = '..img_x.height }
-
--- Creates frames around the elements
-frm_btn = iup.frame{btn; title="button", size="EIGHTHxEIGHTH"}
-frm_lbl = iup.frame{lbl; title="label" , size="EIGHTHxEIGHTH"}
-frm_tgl = iup.frame{tgl; title="toggle", size="EIGHTHxEIGHTH"}
-
-frm_tgl_radio = iup.frame{
- iup.radio{
- iup.vbox
- {
- tgl_radio_1,
- tgl_radio_2
- }
- };
- title="radio", size="EIGHTHxEIGHTH"
- }
-
--- Creates dialog dlg with an hbox containing a button, a label, and a toggle
-dlg = iup.dialog
- {
- iup.vbox
- {
- iup.hbox{frm_btn, frm_lbl, frm_tgl, frm_tgl_radio},
- iup.fill{},
- iup.hbox{iup.fill{}, lbl_size, iup.fill{}}
- }; title = "IupImage Example", size = "HALFxQUARTER",
- cursor = img_cursor
- }
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER, iup.CENTER)
-text = iup.text {value = "This is an empty text"}
-
-item_save = iup.item {title = "Save\tCtrl+S", key = "K_cS", active = "NO"}
-item_autosave = iup.item {title = "Auto Save", key = "K_a", value = "ON"}
-item_exit = iup.item {title = "Exit", key = "K_x"}
-
-menu_file = iup.menu {item_save, item_autosave, item_exit}
-
-submenu_file = iup.submenu{menu_file; title = "File"}
-
-menu = iup.menu {submenu_file}
-
-dlg = iup.dialog{text; title ="IupItem", menu = menu}
-
-dlg:showxy(iup.CENTER, iup.CENTER)
-
-function item_autosave:action()
- if item_autosave.value == "ON" then
- iup.Message("Auto Save", "OFF")
- item_autosave.value = "OFF"
- else
- iup.Message("Auto Save", "ON")
- item_autosave.value = "ON"
- end
-
- return iup.DEFAULT
-end
-
-function item_exit:action()
--- return iup.CLOSE
- dlg:hide()
-end
--- IupLabel Example in IupLua
--- Creates three labels, one using all attributes except for image, other
--- with normal text and the last one with an image..
-
--- Defines a star image
-img_star = iup.image {
- { 1,1,1,1,1,1,2,1,1,1,1,1,1 },
- { 1,1,1,1,1,1,2,1,1,1,1,1,1 },
- { 1,1,1,1,1,2,2,2,1,1,1,1,1 },
- { 1,1,1,1,1,2,2,2,1,1,1,1,1 },
- { 1,1,2,2,2,2,2,2,2,2,2,1,1 },
- { 2,2,2,2,2,2,2,2,2,2,2,2,2 },
- { 1,1,1,2,2,2,2,2,2,2,1,1,1 },
- { 1,1,1,1,2,2,2,2,2,1,1,1,1 },
- { 1,1,1,1,2,2,2,2,2,1,1,1,1 },
- { 1,1,1,2,2,1,1,2,2,2,1,1,1 },
- { 1,1,2,2,1,1,1,1,1,2,2,1,1 },
- { 1,2,2,1,1,1,1,1,1,1,2,2,1 },
- { 2,2,1,1,1,1,1,1,1,1,1,2,2 }
- -- Sets star image colors
- ; colors = { "0 0 0", "0 198 0" }
-}
-
--- Creates a label and sets all the attributes of label lbl, except for image
-lbl = iup.label { title = "This label has the following attributes set:\nBGCOLOR = 255 255 0\nFGCOLOR = 0 0 255\nFONT = COURIER_NORMAL_14\nSIZE = HALFxQUARTER\nTITLE = All text contained here\nALIGNMENT = ACENTER\n", bgcolor = "255 255 0", fgcolor = "0 0 255", font = "COURIER_NORMAL_14", size = "HALFxQUARTER", alignment = "ACENTER" }
-
--- Creates a label to explain that the label on the right has an image
-lbl_explain = iup.label { title = "The label on the right has the image of a star" }
-
--- Creates a label whose title is not important, cause it will have an image
-lbl_star = iup.label { title = "Does not matter", image = img_star }
-
--- Creates dialog with these three labels
-dlg = iup.dialog { iup.vbox { lbl, iup.hbox { lbl_explain, lbl_star } }
- ; title = "IupLabel Example" }
-
--- Shows dialog in the center of the screen
-dlg:showxy ( iup.CENTER, iup.CENTER )-- IupList Example in IupLua
--- Creates a dialog with three frames, each one containing a list. The first is a simple list, the second one is a multiple list and the last one is a drop-down list. The second list has a callback associated.
-
--- Creates a list and sets items, initial item and size
-list = iup.list {"Gold", "Silver", "Bronze", "None"
- ; value = 4, size = "EIGHTHxEIGHTH"}
-
--- Creates frame with simple list and sets its title
-frm_medal = iup.frame {list ; title = "Best medal"}
-
--- Creates a list and sets its items, multiple selection, initial items and size
-list_multiple = iup.list {"100m dash", "Long jump", "Javelin throw", "110m hurdlers", "Hammer throw", "High jump"
- ; multiple="YES", value="+--+--", size="EIGHTHxEIGHTH"}
-
--- Creates frame with multiple list and sets its title
-frm_sport = iup.frame {list_multiple
- ; title = "Competed in"}
-
--- Creates a list and sets its items, dropdown and amount of visible items
-list_dropdown = iup.list {"Less than US$ 1000", "US$ 2000", "US$ 5000", "US$ 10000", "US$ 20000", "US$ 50000", "More than US$ 100000"
- ; dropdown="YES", visible_items=5}
-
--- Creates frame with dropdown list and sets its title
-frm_prize = iup.frame {list_dropdown
- ; title = "Prizes won"}
-
--- Creates a dialog with the the frames with three lists and sets its title
-dlg = iup.dialog {iup.hbox {frm_medal, frm_sport, frm_prize}
- ; title = "IupList Example"}
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER, iup.CENTER)
-
-function list_multiple:action(t, i, v)
- if v == 0 then
- state = "deselected"
- else
- state = "selected"
- end
- iup.Message("Competed in", "Item "..i.." - "..t.." - "..state)
- return iup.DEFAULT
-end-- IupMenu Example in IupLua
--- Creates a dialog with a menu with two submenus.
-
--- Creates a text, sets its value and turns on text readonly mode
-text = iup.text {readonly = "YES", value = "Selecting show or hide will affect this text"}
-
--- Creates items, sets its shortcut keys and deactivates edit item
-item_show = iup.item {title = "Show", key = "K_S"}
-item_hide = iup.item {title = "Hide\tCtrl+H", key = "K_H"}
-item_edit = iup.item {title = "Edit", key = "K_E", active = "NO"}
-item_exit = iup.item {title = "Exit", key = "K_x"}
-
-function item_show:action()
- text.visible = "YES"
- return iup.DEFAULT
-end
-
-function item_hide:action()
- text.visible = "NO"
- return iup.DEFAULT
-end
-
-function item_exit:action()
- return iup.CLOSE
-end
-
--- Creates two menus
-menu_file = iup.menu {item_exit}
-menu_text = iup.menu {item_show, item_hide, item_edit}
-
--- Creates two submenus
-submenu_file = iup.submenu {menu_file; title = "File"}
-submenu_text = iup.submenu {menu_text; title = "Text"}
-
--- Creates main menu with two submenus
-menu = iup.menu {submenu_file, submenu_text}
-
--- Creates dialog with a text, sets its title and associates a menu to it
-dlg = iup.dialog{text; title="IupMenu Example", menu=menu}
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER,iup.CENTER)
-
-
-l = iup.list{dropdown="YES"}
-
-iup.SetAttribute(l, "1", "HELVETICA_NORMAL_8")
-iup.SetAttribute(l, "2", "COURIER_NORMAL_8")
-iup.SetAttribute(l, "3", "TIMES_NORMAL_8")
-iup.SetAttribute(l, "4", "HELVETICA_ITALIC_8")
-iup.SetAttribute(l, "5", "COURIER_ITALIC_8")
-iup.SetAttribute(l, "6", "TIMES_ITALIC_8")
-iup.SetAttribute(l, "7", "HELVETICA_BOLD_8")
-iup.SetAttribute(l, "8", "COURIER_BOLD_8")
-iup.SetAttribute(l, "9", "TIMES_BOLD_8")
-iup.SetAttribute(l, "10", "HELVETICA_NORMAL_10")
-iup.SetAttribute(l, "11", "COURIER_NORMAL_10")
-iup.SetAttribute(l, "12", "TIMES_NORMAL_10")
-iup.SetAttribute(l, "13", "HELVETICA_ITALIC_10")
-iup.SetAttribute(l, "14", "COURIER_ITALIC_10")
-iup.SetAttribute(l, "15", "TIMES_ITALIC_10")
-iup.SetAttribute(l, "16", "HELVETICA_BOLD_10")
-iup.SetAttribute(l, "17", "COURIER_BOLD_10")
-iup.SetAttribute(l, "18", "TIMES_BOLD_10")
-iup.SetAttribute(l, "19", "HELVETICA_NORMAL_12")
-iup.SetAttribute(l, "20", "COURIER_NORMAL_12")
-iup.SetAttribute(l, "21", "TIMES_NORMAL_12")
-iup.SetAttribute(l, "22", "HELVETICA_ITALIC_12")
-iup.SetAttribute(l, "23", "COURIER_ITALIC_12")
-iup.SetAttribute(l, "24", "TIMES_ITALIC_12")
-iup.SetAttribute(l, "25", "HELVETICA_BOLD_12")
-iup.SetAttribute(l, "26", "COURIER_BOLD_12")
-iup.SetAttribute(l, "27", "TIMES_BOLD_12")
-iup.SetAttribute(l, "28", "HELVETICA_NORMAL_14")
-iup.SetAttribute(l, "29", "COURIER_NORMAL_14")
-iup.SetAttribute(l, "30", "TIMES_NORMAL_14")
-iup.SetAttribute(l, "31", "HELVETICA_ITALIC_14")
-iup.SetAttribute(l, "32", "COURIER_ITALIC_14")
-iup.SetAttribute(l, "33", "TIMES_ITALIC_14")
-iup.SetAttribute(l, "34", "HELVETICA_BOLD_14")
-iup.SetAttribute(l, "35", "COURIER_BOLD_14")
-iup.SetAttribute(l, "36", "TIMES_BOLD_14")
-
-dg = iup.dialog{l}
-dg.title = "title"
-
-dg2 = nil
-
-l.action = function(self, t, i ,v)
-
- if dg2 then
- iup.Hide(dg2)
- end
-
- if v == 1 then
- ml = iup.multiline{}
- ml.size = "200x200"
- ml.value = "1234\nmmmmm\niiiii"
-
- ml.font = t
-
- dg2 = iup.dialog{ml}
- dg2.title = t
- dg2:show()
- iup.SetFocus(l)
- end
-end
-
-dg:show()
--- IupMultiline Simple Example in IupLua
--- Shows a multiline that ignores the treatment of the DEL key, canceling its effect.
-
-ml = iup.multiline{expand="YES", value="I ignore the DEL key!", border="YES"}
-
-ml.action = function(self, c, after)
- if c == iup.K_DEL then
- return iup.IGNORE
- else
- return iup.DEFAULT;
- end
-end
-
-dlg = iup.dialog{ml; title="IupMultiline", size="QUARTERxQUARTER"}
-dlg:show()-- IupRadio Example in IupLua
--- Creates a dialog for the user to select his/her gender.
--- In this case, the radio element is essential to prevent the user from
--- selecting both options.
-
-male = iup.toggle{title="Male"}
-female = iup.toggle{title="Female"}
-exclusive = iup.radio
-{
- iup.vbox
- {
- male,
- female
- };
- value=female,
- tip="Two state button - Exclusive - RADIO"
-}
-
-frame = iup.frame{exclusive; title="Gender"}
-
-dialog = iup.dialog
-{
- iup.hbox
- {
- iup.fill{},
- frame,
- iup.fill{}
- };
- title="IupRadio",
- size=140,
- resize="NO",
- minbox="NO",
- maxbox="NO"
-}
-
-dialog:show()-- IupSeparator Example in IupLua
--- Creates a dialog with a menu and some items.
--- A IupSeparator was used to separate the menu items.
-
--- Creates a text, sets its value and turns on text readonly mode
-text = iup.text {value = "This text is here only to compose", expand = "YES"}
-
--- Creates six items
-item_new = iup.item {title = "New"}
-item_open = iup.item {title = "Open"}
-item_close = iup.item {title = "Close"}
-item_pagesetup = iup.item {title = "Page Setup"}
-item_print = iup.item {title = "Print"}
-item_exit = iup.item {title = "Exit", action="return iup.CLOSE"}
-
--- Creates file menus
-menu_file = iup.menu {item_new, item_open, item_close, iup.separator{}, item_pagesetup, item_print, iup.separator{}, item_exit }
-
--- Creates file submenus
-submenu_file = iup.submenu {menu_file; title="File"}
-
--- Creates main menu with file submenu
-menu = iup.menu {submenu_file}
-
--- Creates dialog with a text, sets its title and associates a menu to it
-dlg = iup.dialog {text
- ; title ="IupSeparator Example", menu = menu, size = "QUARTERxEIGHTH"}
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER,iup.CENTER)-- IupSubmenu Example in IupLua
--- Creates a dialog with a menu with three submenus. One of the submenus has a submenu, which has another submenu.
-
--- Creates a text, sets its value and turns on text readonly mode
-text = iup.text {value = "This text is here only to compose", expand = "YES"}
-
--- Creates items of menu file
-item_new = iup.item {title = "New"}
-item_open = iup.item {title = "Open"}
-item_close = iup.item {title = "Close"}
-item_exit = iup.item {title = "Exit"}
-
--- Creates items of menu edit
-item_copy = iup.item {title = "Copy"}
-item_paste = iup.item {title = "Paste"}
-
--- Creates items for menu triangle
-item_equilateral = iup.item {title = "Equilateral"}
-item_isoceles = iup.item {title = "Isoceles"}
-item_scalenus = iup.item {title = "Scalenus"}
-
--- Creates menu triangle
-menu_triangle = iup.menu {item_equilateral, item_isoceles, item_scalenus}
-
--- Creates submenu triangle
-submenu_triangle = iup.submenu {menu_triangle; title = "Triangle"}
-
--- Creates items of menu create
-item_line = iup.item {title = "Line"}
-item_circle = iup.item {title = "Circle"}
-
--- Creates menu create
-menu_create = iup.menu {item_line, item_circle, submenu_triangle}
-
--- Creates submenu create
-submenu_create = iup.submenu {menu_create; title = "Create"}
-
--- Creates items of menu help
-item_help = iup.item {title = "Help"}
-
--- Creates menus of the main menu
-menu_file = iup.menu {item_new, item_open, item_close, iup.separator{}, item_exit }
-menu_edit = iup.menu {item_copy, item_paste, iup.separator{}, submenu_create}
-menu_help = iup.menu {item_help}
-
--- Creates submenus of the main menu
-submenu_file = iup.submenu {menu_file; title = "File"}
-submenu_edit = iup.submenu {menu_edit; title = "Edit"}
-submenu_help = iup.submenu {menu_help; title = "Help"}
-
--- Creates main menu with file submenu
-menu = iup.menu {submenu_file, submenu_edit, submenu_help}
-
--- Creates dialog with a text, sets its title and associates a menu to it
-dlg = iup.dialog {text
- ; title ="IupSubmenu Example", menu = menu, size = "QUARTERxEIGHTH"}
-
--- Shows dialog in the center of the screen
-dlg:showxy (iup.CENTER,iup.CENTER)
-
-function item_help:action ()
- iup.Message ("Warning", "Only Help and Exit items performs an operation")
- return iup.DEFAULT
-end
-
-function item_exit:action ()
- return iup.CLOSE
-end-- IupText Example in IupLua
--- Allows the user to execute a Lua command
-
-text = iup.text{value = "Write a text; press Ctrl-Q to exit"}
-
-function text:action(c)
- if c == iup.K_cQ then
- return iup.CLOSE
- end
- return iup.DEFAULT
-end
-
-dlg = iup.dialog{text; title="IupText"}
-
-dlg:showxy(iup.CENTER, iup.CENTER)
-iup.SetFocus(text)
--- IupTimer Example in Lua
-
-timer1 = iup.timer{time=100}
-timer2 = iup.timer{time=2000}
-
-function timer1:action_cb()
- print("timer 1 called")
- return iup.DEFAULT
-end
-
-function timer2:action_cb()
- print("timer 2 called")
- return iup.CLOSE
-end
-
--- can only be set after the time is created
-timer1.run = "YES"
-timer2.run = "YES"
-
-dg = iup.dialog{iup.label{title="Timer example"}}
-dg:show()
--- IupToggle Example in IupLua
--- Creates 9 toggles:
--- the first one has an image and an associated callback;
--- the second has an image and is deactivated;
--- the third is regular;
--- the fourth has its foreground color changed;
--- the fifth has its background color changed;
--- the sixth has its foreground and background colors changed;
--- the seventh is deactivated;
--- the eight has its font changed;
--- the ninth has its size changed.
-
-img1 = iup.image{
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
- colors = {"255 255 255", "0 192 0"}
-}
-
-img2 = iup.image{
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,1},
- {1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
- colors = {"255 255 255", "0 192 0"}
-}
-
-toggle1 = iup.toggle{title = "", image = img1}
-toggle2 = iup.toggle{title = "deactivated toggle with image", image = img2, active="NO"}
-toggle3 = iup.toggle{title = "regular toggle"}
-toggle4 = iup.toggle{title = "toggle with blue foreground color", fgcolor = BLUE }
-toggle5 = iup.toggle{title = "toggle with red background color", bgcolor = RED }
-toggle6 = iup.toggle{title = "toggle with black backgrounf color and green foreground color", fgcolor = GREEN, bgcolor = BLACK }
-toggle7 = iup.toggle{title = "deactivated toggle", active = "NO" }
-toggle8 = iup.toggle{title = "toggle with Courier 14 Bold font", font = "COURIER_BOLD_14" }
-toggle9 = iup.toggle{title = "toggle with size EIGHTxEIGHT", size = "EIGHTHxEIGHTH" }
-
-function toggle1:action(v)
- if v == 1 then estado = "pressed" else estado = "released" end
- iup.Message("Toggle 1",estado)
-end
-
-box = iup.vbox{
- toggle1,
- toggle2,
- toggle3,
- toggle4,
- toggle5,
- toggle6,
- toggle7,
- toggle8,
- toggle9
- }
-
-toggles = iup.radio{box; expand="YES"}
-dlg = iup.dialog{toggles; title = "IupToggle", margin="5x5", gap="5", resize="NO"}
-dlg:showxy(iup.CENTER, iup.CENTER)-- IupVbox Example in IupLua
--- Creates a dialog with buttons placed one above the other, showing
--- the organization possibilities of the elements inside a vbox.
--- The ALIGNMENT attribute is explored in all its possibilities to obtain
--- the effects. The attributes GAP, MARGIN and SIZE are also tested.
-
--- Creates frame 1
-frm_1 = iup.frame
-{
- iup.hbox
- {
- iup.fill {},
- iup.vbox
- {
- iup.button {title = "1", size = "20x30", action = ""},
- iup.button {title = "2", size = "30x30", action = ""},
- iup.button {title = "3", size = "40x30", action = ""} ;
- -- Sets alignment and gap of vbox
- alignment = "ALEFT", gap = 10
- },
- iup.fill {}
- } ;
- -- Sets title of frame 1
- title = "ALIGNMENT = ALEFT, GAP = 10"
-}
-
--- Creates frame 2
-frm_2 = iup.frame
-{
- iup.hbox
- {
- iup.fill {},
- iup.vbox
- {
- iup.button {title = "1", size = "20x30", action = ""},
- iup.button {title = "2", size = "30x30", action = ""},
- iup.button {title = "3", size = "40x30", action = ""} ;
- -- Sets alignment and margin of vbox
- alignment = "ACENTER",
- },
- iup.fill {}
- } ;
- -- Sets title of frame 1
- title = "ALIGNMENT = ACENTER"
-}
-
--- Creates frame 3
-frm_3 = iup.frame
-{
- iup.hbox
- {
- iup.fill {},
- iup.vbox
- {
- iup.button {title = "1", size = "20x30", action = ""},
- iup.button {title = "2", size = "30x30", action = ""},
- iup.button {title = "3", size = "40x30", action = ""} ;
- -- Sets alignment and size of vbox
- alignment = "ARIGHT"
- },
- iup.fill {}
- } ;
- -- Sets title of frame 3
- title = "ALIGNMENT = ARIGHT"
-}
-
-dlg = iup.dialog
-{
- iup.vbox
- {
- frm_1,
- frm_2,
- frm_3
- } ;
- title = "IupVbox Example", size = "QUARTER"
-}
-
--- Shows dialog in the center of the screen
-dlg:showxy (iup.CENTER, iup.CENTER)-- IupZbox Example in IupLua
--- An application of a zbox could be a program requesting several entries from the user according to a previous selection. In this example, a list of possible layouts ,each one consisting of an element, is presented, and according to the selected option the dialog below the list is changed.
-
-fill = iup.fill {}
-text = iup.text {value = "Enter your text here", expand = "YES"}
-lbl = iup.label {title = "This element is a label"}
-btn = iup.button {title = "This button does nothing"}
-zbox = iup.zbox
-{
- fill,
- text,
- lbl,
- btn ;
- alignment = "ACENTER", value=text
-}
-
-list = iup.list { "fill", "text", "lbl", "btn"; value="2"}
-ilist = {fill, text, lbl, btn}
-
-function list:action (t, o, selected)
- if selected == 1 then
- -- Sets the value of the zbox to the selected element
- zbox.value=ilist[o]
- end
-
- return iup.DEFAULT
-end
-
-frm = iup.frame
-{
- iup.hbox
- {
- iup.fill{},
- list,
- iup.fill{}
- } ;
- title = "Select an element"
-}
-
-dlg = iup.dialog
-{
- iup.vbox
- {
- frm,
- zbox
- } ;
- size = "QUARTER",
- title = "IupZbox Example"
-}
-
-dlg:showxy (0, 0)
---[[
-JSON4Lua example script.
-Demonstrates the simple functionality of the json module.
-]]--
-json = require('json')
-
-
--- Object to JSON encode
-test = {
- one='first',two='second',three={2,3,5}
-}
-
-jsonTest = json.encode(test)
-
-print('JSON encoded test is: ' .. jsonTest)
-
--- Now JSON decode the json string
-result = json.decode(jsonTest)
-
-print ("The decoded table result:")
-table.foreach(result,print)
-print ("The decoded table result.three")
-table.foreach(result.three, print)
---
--- jsonrpc.lua
--- Installed in a CGILua webserver environment (with necessary CGI Lua 5.0 patch)
---
-require ('json.rpcserver')
-
--- The Lua class that is to serve JSON RPC requests
-local myServer = {
- echo = function (msg) return msg end,
- average = function(...)
- local total=0
- local count=0
- for i=1, table.getn(arg) do
- total = total + arg[i]
- count = count + 1
- end
- return { average= total/count, sum = total, n=count }
- end
-}
-
-json.rpcserver.serve(myServer)--[[
-Some basic tests for JSON4Lua.
-]]--
-
---- Compares two tables for being data-identical.
-function compareData(a,b)
- if (type(a)=='string' or type(a)=='number' or type(a)=='boolean' or type(a)=='nil') then return a==b end
- -- After basic data types, we're only interested in tables
- if (type(a)~='table') then return true end
- -- Check that a has everything b has
- for k,v in pairs(b) do
- if (not compareData( a[k], v ) ) then return false end
- end
- for k,v in pairs(a) do
- if (not compareData( v, b[k] ) ) then return false end
- end
- return true
-end
-
----
--- Checks that our compareData function works properly
-function testCompareData()
- s = "name"
- r = "name"
- assert(compareData(s,r))
- assert(not compareData('fred',s))
- assert(not compareData(nil, s))
- assert(not compareData("123",123))
- assert(not compareData(false, nil))
- assert(compareData(true, true))
- assert(compareData({1,2,3},{1,2,3}))
- assert(compareData({'one',2,'three'},{'one',2,'three'}))
- assert(not compareData({'one',2,4},{4,2,'one'}))
- assert(compareData({one='ichi',two='nichi',three='san'}, {three='san',two='nichi',one='ichi'}))
- s = { one={1,2,3}, two={one='hitotsu',two='futatsu',three='mitsu'} }
- assert(compareData(s,s))
- t = { one={1,2,3}, two={one='een',two='twee',three='drie'} }
- assert(not compareData(s,t))
-end
-
-testCompareData()
-
---
---
--- Performs some perfunctory tests on JSON module
-function testJSON4Lua()
- json = require('json')
-
- if nil then
- -- Test encodeString
- s = [["\"
-]]
- r = json._encodeString(s)
- assert(r=='\\"\\\\\\"\\n')
- s = [["""\\\"]]
- r = json._encodeString(s)
- assert(r==[[\"\"\"\\\\\\\"]])
-
- end
-
- -- Test encode for basic strings (complicated strings)
- s = [[Hello, Lua!]]
- r = json.encode(s)
- assert(r=='"Hello, Lua!"')
- s = [["\"
-]]
- r = json.encode(s)
- assert(r=='\"\\"\\\\\\"\\n\"')
- s = [["""\\\"]]
- r = json.encode(s)
- assert(r==[["\"\"\"\\\\\\\""]])
-
- -- Test encode for numeric values
- s = 23
- r = json.encode(s)
- assert(r=='23')
- s=48.123
- r = json.encode(s)
- assert(r=='48.123')
-
- -- Test encode for boolean values
- assert(json.encode(true)=='true')
- assert(json.encode(false)=='false')
- assert(json.encode(nil)=='null')
-
- -- Test encode for arrays
- s = {1,2,3}
- r = json.encode(s)
- assert(r=="[1,2,3]")
- s = {9,9,9}
- r = json.encode(s)
- assert(r=="[9,9,9]")
-
- -- Complex array test
- s = { 2, 'joe', false, nil, 'hi' }
- r = json.encode(s)
- assert(r=='[2,"joe",false,null,"hi"]')
-
- -- Test encode for tables
- s = {Name='Craig',email='craig@lateral.co.za',age=35}
- r = json.encode(s)
- -- NB: This test can fail because of order: need to test further once
- -- decoding is supported.
- assert(r==[[{"age":35,"Name":"Craig","email":"craig@lateral.co.za"}]])
-
- -- Test decode_scanWhitespace
- if nil then
- s = " \n \r \t "
- e = json._decode_scanWhitespace(s,1)
- assert(e==string.len(s)+1)
- s = " \n\r\t4"
- assert(json._decode_scanWhitespace(s,1)==5)
-
- -- Test decode_scanString
- s = [["Test"]]
- r,e = json._decode_scanString(s,1)
- assert(r=='Test' and e==7)
- s = [["This\nis a \"test"]]
- r = json._decode_scanString(s,1)
- assert(r=="This\nis a \"test")
-
- -- Test decode_scanNumber
- s = [[354]]
- r,e = json._decode_scanNumber(s,1)
- assert(r==354 and e==4)
- s = [[ 4565.23 AND OTHER THINGS ]]
- r,e = json._decode_scanNumber(s,2)
- assert(r==4565.23 and e==9)
- s = [[ -23.22 and ]]
- r,e = json._decode_scanNumber(s,2)
- assert(r==-23.22 and e==8)
-
- -- Test decode_scanConstant
- s = "true"
- r,e = json._decode_scanConstant(s,1)
- assert(r==true and e==5)
- s = " false "
- r,e = json._decode_scanConstant(s,3)
- assert(r==false and e==8)
- s = "1null6"
- r,e = json._decode_scanConstant(s,2)
- assert(r==nil and e==6)
-
- -- Test decode_scanArray
- s = "[1,2,3]"
- r,e = json._decode_scanArray(s,1)
- assert(compareData(r,{1,2,3}))
- s = [[[ 1 , 3 ,5 , "Fred" , true, false, null, -23 ] ]]
- r,e = json._decode_scanArray(s,1)
- assert(compareData(r, {1,3,5,'Fred',true,false,nil,-23} ) )
- s = "[3,5,null,7,9]"
- r,e = json._decode_scanArray(s,1)
- assert(compareData(r, {3,5,nil,7,9}))
- s = "[3,5,null,7,9,null,null]"
- r,e = json._decode_scanArray(s,1)
- assert(compareData(r, {3,5,nil,7,9,nil,nil}))
-
- end
-
- -- Test decode_scanObject
- s = [[ {"one":1, "two":2, "three":"three", "four":true} ]]
- r,e = json.decode(s)
- assert(compareData(r,{one=1,two=2,three='three',four=true}))
- s = [[ { "one" : { "first":1,"second":2,"third":3}, "two":2, "three":false } ]]
- r,e = json.decode(s)
- assert(compareData(r, {one={first=1,second=2,third=3},two=2,three=false}))
- s = [[ { "primes" : [2,3,5,7,9], "user":{"name":"craig","age":35,"programs_lua":true},
- "lua_is_great":true } ]]
- r,e = json.decode(s)
- assert(compareData(r, {primes={2,3,5,7,9},user={name='craig',age=35,programs_lua=true},lua_is_great=true}))
-
- -- Test json.null management
- t = { 1,2,json.null,4 }
- assert( json.encode(t)=="[1,2,null,4]" )
- t = {x=json.null }
- r = json.encode(t)
- assert( json.encode(t) == '{"x":null}' )
-
- -- Test comment decoding
- s = [[ /* A comment
- that spans
- a few lines
- */
- "test"
- ]]
- r,e = json.decode(s)
- assert(r=='test',"Comment decoding failed")
-end
-
-testJSON4Lua()
-
-print("JSON4Lua tests completed successfully")--[[
- Some Time Trails for the JSON4Lua package
-]]--
-
-
-require('json')
-require('os')
-require('table')
-
-local t1 = os.clock()
-local jstr
-local v
-for i=1,100 do
- local t = {}
- for j=1,500 do
- table.insert(t,j)
- end
- for j=1,500 do
- table.insert(t,"VALUE")
- end
- jstr = json.encode(t)
- v = json.decode(jstr)
- --print(json.encode(t))
-end
-
-for i = 1,100 do
- local t = {}
- for j=1,500 do
- local m= math.mod(j,3)
- if (m==0) then
- t['a'..j] = true
- elseif m==1 then
- t['a'..j] = json.null
- else
- t['a'..j] = j
- end
- end
- jstr = json.encode(t)
- v = json.decode(jstr)
-end
-
-print (jstr)
---print(type(t1))
-local t2 = os.clock()
-
-print ("Elapsed time=" .. os.difftime(t2,t1) .. "s")-----------------------------------------------------------------------------
--- JSON4Lua: JSON encoding / decoding support for the Lua language.
--- json Module.
--- Author: Craig Mason-Jones
--- Homepage: http://json.luaforge.net/
--- Version: 0.9.20
--- This module is released under the The GNU General Public License (GPL).
--- Please see LICENCE.txt for details.
---
--- USAGE:
--- This module exposes two functions:
--- encode(o)
--- Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string.
--- decode(json_string)
--- Returns a Lua object populated with the data encoded in the JSON string json_string.
---
--- REQUIREMENTS:
--- compat-5.1 if using Lua 5.0
---
--- CHANGELOG
--- 0.9.20 Introduction of local Lua functions for private functions (removed _ function prefix).
--- Fixed Lua 5.1 compatibility issues.
--- Introduced json.null to have null values in associative arrays.
--- encode() performance improvement (more than 50%) through table.concat rather than ..
--- Introduced decode ability to ignore /**/ comments in the JSON string.
--- 0.9.10 Fix to array encoding / decoding to correctly manage nil/null values in arrays.
------------------------------------------------------------------------------
-
------------------------------------------------------------------------------
--- Imports and dependencies
------------------------------------------------------------------------------
-local math = require('math')
-local string = require("string")
-local table = require("table")
-
-local base = _G
-
------------------------------------------------------------------------------
--- Module declaration
------------------------------------------------------------------------------
-module("json")
-
--- Public functions
-
--- Private functions
-local decode_scanArray
-local decode_scanComment
-local decode_scanConstant
-local decode_scanNumber
-local decode_scanObject
-local decode_scanString
-local decode_scanWhitespace
-local encodeString
-local isArray
-local isEncodable
-
------------------------------------------------------------------------------
--- PUBLIC FUNCTIONS
------------------------------------------------------------------------------
---- Encodes an arbitrary Lua object / variable.
--- @param v The Lua object / variable to be JSON encoded.
--- @return String containing the JSON encoding in internal Lua string format (i.e. not unicode)
-function encode (v)
- -- Handle nil values
- if v==nil then
- return "null"
- end
-
- local vtype = base.type(v)
-
- -- Handle strings
- if vtype=='string' then
- return '"' .. encodeString(v) .. '"' -- Need to handle encoding in string
- end
-
- -- Handle booleans
- if vtype=='number' or vtype=='boolean' then
- return base.tostring(v)
- end
-
- -- Handle tables
- if vtype=='table' then
- local rval = {}
- -- Consider arrays separately
- local bArray, maxCount = isArray(v)
- if bArray then
- for i = 1,maxCount do
- table.insert(rval, encode(v[i]))
- end
- else -- An object, not an array
- for i,j in base.pairs(v) do
- if isEncodable(i) and isEncodable(j) then
- table.insert(rval, '"' .. encodeString(i) .. '":' .. encode(j))
- end
- end
- end
- if bArray then
- return '[' .. table.concat(rval,',') ..']'
- else
- return '{' .. table.concat(rval,',') .. '}'
- end
- end
-
- -- Handle null values
- if vtype=='function' and v==null then
- return 'null'
- end
-
- base.assert(false,'encode attempt to encode unsupported type ' .. vtype .. ':' .. base.tostring(v))
-end
-
-
---- Decodes a JSON string and returns the decoded value as a Lua data structure / value.
--- @param s The string to scan.
--- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1.
--- @param Lua object, number The object that was scanned, as a Lua table / string / number / boolean or nil,
--- and the position of the first character after
--- the scanned JSON object.
-function decode(s, startPos)
- startPos = startPos and startPos or 1
- startPos = decode_scanWhitespace(s,startPos)
- base.assert(startPos<=string.len(s), 'Unterminated JSON encoded object found at position in [' .. s .. ']')
- local curChar = string.sub(s,startPos,startPos)
- -- Object
- if curChar=='{' then
- return decode_scanObject(s,startPos)
- end
- -- Array
- if curChar=='[' then
- return decode_scanArray(s,startPos)
- end
- -- Number
- if string.find("+-0123456789.e", curChar, 1, true) then
- return decode_scanNumber(s,startPos)
- end
- -- String
- if curChar==[["]] or curChar==[[']] then
- return decode_scanString(s,startPos)
- end
- if string.sub(s,startPos,startPos+1)=='/*' then
- return decode(s, decode_scanComment(s,startPos))
- end
- -- Otherwise, it must be a constant
- return decode_scanConstant(s,startPos)
-end
-
---- The null function allows one to specify a null value in an associative array (which is otherwise
--- discarded if you set the value with 'nil' in Lua. Simply set t = { first=json.null }
-function null()
- return null -- so json.null() will also return null ;-)
-end
------------------------------------------------------------------------------
--- Internal, PRIVATE functions.
--- Following a Python-like convention, I have prefixed all these 'PRIVATE'
--- functions with an underscore.
------------------------------------------------------------------------------
-
---- Scans an array from JSON into a Lua object
--- startPos begins at the start of the array.
--- Returns the array and the next starting position
--- @param s The string being scanned.
--- @param startPos The starting position for the scan.
--- @return table, int The scanned array as a table, and the position of the next character to scan.
-function decode_scanArray(s,startPos)
- local array = {} -- The return value
- local stringLen = string.len(s)
- base.assert(string.sub(s,startPos,startPos)=='[','decode_scanArray called but array does not start at position ' .. startPos .. ' in string:\n'..s )
- startPos = startPos + 1
- -- Infinite loop for array elements
- repeat
- startPos = decode_scanWhitespace(s,startPos)
- base.assert(startPos<=stringLen,'JSON String ended unexpectedly scanning array.')
- local curChar = string.sub(s,startPos,startPos)
- if (curChar==']') then
- return array, startPos+1
- end
- if (curChar==',') then
- startPos = decode_scanWhitespace(s,startPos+1)
- end
- base.assert(startPos<=stringLen, 'JSON String ended unexpectedly scanning array.')
- object, startPos = decode(s,startPos)
- table.insert(array,object)
- until false
-end
-
---- Scans a comment and discards the comment.
--- Returns the position of the next character following the comment.
--- @param string s The JSON string to scan.
--- @param int startPos The starting position of the comment
-function decode_scanComment(s, startPos)
- base.assert( string.sub(s,startPos,startPos+1)=='/*', "decode_scanComment called but comment does not start at position " .. startPos)
- local endPos = string.find(s,'*/',startPos+2)
- base.assert(endPos~=nil, "Unterminated comment in string at " .. startPos)
- return endPos+2
-end
-
---- Scans for given constants: true, false or null
--- Returns the appropriate Lua type, and the position of the next character to read.
--- @param s The string being scanned.
--- @param startPos The position in the string at which to start scanning.
--- @return object, int The object (true, false or nil) and the position at which the next character should be
--- scanned.
-function decode_scanConstant(s, startPos)
- local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
- local constNames = {"true","false","null"}
-
- for i,k in base.pairs(constNames) do
- --print ("[" .. string.sub(s,startPos, startPos + string.len(k) -1) .."]", k)
- if string.sub(s,startPos, startPos + string.len(k) -1 )==k then
- return consts[k], startPos + string.len(k)
- end
- end
- base.assert(nil, 'Failed to scan constant from string ' .. s .. ' at starting position ' .. startPos)
-end
-
---- Scans a number from the JSON encoded string.
--- (in fact, also is able to scan numeric +- eqns, which is not
--- in the JSON spec.)
--- Returns the number, and the position of the next character
--- after the number.
--- @param s The string being scanned.
--- @param startPos The position at which to start scanning.
--- @return number, int The extracted number and the position of the next character to scan.
-function decode_scanNumber(s,startPos)
- local endPos = startPos+1
- local stringLen = string.len(s)
- local acceptableChars = "+-0123456789.e"
- while (string.find(acceptableChars, string.sub(s,endPos,endPos), 1, true)
- and endPos<=stringLen
- ) do
- endPos = endPos + 1
- end
- local stringValue = 'return ' .. string.sub(s,startPos, endPos-1)
- local stringEval = base.loadstring(stringValue)
- base.assert(stringEval, 'Failed to scan number [ ' .. stringValue .. '] in JSON string at position ' .. startPos .. ' : ' .. endPos)
- return stringEval(), endPos
-end
-
---- Scans a JSON object into a Lua object.
--- startPos begins at the start of the object.
--- Returns the object and the next starting position.
--- @param s The string being scanned.
--- @param startPos The starting position of the scan.
--- @return table, int The scanned object as a table and the position of the next character to scan.
-function decode_scanObject(s,startPos)
- local object = {}
- local stringLen = string.len(s)
- local key, value
- base.assert(string.sub(s,startPos,startPos)=='{','decode_scanObject called but object does not start at position ' .. startPos .. ' in string:\n' .. s)
- startPos = startPos + 1
- repeat
- startPos = decode_scanWhitespace(s,startPos)
- base.assert(startPos<=stringLen, 'JSON string ended unexpectedly while scanning object.')
- local curChar = string.sub(s,startPos,startPos)
- if (curChar=='}') then
- return object,startPos+1
- end
- if (curChar==',') then
- startPos = decode_scanWhitespace(s,startPos+1)
- end
- base.assert(startPos<=stringLen, 'JSON string ended unexpectedly scanning object.')
- -- Scan the key
- key, startPos = decode(s,startPos)
- base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
- startPos = decode_scanWhitespace(s,startPos)
- base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
- base.assert(string.sub(s,startPos,startPos)==':','JSON object key-value assignment mal-formed at ' .. startPos)
- startPos = decode_scanWhitespace(s,startPos+1)
- base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
- value, startPos = decode(s,startPos)
- object[key]=value
- until false -- infinite loop while key-value pairs are found
-end
-
---- Scans a JSON string from the opening inverted comma or single quote to the
--- end of the string.
--- Returns the string extracted as a Lua string,
--- and the position of the next non-string character
--- (after the closing inverted comma or single quote).
--- @param s The string being scanned.
--- @param startPos The starting position of the scan.
--- @return string, int The extracted string as a Lua string, and the next character to parse.
-function decode_scanString(s,startPos)
- base.assert(startPos, 'decode_scanString(..) called without start position')
- local startChar = string.sub(s,startPos,startPos)
- base.assert(startChar==[[']] or startChar==[["]],'decode_scanString called for a non-string')
- local escaped = false
- local endPos = startPos + 1
- local bEnded = false
- local stringLen = string.len(s)
- repeat
- local curChar = string.sub(s,endPos,endPos)
- if not escaped then
- if curChar==[[\]] then
- escaped = true
- else
- bEnded = curChar==startChar
- end
- else
- -- If we're escaped, we accept the current character come what may
- escaped = false
- end
- endPos = endPos + 1
- base.assert(endPos <= stringLen+1, "String decoding failed: unterminated string at position " .. endPos)
- until bEnded
- local stringValue = 'return ' .. string.sub(s, startPos, endPos-1)
- local stringEval = base.loadstring(stringValue)
- base.assert(stringEval, 'Failed to load string [ ' .. stringValue .. '] in JSON4Lua.decode_scanString at position ' .. startPos .. ' : ' .. endPos)
- return stringEval(), endPos
-end
-
---- Scans a JSON string skipping all whitespace from the current start position.
--- Returns the position of the first non-whitespace character, or nil if the whole end of string is reached.
--- @param s The string being scanned
--- @param startPos The starting position where we should begin removing whitespace.
--- @return int The first position where non-whitespace was encountered, or string.len(s)+1 if the end of string
--- was reached.
-function decode_scanWhitespace(s,startPos)
- local whitespace=" \n\r\t"
- local stringLen = string.len(s)
- while ( string.find(whitespace, string.sub(s,startPos,startPos), 1, true) and startPos <= stringLen) do
- startPos = startPos + 1
- end
- return startPos
-end
-
---- Encodes a string to be JSON-compatible.
--- This just involves back-quoting inverted commas, back-quotes and newlines, I think ;-)
--- @param s The string to return as a JSON encoded (i.e. backquoted string)
--- @return The string appropriately escaped.
-function encodeString(s)
- s = string.gsub(s,'\\','\\\\')
- s = string.gsub(s,'"','\\"')
- s = string.gsub(s,"'","\\'")
- s = string.gsub(s,'\n','\\n')
- s = string.gsub(s,'\t','\\t')
- return s
-end
-
--- Determines whether the given Lua type is an array or a table / dictionary.
--- We consider any table an array if it has indexes 1..n for its n items, and no
--- other data in the table.
--- I think this method is currently a little 'flaky', but can't think of a good way around it yet...
--- @param t The table to evaluate as an array
--- @return boolean, number True if the table can be represented as an array, false otherwise. If true,
--- the second returned value is the maximum
--- number of indexed elements in the array.
-function isArray(t)
- -- Next we count all the elements, ensuring that any non-indexed elements are not-encodable
- -- (with the possible exception of 'n')
- local maxIndex = 0
- for k,v in base.pairs(t) do
- if (base.type(k)=='number' and math.floor(k)==k and 1<=k) then -- k,v is an indexed pair
- if (not isEncodable(v)) then return false end -- All array elements must be encodable
- maxIndex = math.max(maxIndex,k)
- else
- if (k=='n') then
- if v ~= table.getn(t) then return false end -- False if n does not hold the number of elements
- else -- Else of (k=='n')
- if isEncodable(v) then return false end
- end -- End of (k~='n')
- end -- End of k,v not an indexed pair
- end -- End of loop across all pairs
- return true, maxIndex
-end
-
---- Determines whether the given Lua object / table / variable can be JSON encoded. The only
--- types that are JSON encodable are: string, boolean, number, nil, table and json.null.
--- In this implementation, all other types are ignored.
--- @param o The object to examine.
--- @return boolean True if the object should be JSON encoded, false if it should be ignored.
-function isEncodable(o)
- local t = base.type(o)
- return (t=='string' or t=='boolean' or t=='number' or t=='nil' or t=='table') or (t=='function' and o==null)
-end
-
------------------------------------------------------------------------------
--- JSONRPC4Lua: JSON RPC client calls over http for the Lua language.
--- json.rpc Module.
--- Author: Craig Mason-Jones
--- Homepage: http://json.luaforge.net/
--- Version: 0.9.10
--- This module is released under the The GNU General Public License (GPL).
--- Please see LICENCE.txt for details.
---
--- USAGE:
--- This module exposes two functions:
--- proxy( 'url')
--- Returns a proxy object for calling the JSON RPC Service at the given url.
--- call ( 'url', 'method', ...)
--- Calls the JSON RPC server at the given url, invokes the appropriate method, and
--- passes the remaining parameters. Returns the result and the error. If the result is nil, an error
--- should be there (or the system returned a null). If an error is there, the result should be nil.
---
--- REQUIREMENTS:
--- Lua socket 2.0 (http://www.cs.princeton.edu/~diego/professional/luasocket/)
--- json (The JSON4Lua package with which it is bundled)
--- compat-5.1 if using Lua 5.0.
------------------------------------------------------------------------------
-
-module('json.rpc')
-
------------------------------------------------------------------------------
--- Imports and dependencies
------------------------------------------------------------------------------
-local json = require('json')
-local http = require("socket.http")
-
------------------------------------------------------------------------------
--- PUBLIC functions
------------------------------------------------------------------------------
-
---- Creates an RPC Proxy object for the given Url of a JSON-RPC server.
--- @param url The URL for the JSON RPC Server.
--- @return Object on which JSON-RPC remote methods can be called.
--- EXAMPLE Usage:
--- local jsolait = json.rpc.proxy('http://jsolait.net/testj.py')
--- print(jsolait.echo('This is a test of the echo method!'))
--- print(jsolait.args2String('first','second','third'))
--- table.foreachi( jsolait.args2Array(5,4,3,2,1), print)
-function proxy(url)
- local serverProxy = {}
- local proxyMeta = {
- __index = function(t, key)
- return function(...)
- return json.rpc.call(url, key, unpack(arg))
- end
- end
- }
- setmetatable(serverProxy, proxyMeta)
- return serverProxy
-end
-
---- Calls a JSON RPC method on a remote server.
--- Returns a boolean true if the call succeeded, false otherwise.
--- On success, the second returned parameter is the decoded
--- JSON object from the server.
--- On http failure, returns nil and an error message.
--- On success, returns the result and nil.
--- @param url The url of the JSON RPC server.
--- @param method The method being called.
--- @param ... Parameters to pass to the method.
--- @return result, error The JSON RPC result and error. One or the other should be nil. If both
--- are nil, this means that the result of the RPC call was nil.
--- EXAMPLE Usage:
--- print(json.rpc.call('http://jsolait.net/testj.py','echo','This string will be returned'))
-function call(url, method, ...)
- assert(method,'method param is nil to call')
- local JSONRequestArray = {
- id="httpRequest",
- ["method"]=method,
- params = arg
- }
- local httpResponse, result , code
- local jsonRequest = json.encode(JSONRequestArray)
- -- We use the sophisticated http.request form (with ltn12 sources and sinks) so that
- -- we can set the content-type to text/plain. While this shouldn't strictly-speaking be true,
- -- it seems a good idea (Xavante won't work w/out a content-type header, although a patch
- -- is needed to Xavante to make it work with text/plain)
- local ltn12 = require('ltn12')
- local resultChunks = {}
- httpResponse, code = http.request(
- { ['url'] = url,
- sink = ltn12.sink.table(resultChunks),
- method = 'POST',
- headers = { ['content-type']='text/plain', ['content-length']=string.len(jsonRequest) },
- source = ltn12.source.string(jsonRequest)
- }
- )
- httpResponse = table.concat(resultChunks)
- -- Check the http response code
- if (code~=200) then
- return nil, "HTTP ERROR: " .. code
- end
- -- And decode the httpResponse and check the JSON RPC result code
- result = json.decode( httpResponse )
- if result.result then
- return result.result, nil
- else
- return nil, result.error
- end
-end
------------------------------------------------------------------------------
--- JSONRPC4Lua: JSON RPC server for exposing Lua objects as JSON RPC callable
--- objects via http.
--- json.rpcserver Module.
--- Author: Craig Mason-Jones
--- Homepage: http://json.luaforge.net/
--- Version: 0.9.10
--- This module is released under the The GNU General Public License (GPL).
--- Please see LICENCE.txt for details.
---
--- USAGE:
--- This module exposes one function:
--- server(luaClass, packReturn)
--- Manages incoming JSON RPC request forwarding the method call to the given
--- object. If packReturn is true, multiple return values are packed into an
--- array on return.
---
--- IMPORTANT NOTES:
--- 1. This version ought really not be 0.9.10, since this particular part of the
--- JSONRPC4Lua package is very first-draft. However, the JSON4Lua package with which
--- it comes is quite solid, so there you have it :-)
--- 2. This has only been tested with Xavante webserver, with which it works
--- if you patch CGILua to accept 'text/plain' content type. See doc\cgilua_patch.html
--- for details.
-----------------------------------------------------------------------------
-
-module ('json.rpcserver')
-
----
--- Implements a JSON RPC Server wrapping for luaClass, exposing each of luaClass's
--- methods as JSON RPC callable methods.
--- @param luaClass The JSON RPC class to expose.
--- @param packReturn If true, the server will automatically wrap any
--- multiple-value returns into an array. Single returns remain single returns. If
--- false, when a function returns multiple values, only the first of these values will
--- be returned.
---
-function serve(luaClass, packReturn)
- cgilua.contentheader('text','plain')
- require('cgilua')
- require ('json')
- local postData = ""
-
- if not cgilua.servervariable('CONTENT_LENGTH') then
- cgilua.put("Please access JSON Request using HTTP POST Request")
- return 0
- else
- postData = cgi[1] -- SAPI.Request.getpostdata() --[[{ "id":1, "method":"echo","params":["Hi there"]}]] --
- end
- -- @TODO Catch an error condition on decoding the data
- local jsonRequest = json.decode(postData)
- local jsonResponse = {}
- jsonResponse.id = jsonRequest.id
- local method = luaClass[ jsonRequest.method ]
-
- if not method then
- jsonResponse.error = 'Method ' .. jsonRequest.method .. ' does not exist at this server.'
- else
- local callResult = { pcall( method, unpack( jsonRequest.params ) ) }
- if callResult[1] then -- Function call successfull
- table.remove(callResult,1)
- if packReturn and table.getn(callResult)>1 then
- jsonResponse.result = callResult
- else
- jsonResponse.result = unpack(callResult) -- NB: Does not support multiple argument returns
- end
- else
- jsonResponse.error = callResult[2]
- end
- end
-
- -- Output the result
- -- TODO: How to be sure that the result and error tags are there even when they are nil in Lua?
- -- Can force them by hand... ?
- cgilua.contentheader('text','plain')
- cgilua.put( json.encode( jsonResponse ) )
-end
-
---[[
- Auctioneer Advanced
- Version: <%version%> (<%codename%>)
- Revision: $Id: CoreMain.lua 2233 2007-09-25 03:57:33Z norganna $
- URL: http://auctioneeraddon.com/
-
- This is an addon for World of Warcraft that adds statistical history to the auction data that is collected
- when the auction is scanned, so that you can easily determine what price
- you will be able to sell an item for at auction or at a vendor whenever you
- mouse-over an item in the game
-
- License:
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program(see GPL.txt); if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- Note:
- This AddOn's source code is specifically designed to work with
- World of Warcraft's interpreted AddOn system.
- You have an implicit licence to use this AddOn with these facilities
- since that is its designated purpose as per:
- http://www.fsf.org/licensing/licenses/gpl-faq.html#InterpreterIncompat
-]]
-
-
---[[
- See CoreAPI.lua for a description of the modules API
-]]
-
-if (not AucAdvanced) then AucAdvanced = {} end
-if (not AucAdvancedData) then AucAdvancedData = {} end
-if (not AucAdvancedLocal) then AucAdvancedLocal = {} end
-if (not AucAdvancedConfig) then AucAdvancedConfig = {} end
-
-AucAdvanced.Version="<%version%>";
-if (AucAdvanced.Version == "<".."%version%>") then
- AucAdvanced.Version = "5.0.DEV";
-end
-
-local private = {}
-
--- For our modular stats system, each stats engine should add their
--- subclass to AucAdvanced.Modules.<type>.<name> and store their data into their own
--- data table in AucAdvancedData.Stats.<type><name>
-if (not AucAdvanced.Modules) then AucAdvanced.Modules = {Stat={},Util={},Filter={}} end
-if (not AucAdvancedData.Stats) then AucAdvancedData.Stats = {} end
-if (not AucAdvancedLocal.Stats) then AucAdvancedLocal.Stats = {} end
-
-function private.TooltipHook(vars, ret, frame, name, hyperlink, quality, quantity, cost, additional)
- if EnhTooltip.LinkType(hyperlink) ~= "item" then
- return -- Auctioneer hooks into item tooltips only
- end
-
- -- Check to see if we need to force load scandata
- local getter = AucAdvanced.Settings.GetSetting
- if (getter("scandata.tooltip.display") and getter("scandata.force")) then
- AucAdvanced.Scan.GetImage()
- end
-
- for system, systemMods in pairs(AucAdvanced.Modules) do
- for engine, engineLib in pairs(systemMods) do
- if (engineLib.Processor) then engineLib.Processor("tooltip", frame, name, hyperlink, quality, quantity, cost, additional) end
- end
- end
-end
-
-function private.HookAH()
- hooksecurefunc("AuctionFrameBrowse_Update", AucAdvanced.API.ListUpdate)
- for system, systemMods in pairs(AucAdvanced.Modules) do
- for engine, engineLib in pairs(systemMods) do
- if (engineLib.Processor) then
- engineLib.Processor("auctionui")
- end
- end
- end
-end
-
-function private.OnLoad(addon)
- addon = addon:lower()
-
- -- Check if the actual addon itself is loading
- if (addon == "auc-advanced") then
- Stubby.RegisterAddOnHook("Blizzard_AuctionUi", "Auc-Advanced", private.HookAH)
- Stubby.RegisterFunctionHook("EnhTooltip.AddTooltip", 600, private.TooltipHook)
- for pos, module in ipairs(AucAdvanced.EmbeddedModules) do
- -- These embedded modules have also just been loaded
- private.OnLoad(module)
- end
- end
-
- -- Notify the actual module if it exists
- local auc, sys, eng = strsplit("-", addon)
- if (auc == "auc" and sys and eng) then
- for system, systemMods in pairs(AucAdvanced.Modules) do
- if (sys == system:lower()) then
- for engine, engineLib in pairs(systemMods) do
- if (eng == engine:lower() and engineLib.OnLoad) then
- engineLib.OnLoad(addon)
- end
- end
- end
- end
- end
-
- -- Check all modules' load triggers and pass event to processors
- for system, systemMods in pairs(AucAdvanced.Modules) do
- for engine, engineLib in pairs(systemMods) do
- if (engineLib.LoadTriggers and engineLib.LoadTriggers[addon]) then
- if (engineLib.OnLoad) then
- engineLib.OnLoad(addon)
- end
- end
- if (engineLib.Processor and auc == "auc" and sys and eng) then
- engineLib.Processor("load", addon)
- end
- end
- end
-end
-
-function private.OnUnload()
- for system, systemMods in pairs(AucAdvanced.Modules) do
- for engine, engineLib in pairs(systemMods) do
- if (engineLib.OnUnload) then
- engineLib.OnUnload()
- end
- end
- end
-end
-
-private.Schedule = {}
-function private.OnEvent(...)
- local event, arg = select(2, ...)
- if (event == "ADDON_LOADED") then
- local addon = string.lower(arg)
- if (addon:sub(1,4) == "auc-") then
- private.OnLoad(addon)
- end
- elseif (event == "AUCTION_HOUSE_SHOW") then
- -- Do Nothing for now
- elseif (event == "AUCTION_HOUSE_CLOSED") then
- AucAdvanced.Scan.Interrupt()
- elseif (event == "PLAYER_LOGOUT") then
- AucAdvanced.Scan.Commit(true)
- private.OnUnload()
- elseif event == "UNIT_INVENTORY_CHANGED"
- or event == "ITEM_LOCK_CHANGED"
- or event == "CURSOR_UPDATE"
- or event == "BAG_UPDATE"
- then
- private.Schedule["inventory"] = GetTime() + 0.15
- end
-end
-
-function private.OnUpdate(...)
- if event == "inventory" then
- AucAdvanced.Post.AlertBagsChanged()
- end
-
- local now = GetTime()
- for event, time in pairs(private.Schedule) do
- if time > now then
- for system, systemMods in pairs(AucAdvanced.Modules) do
- for engine, engineLib in pairs(systemMods) do
- if engineLib.Processor then
- engineLib.Processor(event, time)
- end
- end
- end
- end
- private.Schedule[event] = nil
- end
-end
-
-private.Frame = CreateFrame("Frame")
-private.Frame:RegisterEvent("ADDON_LOADED")
-private.Frame:RegisterEvent("AUCTION_HOUSE_SHOW")
-private.Frame:RegisterEvent("AUCTION_HOUSE_CLOSED")
-private.Frame:RegisterEvent("UNIT_INVENTORY_CHANGED")
-private.Frame:RegisterEvent("ITEM_LOCK_CHANGED")
-private.Frame:RegisterEvent("CURSOR_UPDATE")
-private.Frame:RegisterEvent("BAG_UPDATE")
-private.Frame:RegisterEvent("PLAYER_LOGOUT")
-private.Frame:SetScript("OnEvent", private.OnEvent)
-private.Frame:SetScript("OnUpdate", private.OnUpdate)
-
--- Auctioneer's debug functions
-AucAdvanced.Debug = {}
-local addonName = "Auctioneer" -- the addon's name as it will be displayed in
- -- the debug messages
--------------------------------------------------------------------------------
--- Prints the specified message to nLog.
---
--- syntax:
--- errorCode, message = debugPrint([message][, category][, title][, errorCode][, level])
---
--- parameters:
--- message - (string) the error message
--- nil, no error message specified
--- category - (string) the category of the debug message
--- nil, no category specified
--- title - (string) the title for the debug message
--- nil, no title specified
--- errorCode - (number) the error code
--- nil, no error code specified
--- level - (string) nLog message level
--- Any nLog.levels string is valid.
--- nil, no level specified
---
--- returns:
--- errorCode - (number) errorCode, if one is specified
--- nil, otherwise
--- message - (string) message, if one is specified
--- nil, otherwise
--------------------------------------------------------------------------------
-function AucAdvanced.Debug.DebugPrint(message, category, title, errorCode, level)
- return DebugLib.DebugPrint(addonName, message, category, title, errorCode, level)
-end
-
--------------------------------------------------------------------------------
--- Used to make sure that conditions are met within functions.
--- If test is false, the error message will be written to nLog and the user's
--- default chat channel.
---
--- syntax:
--- assertion = assert(test, message)
---
--- parameters:
--- test - (any) false/nil, if the assertion failed
--- anything else, otherwise
--- message - (string) the message which will be output to the user
---
--- returns:
--- assertion - (boolean) true, if the test passed
--- false, otherwise
--------------------------------------------------------------------------------
-function AucAdvanced.Debug.Assert(test, message)
- return DebugLib.Assert(addonName, test, message)
-end
-
-
diff --git a/etc/todo/example.lua.zip b/etc/todo/example.lua.zip
deleted file mode 100644
index 60a022d..0000000
--- a/etc/todo/example.lua.zip
+++ /dev/null
Binary files differ
diff --git a/etc/todo/latex.demiurgo.rb b/etc/todo/latex.demiurgo.rb
deleted file mode 100755
index 0a54872..0000000
--- a/etc/todo/latex.demiurgo.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-module CodeRay
-module Encoders
-
- # = LaTeX Encoder
- #
- # Encoder producing LaTeX.
- class Latex < Encoder
-
- include Streamable
- register_for :latex
-
- FILE_EXTENSION = 'tex'
-
- DEFAULT_OPTIONS = {
- :wrap => true,
- }
-
- protected
- def text_token text, kind
- @out <<
- if kind == :space
- text
- else
- text = escape_latex(text)
- "\\syn#{kind_to_command(kind)}{#{text}}"
- end
- end
-
- def block_token action, kind
- @out << super
- end
-
- def open_token kind
- "\\syn#{kind_to_command(kind)}{"
- end
-
- def close_token kind
- "}"
- end
-
- def kind_to_command kind
- kind.to_s.gsub(/[^a-z0-9]/i, '').to_sym
- end
-
- def finish options
- case options[:wrap]
- when true, 1, :semiverbatim
- @out = "\\begin{semiverbatim}\n#{@out}\n\\end{semiverbatim}\n"
- when false, 0
- # Nothing to do
- else
- raise ArgumentError, "Unknown :wrap option: '#{options[:wrap]}'"
- end
-
- super
- end
-
- # Escape text so it's interpreted literally by LaTeX compilers
- def escape_latex string
- string.to_s.gsub(/[$\\{}_%#&~^"]/) do |s|
- case s
- when '$'
- '\$'
- when '\\'
- '\synbs{}'
- when /[{}_%#&]/
- "\\#{s}"
- when /[~^]/
- "\\#{s}{}"
- when '"'
- '"{}'
- end
- end
- end
-
- end
-
-end
-end
diff --git a/etc/todo/latex.murphy.rb b/etc/todo/latex.murphy.rb
deleted file mode 100644
index 7b48769..0000000
--- a/etc/todo/latex.murphy.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-module CodeRay
-module Encoders
-
- class Latex < Encoder
-
- include Streamable
- register_for :latex
-
- FILE_EXTENSION = 'tex'
-
- ALLTT_ESCAPE = { #:nodoc:
- '{' => '\lb',
- '}' => '\rb',
- '\\' => '\bs',
- }
-
- HTML_ESCAPE_PATTERN = /[\\{}]/
-
- protected
-
- def text_token text, kind
- if text =~ /#{HTML_ESCAPE_PATTERN}/o
- text = text.gsub(/#{HTML_ESCAPE_PATTERN}/o) { |m| @HTML_ESCAPE[m] }
- end
- k = Tokens::AbbreviationForKind[kind]
- if k == :NO_HIGHLIGHT
- text
- else
- "\\CR#{k}{#{text}}"
- end
- end
-
- def open_token kind
- "\\CR#{Tokens::AbbreviationForKind[kind]}{"
- end
-
- def close_token kind
- "}"
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners.zip b/etc/todo/scanners.zip
deleted file mode 100644
index 78eeca3..0000000
--- a/etc/todo/scanners.zip
+++ /dev/null
Binary files differ
diff --git a/etc/todo/scanners/applescript-sebastian.rb b/etc/todo/scanners/applescript-sebastian.rb
deleted file mode 100644
index ec29091..0000000
--- a/etc/todo/scanners/applescript-sebastian.rb
+++ /dev/null
@@ -1,219 +0,0 @@
-# Scanner for AppleScript Created by Sebastian Yepes F.
-# Web: http://sebastian.yepes.in
-# e-Mail: sebastian@yepes.in
-
-module CodeRay
-module Scanners
-
- class AppleScript < Scanner
-
- register_for :applescript
-
- RESERVED_WORDS = [
- '#include', 'for', 'foreach', 'if', 'elseif', 'else', 'while', 'do', 'dowhile', 'end',
- 'switch', 'case', 'return', 'break', 'continue', 'in', 'to', 'of', 'repeat', 'tell', 'then','as'
- ]
-
- KEYWORD_OPERATOR = [
- 'is greater than', 'comes after', 'is less than', 'comes before',
- 'is greater than or equal to', 'is less than or equal to', 'is equal to',
- 'is', 'is not equal to', 'is not', 'contains', 'does not contain', 'is in',
- 'is not in', 'starts with', 'ends with'
- ]
-
-
- DIRECTIVES = [
- 'activate', '#endinitclip', '#initclip', '__proto__', '_accProps', '_alpha', '_currentframe',
- '_droptarget', '_focusrect', '_framesloaded', '_height', '_highquality', '_lockroot',
- '_name', '_parent', '_quality', '_root', '_rotation', '_soundbuftime', '_target', '_totalframes',
- '_url', '_visible', '_width', '_x', '_xmouse', '_xscale', '_y', '_ymouse', '_yscale', 'abs',
- 'Accessibility', 'acos', 'activityLevel', 'add', 'addListener', 'addPage', 'addProperty',
- 'addRequestHeader', 'align', 'allowDomain', 'allowInsecureDomain', 'and', 'appendChild',
- 'apply', 'Arguments', 'Array', 'asfunction', 'asin', 'atan', 'atan2', 'attachAudio', 'attachMovie',
- 'attachSound', 'attachVideo', 'attributes', 'autosize', 'avHardwareDisable', 'background',
- 'backgroundColor', 'BACKSPACE', 'bandwidth', 'beginFill', 'beginGradientFill', 'blockIndent',
- 'bold', 'Boolean', 'border', 'borderColor', 'bottomScroll', 'bufferLength', 'bufferTime',
- 'builtInItems', 'bullet', 'Button', 'bytesLoaded', 'bytesTotal', 'call', 'callee', 'caller',
- 'Camera', 'capabilities', 'CAPSLOCK', 'caption', 'catch', 'ceil', 'charAt', 'charCodeAt',
- 'childNodes', 'chr', 'clear', 'clearInterval', 'cloneNode', 'close', 'Color', 'concat',
- 'connect', 'condenseWhite', 'constructor', 'contentType', 'ContextMenu', 'ContextMenuItem',
- 'CONTROL', 'copy', 'cos', 'createElement', 'createEmptyMovieClip', 'createTextField',
- 'createTextNode', 'currentFps', 'curveTo', 'CustomActions', 'customItems', 'data', 'Date',
- 'deblocking', 'delete', 'DELETEKEY', 'docTypeDecl', 'domain', 'DOWN',
- 'duplicateMovieClip', 'duration', 'dynamic', 'E', 'embedFonts', 'enabled',
- 'endFill', 'ENTER', 'eq', 'Error', 'ESCAPE(Konstante)', 'escape(Funktion)', 'eval',
- 'exactSettings', 'exp', 'extends', 'finally', 'findText', 'firstChild', 'floor',
- 'flush', 'focusEnabled', 'font', 'fps', 'fromCharCode', 'fscommand',
- 'gain', 'ge', 'get', 'getAscii', 'getBeginIndex', 'getBounds', 'getBytesLoaded', 'getBytesTotal',
- 'getCaretIndex', 'getCode', 'getCount', 'getDate', 'getDay', 'getDepth', 'getEndIndex', 'getFocus',
- 'getFontList', 'getFullYear', 'getHours', 'getInstanceAtDepth', 'getLocal', 'getMilliseconds',
- 'getMinutes', 'getMonth', 'getNewTextFormat', 'getNextHighestDepth', 'getPan', 'getProgress',
- 'getProperty', 'getRGB', 'getSeconds', 'getSelected', 'getSelectedText', 'getSize', 'getStyle',
- 'getStyleNames', 'getSWFVersion', 'getText', 'getTextExtent', 'getTextFormat', 'getTextSnapshot',
- 'getTime', 'getTimer', 'getTimezoneOffset', 'getTransform', 'getURL', 'getUTCDate', 'getUTCDay',
- 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds',
- 'getVersion', 'getVolume', 'getYear', 'globalToLocal', 'goto', 'gotoAndPlay', 'gotoAndStop',
- 'hasAccessibility', 'hasAudio', 'hasAudioEncoder', 'hasChildNodes', 'hasEmbeddedVideo', 'hasMP3',
- 'hasPrinting', 'hasScreenBroadcast', 'hasScreenPlayback', 'hasStreamingAudio', 'hasStreamingVideo',
- 'hasVideoEncoder', 'height', 'hide', 'hideBuiltInItems', 'hitArea', 'hitTest', 'hitTestTextNearPos',
- 'HOME', 'hscroll', 'html', 'htmlText', 'ID3', 'ifFrameLoaded', 'ignoreWhite', 'implements',
- 'import', 'indent', 'index', 'indexOf', 'Infinity', '-Infinity', 'INSERT', 'insertBefore', 'install',
- 'instanceof', 'int', 'interface', 'isActive', 'isDebugger', 'isDown', 'isFinite', 'isNaN', 'isToggled',
- 'italic', 'join', 'Key', 'language', 'lastChild', 'lastIndexOf', 'le', 'leading', 'LEFT', 'leftMargin',
- 'length', 'level', 'lineStyle', 'lineTo', 'list', 'LN10', 'LN2', 'load', 'loadClip', 'loaded', 'loadMovie',
- 'loadMovieNum', 'loadSound', 'loadVariables', 'loadVariablesNum', 'LoadVars', 'LocalConnection',
- 'localFileReadDisable', 'localToGlobal', 'log', 'LOG10E', 'LOG2E', 'manufacturer', 'Math', 'max',
- 'MAX_VALUE', 'maxChars', 'maxhscroll', 'maxscroll', 'mbchr', 'mblength', 'mbord', 'mbsubstring', 'menu',
- 'message', 'Microphone', 'min', 'MIN_VALUE', 'MMExecute', 'motionLevel', 'motionTimeOut', 'Mouse',
- 'mouseWheelEnabled', 'moveTo', 'Movieclip', 'MovieClipLoader', 'multiline', 'muted', 'name', 'names', 'NaN',
- 'ne', 'NEGATIVE_INFINITY', 'NetConnection', 'NetStream', 'newline', 'nextFrame',
- 'nextScene', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue', 'not', 'Number', 'Object',
- 'on', 'onActivity', 'onChanged', 'onClipEvent', 'onClose', 'onConnect', 'onData', 'onDragOut',
- 'onDragOver', 'onEnterFrame', 'onID3', 'onKeyDown', 'onKeyUp', 'onKillFocus', 'onLoad', 'onLoadComplete',
- 'onLoadError', 'onLoadInit', 'onLoadProgress', 'onLoadStart', 'onMouseDown', 'onMouseMove', 'onMouseUp',
- 'onMouseWheel', 'onPress', 'onRelease', 'onReleaseOutside', 'onResize', 'onRollOut', 'onRollOver',
- 'onScroller', 'onSelect', 'onSetFocus', 'onSoundComplete', 'onStatus', 'onUnload', 'onUpdate', 'onXML',
- 'or(logischesOR)', 'ord', 'os', 'parentNode', 'parseCSS', 'parseFloat', 'parseInt', 'parseXML', 'password',
- 'pause', 'PGDN', 'PGUP', 'PI', 'pixelAspectRatio', 'play', 'playerType', 'pop', 'position',
- 'POSITIVE_INFINITY', 'pow', 'prevFrame', 'previousSibling', 'prevScene', 'print', 'printAsBitmap',
- 'printAsBitmapNum', 'PrintJob', 'printNum', 'private', 'prototype', 'public', 'push', 'quality',
- 'random', 'rate', 'registerClass', 'removeListener', 'removeMovieClip', 'removeNode', 'removeTextField',
- 'replaceSel', 'replaceText', 'resolutionX', 'resolutionY', 'restrict', 'reverse', 'RIGHT',
- 'rightMargin', 'round', 'scaleMode', 'screenColor', 'screenDPI', 'screenResolutionX', 'screenResolutionY',
- 'scroll', 'seek', 'selectable', 'Selection', 'send', 'sendAndLoad', 'separatorBefore', 'serverString',
- 'set', 'setvariable', 'setBufferTime', 'setClipboard', 'setDate', 'setFocus', 'setFullYear', 'setGain',
- 'setHours', 'setInterval', 'setMask', 'setMilliseconds', 'setMinutes', 'setMode', 'setMonth',
- 'setMotionLevel', 'setNewTextFormat', 'setPan', 'setProperty', 'setQuality', 'setRate', 'setRGB',
- 'setSeconds', 'setSelectColor', 'setSelected', 'setSelection', 'setSilenceLevel', 'setStyle',
- 'setTextFormat', 'setTime', 'setTransform', 'setUseEchoSuppression', 'setUTCDate', 'setUTCFullYear',
- 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setVolume',
- 'setYear', 'SharedObject', 'SHIFT(Konstante)', 'shift(Methode)', 'show', 'showMenu', 'showSettings',
- 'silenceLevel', 'silenceTimeout', 'sin', 'size', 'slice', 'smoothing', 'sort', 'sortOn', 'Sound', 'SPACE',
- 'splice', 'split', 'sqrt', 'SQRT1_2', 'SQRT2', 'Stage', 'start', 'startDrag', 'static', 'status', 'stop',
- 'stopAllSounds', 'stopDrag', 'StyleSheet(Klasse)', 'styleSheet(Eigenschaft)', 'substr',
- 'substring', 'super', 'swapDepths', 'System', 'TAB', 'tabChildren', 'tabEnabled', 'tabIndex',
- 'tabStops', 'tan', 'target', 'targetPath', 'tellTarget', 'text', 'textColor', 'TextField', 'TextFormat',
- 'textHeight', 'TextSnapshot', 'textWidth', 'this', 'throw', 'time', 'toggleHighQuality', 'toLowerCase',
- 'toString', 'toUpperCase', 'trace', 'trackAsMenu', 'try', 'type', 'typeof', 'undefined',
- 'underline', 'unescape', 'uninstall', 'unloadClip', 'unloadMovie', 'unLoadMovieNum', 'unshift', 'unwatch',
- 'UP', 'updateAfterEvent', 'updateProperties', 'url', 'useCodePage', 'useEchoSuppression', 'useHandCursor',
- 'UTC', 'valueOf', 'variable', 'version', 'Video', 'visible', 'void', 'watch', 'width',
- 'with', 'wordwrap', 'XML', 'xmlDecl', 'XMLNode', 'XMLSocket'
- ]
-
- PREDEFINED_TYPES = [
- 'boolean', 'small integer', 'integer', 'double integer',
- 'small real', 'real', 'date','list', 'record', 'string', 'class'
- ]
-
- PREDEFINED_CONSTANTS = [
- 'pi', 'true', 'false',
- 'application responses', 'case', 'diacriticals', 'expansion', 'hyphens', 'punctuation', 'white space',
- 'seconds', 'minutes', 'hours', 'days', 'weeks',
- 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
- 'anything', 'current application', 'it', 'me', 'missing value', 'my', 'result',
- 'yes', 'no', 'ask',
- 'return', 'space', 'tab',
- 'all caps', 'all lowercase', 'bold', 'condensed', 'expanded', 'hidden', 'italic', 'outline', 'plain', 'shadow', 'small caps', 'strikethrough', 'subscript', 'superscript', 'underline',
- 'version'
- ]
-
- PLAIN_STRING_CONTENT = {
- "'" => /[^'\n]+/,
- '"' => /[^"\n]+/,
- }
-
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(KEYWORD_OPERATOR, :operator).
- add(DIRECTIVES, :directive).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
-
-
- def scan_tokens tokens, options
-
- state = :initial
- plain_string_content = @plain_string_content
-
- until eos?
-
- kind = nil
- match = nil
-
- if state == :initial
-
- if scan(/\s+/x)
- kind = :space
-
- elsif scan(%r! \{ \$ [^}]* \}? | \(\* \$ (?: .*? \*\) | .* ) !mx)
- kind = :preprocessor
-
- elsif scan(/^[\s\t]*--.*/x)
- kind = :comment
- elsif scan(/\(\* (?: .*? \*\)$ | .* )/mx)
- kind = :comment
-
- elsif scan(/ [-+*\/=<>:;,.@\^|\(\)\[\]]+ /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
-
- elsif match = scan(/ ' ( [^\n']|'' ) (?:'|$) /x)
- tokens << [:open, :char]
- tokens << ["'", :delimiter]
- tokens << [self[1], :content]
- tokens << ["'", :delimiter]
- tokens << [:close, :char]
- next
-
- elsif match = scan(/["']/)
- tokens << [:open, :string]
- state = :string
- plain_string_content = PLAIN_STRING_CONTENT[match]
- kind = :delimiter
-
- else
- kind = :plain
- getch
-
- end
-
- elsif state == :string
- if scan(plain_string_content)
- kind = :content
- elsif scan(/['"]/)
- tokens << [matched, :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- end
-
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
- tokens << [match, kind]
-
- end
- tokens
- end
-
- end
-
-end
-end \ No newline at end of file
diff --git a/etc/todo/scanners/avrasm.rb b/etc/todo/scanners/avrasm.rb
deleted file mode 100644
index b3fc28d..0000000
--- a/etc/todo/scanners/avrasm.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-module CodeRay
-module Scanners
-
- class AVRASM < Scanner
-
- register_for :avrasm
-
- RESERVED_WORDS = [
- ]
-
- PREDEFINED_TYPES = [
- ]
-
- PREDEFINED_CONSTANTS = [
- ]
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- ESCAPE = / [rbfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = nil
- match = nil
-
- case state
-
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(/;.*/x)
- kind = :comment
-
- elsif scan(/\.(\w*)/x)
- kind = :preprocessor
- state = :include_expected if self[1] == 'include'
-
- elsif scan(/@[0-9]+/)
- kind = :preprocessor
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif scan(/r[0-9]+/i)
- # register R0-R31
- kind = :pre_constant
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- if kind == :ident and check(/:(?!:)/)
- match << scan(/:/)
- kind = :label
- end
-
- elsif match = scan(/"/)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
- kind = :char
-
- elsif scan(/0[xX][0-9A-Fa-f]+/)
- kind = :integer
-
- elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :integer
-
- elsif scan(/0[bB][0-9A-Fa-f]+/)
- kind = :integer
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n"]+/)
- kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- when :include_expected
- if scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/)
- kind = :include
- state = :initial
-
- elsif match = scan(/\s+/)
- kind = :space
- state = :initial if match.index ?\n
-
- else
- getch
- kind = :error
-
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/bash-Anh Ky Huynh.rb b/etc/todo/scanners/bash-Anh Ky Huynh.rb
deleted file mode 100644
index 274d630..0000000
--- a/etc/todo/scanners/bash-Anh Ky Huynh.rb
+++ /dev/null
@@ -1,131 +0,0 @@
-module CodeRay module Scanners
-
- class BASH < Scanner
-
- register_for :bash
-
- RESERVED_WORDS = %w{
- if elif fi until while done for do case in esac select
- break else then shift function
- }
-
- PREDEFINED_CONSTANTS = %w{
- $CDPATH $HOME $IFS $MAIL $MAILPATH $OPTARG $LINENO $LINES
- $OPTIND $PATH $PS1 $PS2 $BASH $BASH_ARGCBASH_ARGV
- $BASH_COMMAND $BASH_ENV $BASH_EXECUTION_STRING
- $BASH_LINENO $BASH_REMATCH $BASH_SOURCE $COLUMNS
- $BASH_SUBSHELL $BASH_VERSINFO $BASH_VERSION $OSTYPE
- $COMP_CWORD $COMP_LINE $COMP_POINT $COMP_WORDBREAKS
- $COMP_WORDS $COMPREPLY $DIRSTACK $EMACS $EUID $OTPERR
- $FCEDIT $FIGNORE $FUNCNAME $GLOBIGNORE $GROUPS $OLDPWD
- $histchars $HISTCMD $HISTCONTROL $HISTFILE $MACHTYPE
- $HISTFILESIZE $HISTIGNORE $HISTSIZE $HISTTIMEFOMAT
- $HOSTFILE $HOSTNAME $HOSTTYPE $IGNOREEOF $INPUTRC $LANG
- $LC_ALL $LC_COLLATE $LC_CTYPE $LC_MESSAGES $LC_NUMERIC
- $PIPESTATUS $POSIXLY_CORRECT $MAILCHECK $PPID $PS3 $PS4
- $PROMPT_COMMAND $PWD $RANDOM $REPLY $SECONDS $SHELL
- $SHELLOPTS $SHLVL $TIMEFORMAT $TMOUT $TMPDIR $UID
- }
-
- BUILTIN = %w{
- cd continue eval exec true false suspend unalias
- exit export getopts hash pwd readonly return test
- times trap umask unset alias bind builtin caller
- command declare echo enable help let local logout
- printf read shopt source type typeset ulimit
- set dirs popd pushd bg fg jobs kill wait disown
- }
-
- IDENT_KIND = WordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- # add(PREDEFINED_CONSTANTS, :pre_constant).
- add(BUILTIN, :method)
-
- ESCAPE = / [\$rtnb\n\\'"] /x
- # UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- VARIABLE_SIMPLE = /\$[a-zA-Z]\w*/
- VARIABLE_EXPRESSION = /\$\{[!#]?[a-zA-Z].*?\}/
-
- def scan_tokens tokens, options
-
- state = :initial
- string_type = nil
-
- until eos?
-
- kind = nil
- match = nil
-
- if state == :initial
- if scan(/ \s+ | \\\n /x)
- kind = :space
- elsif match = scan(/\#!.*/) # until eof
- kind = :preprocessor
- elsif scan(/\#.*/)
- kind = :comment
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%] | \.(?!\d) /x)
- kind = :operator
- elsif match = scan(/[1-9][0-9]*/)
- kind = :number
- elsif scan(/ \\ (?: \S ) /mox)
- kind = :char
- elsif scan(/(#{VARIABLE_SIMPLE}|#{VARIABLE_EXPRESSION})/)
- kind = :instance_variable
- elsif match = scan(/ [$@A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- elsif match = scan(/["']/)
- tokens << [:open, :string]
- string_type = matched
- state = :string
- kind = :delimiter
- else
- getch
- end
- elsif state == :regex
- if scan(/[^\\\/]+/)
- kind = :content
- elsif scan(/\\\/|\\/)
- kind = :content
- elsif scan(/\//)
- tokens << [matched, :delimiter]
- tokens << [:close, :regexp]
- state = :initial
- next
- else
- getch
- kind = :content
- end
-
- elsif state == :string
- if scan(/[^\\"']+/)
- kind = :content
- elsif scan(/["']/)
- if string_type==matched
- tokens << [matched, :delimiter]
- tokens << [:close, :string]
- state = :initial
- string_type=nil
- next
- else
- kind = :content
- end
- elsif scan(/ \\ (?: \S ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- # kind = :error
- kind = :content
- state = :initial
- else
- raise "else case \" reached; %p not handled." % peek(1), tokens
- end
- else
- raise 'else-case reached', tokens
- end
- match ||= matched
- tokens << [match, kind]
- end
- tokens
- end
- end
-end end
diff --git a/etc/todo/scanners/bash.rb b/etc/todo/scanners/bash.rb
deleted file mode 100644
index d5c5d0f..0000000
--- a/etc/todo/scanners/bash.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-# author: Vincent Landgraf <setcool@gmx.de>
-# licence: GPLv2.1
-require "rubygems"
-require "coderay"
-
-module CodeRay
- module Scanners
- class Bash < Scanner
- include CodeRay::Streamable
- register_for :bash
-
- KEYWORDS = Regexp.new("(%s)(?![a-zA-Z0-9_\-])" % %w{
- if fi until while done for do case in esac select
- break else then shift function
- }.sort.join('|'))
-
- BUILTIN = Regexp.new("(%s)(?![a-zA-Z0-9_\-])" % %w{
- cd continue eval exec true false suspend unalias
- exit export getopts hash pwd readonly return test
- times trap umask unset alias bind builtin caller
- command declare echo enable help let local logout
- printf read shopt source type typeset ulimit
- set dirs popd pushd bg fg jobs kill wait disown
- }.sort.join('|'))
-
- GLOBAL_VARIABLES = Regexp.new("(%s)(?![a-zA-Z0-9_\-])" % %w{
- CDPATH HOME IFS MAIL MAILPATH OPTARG LINENO LINES
- OPTIND PATH PS1 PS2 BASH BASH_ARGCBASH_ARGV
- BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING
- BASH_LINENO BASH_REMATCH BASH_SOURCE COLUMNS
- BASH_SUBSHELL BASH_VERSINFO BASH_VERSION OSTYPE
- COMP_CWORD COMP_LINE COMP_POINT COMP_WORDBREAKS
- COMP_WORDS COMPREPLY DIRSTACK EMACS EUID OTPERR
- FCEDIT FIGNORE FUNCNAME GLOBIGNORE GROUPS OLDPWD
- histchars HISTCMD HISTCONTROL HISTFILE MACHTYPE
- HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFOMAT
- HOSTFILE HOSTNAME HOSTTYPE IGNOREEOF INPUTRC LANG
- LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC
- PIPESTATUS POSIXLY_CORRECT MAILCHECK PPID PS3 PS4
- PROMPT_COMMAND PWD RANDOM REPLY SECONDS SHELL
- SHELLOPTS SHLVL TIMEFORMAT TMOUT TMPDIR UID
- }.sort.join('|'))
-
- VARIABLE_SIMPLE = /\$[a-zA-Z]\w*/
-
- VARIABLE_EXPRESSION = /\$\{[!#]?[a-zA-Z].*?\}/
-
- CONSTANT = /\$[@#?\-$!_0-9]/
-
- def scan_tokens (tokens, options)
- state = :initial
- str_delimiter = nil
-
- until eos?
- if state == :initial
- if match = scan(CONSTANT)
- tokens << [match, :constant]
- elsif match = scan(/(#{VARIABLE_SIMPLE}|#{VARIABLE_EXPRESSION})/)
- tokens << [match, :instance_variable]
- elsif match = scan(/\s+/)
- tokens << [match, :space]
- elsif match = scan(/-[a-zA-Z]\w*(=\w*)?/)
- tokens << [match, :argument]
- elsif match = scan(/[;<>~]|[&]{1,2}|[|]{1,2}|\*/)
- tokens << [match, :operator]
- elsif match = scan(/[1-9][0-9]*/)
- tokens << [match, :number]
- elsif ((!tokens.empty? and tokens.last[1] != :escape) or tokens.empty? ) and
- (str_delimiter = scan(/["'`]/))
- # don't match if last token is backsplash
- tokens << [:open, :string]
- tokens << [str_delimiter, :delimiter]
- state = :string
- elsif match = scan(/\\/)
- tokens << [match, :escape]
- elsif match = scan(KEYWORDS)
- tokens << [match, :reserved]
- elsif match = scan(BUILTIN)
- tokens << [match, :method]
- elsif match = scan(GLOBAL_VARIABLES)
- tokens << [match, :global_variable]
- elsif match = scan(/[a-zA-Z]\w*/)
- tokens << [match, :ident]
- elsif match = scan(/\#!.*/) # until eof
- tokens << [match, :doctype]
- elsif match = scan(/\#.*/) # until eof
- tokens << [match, :comment]
- # catch the rest as other
- else c = getch
- tokens << [c, :other]
- end
- elsif state == :string
- if match = scan(/[\\][abefnrtv\\#{str_delimiter}]/)
- tokens << [match, :escape]
- elsif match = scan(CONSTANT)
- tokens << [:open, :inline]
- tokens << [match, :constant]
- tokens << [:close, :inline]
- elsif match = scan(/(#{VARIABLE_SIMPLE}|#{VARIABLE_EXPRESSION})/)
- tokens << [:open, :inline]
- tokens << [match, :instance_variable]
- tokens << [:close, :inline]
- elsif match = scan(/[^\n#{str_delimiter}\\][^\n#{str_delimiter}$\\]*/)
- tokens << [match, :content]
- elsif match = scan(Regexp.new(str_delimiter))
- tokens << [match, :delimiter]
- tokens << [:close, :string]
- state = :initial
- elsif scan(/\n/)
- tokens << [:close, :string]
- state = :initial
- else
- raise 'String: else-case reached', tokens
- end
- else
- raise 'else-case reached', tokens
- end
- end
-
- return tokens
- end
- end
- end
-end \ No newline at end of file
diff --git a/etc/todo/scanners/clojure-libs.in.clj b/etc/todo/scanners/clojure-libs.in.clj
deleted file mode 100644
index f8a0044..0000000
--- a/etc/todo/scanners/clojure-libs.in.clj
+++ /dev/null
@@ -1,6820 +0,0 @@
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(ns clojure.core)
-
-(def unquote)
-(def unquote-splicing)
-
-(def
- #^{:arglists '([& items])
- :doc "Creates a new list containing the items."}
- list (. clojure.lang.PersistentList creator))
-
-(def
- #^{:arglists '([x seq])
- :doc "Returns a new seq where x is the first element and seq is
- the rest."}
-
- cons (fn* cons [x seq] (. clojure.lang.RT (cons x seq))))
-
-;during bootstrap we don't have destructuring let, loop or fn, will redefine later
-(def
- #^{:macro true}
- let (fn* let [& decl] (cons 'let* decl)))
-
-(def
- #^{:macro true}
- loop (fn* loop [& decl] (cons 'loop* decl)))
-
-(def
- #^{:macro true}
- fn (fn* fn [& decl] (cons 'fn* decl)))
-
-(def
- #^{:arglists '([coll])
- :doc "Returns the first item in the collection. Calls seq on its
- argument. If coll is nil, returns nil."}
- first (fn first [coll] (. clojure.lang.RT (first coll))))
-
-(def
- #^{:arglists '([coll])
- :tag clojure.lang.ISeq
- :doc "Returns a seq of the items after the first. Calls seq on its
- argument. If there are no more items, returns nil."}
- next (fn next [x] (. clojure.lang.RT (next x))))
-
-(def
- #^{:arglists '([coll])
- :tag clojure.lang.ISeq
- :doc "Returns a possibly empty seq of the items after the first. Calls seq on its
- argument."}
- rest (fn rest [x] (. clojure.lang.RT (more x))))
-
-(def
- #^{:arglists '([coll x] [coll x & xs])
- :doc "conj[oin]. Returns a new collection with the xs
- 'added'. (conj nil item) returns (item). The 'addition' may
- happen at different 'places' depending on the concrete type."}
- conj (fn conj
- ([coll x] (. clojure.lang.RT (conj coll x)))
- ([coll x & xs]
- (if xs
- (recur (conj coll x) (first xs) (next xs))
- (conj coll x)))))
-
-(def
- #^{:doc "Same as (first (next x))"
- :arglists '([x])}
- second (fn second [x] (first (next x))))
-
-(def
- #^{:doc "Same as (first (first x))"
- :arglists '([x])}
- ffirst (fn ffirst [x] (first (first x))))
-
-(def
- #^{:doc "Same as (next (first x))"
- :arglists '([x])}
- nfirst (fn nfirst [x] (next (first x))))
-
-(def
- #^{:doc "Same as (first (next x))"
- :arglists '([x])}
- fnext (fn fnext [x] (first (next x))))
-
-(def
- #^{:doc "Same as (next (next x))"
- :arglists '([x])}
- nnext (fn nnext [x] (next (next x))))
-
-(def
- #^{:arglists '([coll])
- :doc "Returns a seq on the collection. If the collection is
- empty, returns nil. (seq nil) returns nil. seq also works on
- Strings, native Java arrays (of reference types) and any objects
- that implement Iterable."
- :tag clojure.lang.ISeq}
- seq (fn seq [coll] (. clojure.lang.RT (seq coll))))
-
-(def
- #^{:arglists '([#^Class c x])
- :doc "Evaluates x and tests if it is an instance of the class
- c. Returns true or false"}
- instance? (fn instance? [#^Class c x] (. c (isInstance x))))
-
-(def
- #^{:arglists '([x])
- :doc "Return true if x implements ISeq"}
- seq? (fn seq? [x] (instance? clojure.lang.ISeq x)))
-
-(def
- #^{:arglists '([x])
- :doc "Return true if x is a String"}
- string? (fn string? [x] (instance? String x)))
-
-(def
- #^{:arglists '([x])
- :doc "Return true if x implements IPersistentMap"}
- map? (fn map? [x] (instance? clojure.lang.IPersistentMap x)))
-
-(def
- #^{:arglists '([x])
- :doc "Return true if x implements IPersistentVector "}
- vector? (fn vector? [x] (instance? clojure.lang.IPersistentVector x)))
-
-(def
- #^{:private true}
- sigs
- (fn [fdecl]
- (if (seq? (first fdecl))
- (loop [ret [] fdecl fdecl]
- (if fdecl
- (recur (conj ret (first (first fdecl))) (next fdecl))
- (seq ret)))
- (list (first fdecl)))))
-
-(def
- #^{:arglists '([map key val] [map key val & kvs])
- :doc "assoc[iate]. When applied to a map, returns a new map of the
- same (hashed/sorted) type, that contains the mapping of key(s) to
- val(s). When applied to a vector, returns a new vector that
- contains val at index. Note - index must be <= (count vector)."}
- assoc
- (fn assoc
- ([map key val] (. clojure.lang.RT (assoc map key val)))
- ([map key val & kvs]
- (let [ret (assoc map key val)]
- (if kvs
- (recur ret (first kvs) (second kvs) (nnext kvs))
- ret)))))
-
-;;;;;;;;;;;;;;;;; metadata ;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(def
- #^{:arglists '([obj])
- :doc "Returns the metadata of obj, returns nil if there is no metadata."}
- meta (fn meta [x]
- (if (instance? clojure.lang.IMeta x)
- (. #^clojure.lang.IMeta x (meta)))))
-
-(def
- #^{:arglists '([#^clojure.lang.IObj obj m])
- :doc "Returns an object of the same type and value as obj, with
- map m as its metadata."}
- with-meta (fn with-meta [#^clojure.lang.IObj x m]
- (. x (withMeta m))))
-
-(def
- #^{:arglists '([coll])
- :doc "Return the last item in coll, in linear time"}
- last (fn last [s]
- (if (next s)
- (recur (next s))
- (first s))))
-
-(def
- #^{:arglists '([coll])
- :doc "Return a seq of all but the last item in coll, in linear time"}
- butlast (fn butlast [s]
- (loop [ret [] s s]
- (if (next s)
- (recur (conj ret (first s)) (next s))
- (seq ret)))))
-
-(def
-
- #^{:doc "Same as (def name (fn [params* ] exprs*)) or (def
- name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
- to the var metadata"
- :arglists '([name doc-string? attr-map? [params*] body]
- [name doc-string? attr-map? ([params*] body)+ attr-map?])}
- defn (fn defn [name & fdecl]
- (let [m (if (string? (first fdecl))
- {:doc (first fdecl)}
- {})
- fdecl (if (string? (first fdecl))
- (next fdecl)
- fdecl)
- m (if (map? (first fdecl))
- (conj m (first fdecl))
- m)
- fdecl (if (map? (first fdecl))
- (next fdecl)
- fdecl)
- fdecl (if (vector? (first fdecl))
- (list fdecl)
- fdecl)
- m (if (map? (last fdecl))
- (conj m (last fdecl))
- m)
- fdecl (if (map? (last fdecl))
- (butlast fdecl)
- fdecl)
- m (conj {:arglists (list 'quote (sigs fdecl))} m)]
- (list 'def (with-meta name (conj (if (meta name) (meta name) {}) m))
- (cons `fn fdecl)))))
-
-(. (var defn) (setMacro))
-
-(defn cast
- "Throws a ClassCastException if x is not a c, else returns x."
- [#^Class c x]
- (. c (cast x)))
-
-(defn to-array
- "Returns an array of Objects containing the contents of coll, which
- can be any Collection. Maps to java.util.Collection.toArray()."
- {:tag "[Ljava.lang.Object;"}
- [coll] (. clojure.lang.RT (toArray coll)))
-
-(defn vector
- "Creates a new vector containing the args."
- ([] [])
- ([& args]
- (. clojure.lang.LazilyPersistentVector (create args))))
-
-(defn vec
- "Creates a new vector containing the contents of coll."
- ([coll]
- (. clojure.lang.LazilyPersistentVector (createOwning (to-array coll)))))
-
-(defn hash-map
- "keyval => key val
- Returns a new hash map with supplied mappings."
- ([] {})
- ([& keyvals]
- (. clojure.lang.PersistentHashMap (create keyvals))))
-
-(defn hash-set
- "Returns a new hash set with supplied keys."
- ([] #{})
- ([& keys]
- (. clojure.lang.PersistentHashSet (create keys))))
-
-(defn sorted-map
- "keyval => key val
- Returns a new sorted map with supplied mappings."
- ([& keyvals]
- (. clojure.lang.PersistentTreeMap (create keyvals))))
-
-(defn sorted-set
- "Returns a new sorted set with supplied keys."
- ([& keys]
- (. clojure.lang.PersistentTreeSet (create keys))))
-
-(defn sorted-map-by
- "keyval => key val
- Returns a new sorted map with supplied mappings, using the supplied comparator."
- ([comparator & keyvals]
- (. clojure.lang.PersistentTreeMap (create comparator keyvals))))
-
-;;;;;;;;;;;;;;;;;;;;
-(def
-
- #^{:doc "Like defn, but the resulting function name is declared as a
- macro and will be used as a macro by the compiler when it is
- called."
- :arglists '([name doc-string? attr-map? [params*] body]
- [name doc-string? attr-map? ([params*] body)+ attr-map?])}
- defmacro (fn [name & args]
- (list 'do
- (cons `defn (cons name args))
- (list '. (list 'var name) '(setMacro))
- (list 'var name))))
-
-(. (var defmacro) (setMacro))
-
-(defmacro when
- "Evaluates test. If logical true, evaluates body in an implicit do."
- [test & body]
- (list 'if test (cons 'do body)))
-
-(defmacro when-not
- "Evaluates test. If logical false, evaluates body in an implicit do."
- [test & body]
- (list 'if test nil (cons 'do body)))
-
-(defn nil?
- "Returns true if x is nil, false otherwise."
- {:tag Boolean}
- [x] (identical? x nil))
-
-(defn false?
- "Returns true if x is the value false, false otherwise."
- {:tag Boolean}
- [x] (identical? x false))
-
-(defn true?
- "Returns true if x is the value true, false otherwise."
- {:tag Boolean}
- [x] (identical? x true))
-
-(defn not
- "Returns true if x is logical false, false otherwise."
- {:tag Boolean}
- [x] (if x false true))
-
-(defn str
- "With no args, returns the empty string. With one arg x, returns
- x.toString(). (str nil) returns the empty string. With more than
- one arg, returns the concatenation of the str values of the args."
- {:tag String}
- ([] "")
- ([#^Object x]
- (if (nil? x) "" (. x (toString))))
- ([x & ys]
- ((fn [#^StringBuilder sb more]
- (if more
- (recur (. sb (append (str (first more)))) (next more))
- (str sb)))
- (new StringBuilder #^String (str x)) ys)))
-
-
-(defn symbol?
- "Return true if x is a Symbol"
- [x] (instance? clojure.lang.Symbol x))
-
-(defn keyword?
- "Return true if x is a Keyword"
- [x] (instance? clojure.lang.Keyword x))
-
-(defn symbol
- "Returns a Symbol with the given namespace and name."
- ([name] (if (symbol? name) name (. clojure.lang.Symbol (intern name))))
- ([ns name] (. clojure.lang.Symbol (intern ns name))))
-
-(defn keyword
- "Returns a Keyword with the given namespace and name. Do not use :
- in the keyword strings, it will be added automatically."
- ([name] (if (keyword? name) name (. clojure.lang.Keyword (intern nil name))))
- ([ns name] (. clojure.lang.Keyword (intern ns name))))
-
-(defn gensym
- "Returns a new symbol with a unique name. If a prefix string is
- supplied, the name is prefix# where # is some unique number. If
- prefix is not supplied, the prefix is 'G__'."
- ([] (gensym "G__"))
- ([prefix-string] (. clojure.lang.Symbol (intern (str prefix-string (str (. clojure.lang.RT (nextID))))))))
-
-(defmacro cond
- "Takes a set of test/expr pairs. It evaluates each test one at a
- time. If a test returns logical true, cond evaluates and returns
- the value of the corresponding expr and doesn't evaluate any of the
- other tests or exprs. (cond) returns nil."
- [& clauses]
- (when clauses
- (list 'if (first clauses)
- (if (next clauses)
- (second clauses)
- (throw (IllegalArgumentException.
- "cond requires an even number of forms")))
- (cons 'clojure.core/cond (next (next clauses))))))
-
-(defn spread
- {:private true}
- [arglist]
- (cond
- (nil? arglist) nil
- (nil? (next arglist)) (seq (first arglist))
- :else (cons (first arglist) (spread (next arglist)))))
-
-(defn apply
- "Applies fn f to the argument list formed by prepending args to argseq."
- {:arglists '([f args* argseq])}
- [#^clojure.lang.IFn f & args]
- (. f (applyTo (spread args))))
-
-(defn vary-meta
- "Returns an object of the same type and value as obj, with
- (apply f (meta obj) args) as its metadata."
- [obj f & args]
- (with-meta obj (apply f (meta obj) args)))
-
-(defn list*
- "Creates a new list containing the item prepended to more."
- [item & more]
- (spread (cons item more)))
-
-(defmacro lazy-seq
- "Takes a body of expressions that returns an ISeq or nil, and yields
- a Seqable object that will invoke the body only the first time seq
- is called, and will cache the result and return it on all subsequent
- seq calls."
- [& body]
- (list 'new 'clojure.lang.LazySeq (list* '#^{:once true} fn* [] body)))
-
-(defn concat
- "Returns a lazy seq representing the concatenation of the elements in the supplied colls."
- ([] (lazy-seq nil))
- ([x] (lazy-seq x))
- ([x y]
- (lazy-seq
- (let [s (seq x)]
- (if s
- (cons (first s) (concat (rest s) y))
- y))))
- ([x y & zs]
- (let [cat (fn cat [xys zs]
- (lazy-seq
- (let [xys (seq xys)]
- (if xys
- (cons (first xys) (cat (rest xys) zs))
- (when zs
- (cat (first zs) (next zs)))))))]
- (cat (concat x y) zs))))
-
-;;;;;;;;;;;;;;;;at this point all the support for syntax-quote exists;;;;;;;;;;;;;;;;;;;;;;
-
-
-(defmacro delay
- "Takes a body of expressions and yields a Delay object that will
- invoke the body only the first time it is forced (with force), and
- will cache the result and return it on all subsequent force
- calls."
- [& body]
- (list 'new 'clojure.lang.Delay (list* `#^{:once true} fn* [] body)))
-
-(defn delay?
- "returns true if x is a Delay created with delay"
- [x] (instance? clojure.lang.Delay x))
-
-(defn force
- "If x is a Delay, returns the (possibly cached) value of its expression, else returns x"
- [x] (. clojure.lang.Delay (force x)))
-
-(defmacro if-not
- "Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil."
- ([test then] `(if-not ~test ~then nil))
- ([test then else]
- `(if (not ~test) ~then ~else)))
-
-(defn =
- "Equality. Returns true if x equals y, false if not. Same as
- Java x.equals(y) except it also works for nil, and compares
- numbers and collections in a type-independent manner. Clojure's immutable data
- structures define equals() (and thus =) as a value, not an identity,
- comparison."
- {:tag Boolean
- :inline (fn [x y] `(. clojure.lang.Util equiv ~x ~y))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (clojure.lang.Util/equiv x y))
- ([x y & more]
- (if (= x y)
- (if (next more)
- (recur y (first more) (next more))
- (= y (first more)))
- false)))
-
-(defn not=
- "Same as (not (= obj1 obj2))"
- {:tag Boolean}
- ([x] false)
- ([x y] (not (= x y)))
- ([x y & more]
- (not (apply = x y more))))
-
-
-
-(defn compare
- "Comparator. Returns 0 if x equals y, -1 if x is logically 'less
- than' y, else 1. Same as Java x.compareTo(y) except it also works
- for nil, and compares numbers and collections in a type-independent
- manner. x must implement Comparable"
- {:tag Integer
- :inline (fn [x y] `(. clojure.lang.Util compare ~x ~y))}
- [x y] (. clojure.lang.Util (compare x y)))
-
-(defmacro and
- "Evaluates exprs one at a time, from left to right. If a form
- returns logical false (nil or false), and returns that value and
- doesn't evaluate any of the other expressions, otherwise it returns
- the value of the last expr. (and) returns true."
- ([] true)
- ([x] x)
- ([x & next]
- `(let [and# ~x]
- (if and# (and ~@next) and#))))
-
-(defmacro or
- "Evaluates exprs one at a time, from left to right. If a form
- returns a logical true value, or returns that value and doesn't
- evaluate any of the other expressions, otherwise it returns the
- value of the last expression. (or) returns nil."
- ([] nil)
- ([x] x)
- ([x & next]
- `(let [or# ~x]
- (if or# or# (or ~@next)))))
-
-;;;;;;;;;;;;;;;;;;; sequence fns ;;;;;;;;;;;;;;;;;;;;;;;
-(defn reduce
- "f should be a function of 2 arguments. If val is not supplied,
- returns the result of applying f to the first 2 items in coll, then
- applying f to that result and the 3rd item, etc. If coll contains no
- items, f must accept no arguments as well, and reduce returns the
- result of calling f with no arguments. If coll has only 1 item, it
- is returned and f is not called. If val is supplied, returns the
- result of applying f to val and the first item in coll, then
- applying f to that result and the 2nd item, etc. If coll contains no
- items, returns val and f is not called."
- ([f coll]
- (let [s (seq coll)]
- (if s
- (if (instance? clojure.lang.IReduce s)
- (. #^clojure.lang.IReduce s (reduce f))
- (reduce f (first s) (next s)))
- (f))))
- ([f val coll]
- (let [s (seq coll)]
- (if (instance? clojure.lang.IReduce s)
- (. #^clojure.lang.IReduce s (reduce f val))
- ((fn [f val s]
- (if s
- (recur f (f val (first s)) (next s))
- val))
- f val s)))))
-
-(defn reverse
- "Returns a seq of the items in coll in reverse order. Not lazy."
- [coll]
- (reduce conj () coll))
-
-;;math stuff
-(defn +
- "Returns the sum of nums. (+) returns 0."
- {:inline (fn [x y] `(. clojure.lang.Numbers (add ~x ~y)))
- :inline-arities #{2}}
- ([] 0)
- ([x] (cast Number x))
- ([x y] (. clojure.lang.Numbers (add x y)))
- ([x y & more]
- (reduce + (+ x y) more)))
-
-(defn *
- "Returns the product of nums. (*) returns 1."
- {:inline (fn [x y] `(. clojure.lang.Numbers (multiply ~x ~y)))
- :inline-arities #{2}}
- ([] 1)
- ([x] (cast Number x))
- ([x y] (. clojure.lang.Numbers (multiply x y)))
- ([x y & more]
- (reduce * (* x y) more)))
-
-(defn /
- "If no denominators are supplied, returns 1/numerator,
- else returns numerator divided by all of the denominators."
- {:inline (fn [x y] `(. clojure.lang.Numbers (divide ~x ~y)))
- :inline-arities #{2}}
- ([x] (/ 1 x))
- ([x y] (. clojure.lang.Numbers (divide x y)))
- ([x y & more]
- (reduce / (/ x y) more)))
-
-(defn -
- "If no ys are supplied, returns the negation of x, else subtracts
- the ys from x and returns the result."
- {:inline (fn [& args] `(. clojure.lang.Numbers (minus ~@args)))
- :inline-arities #{1 2}}
- ([x] (. clojure.lang.Numbers (minus x)))
- ([x y] (. clojure.lang.Numbers (minus x y)))
- ([x y & more]
- (reduce - (- x y) more)))
-
-(defn <
- "Returns non-nil if nums are in monotonically increasing order,
- otherwise false."
- {:inline (fn [x y] `(. clojure.lang.Numbers (lt ~x ~y)))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (. clojure.lang.Numbers (lt x y)))
- ([x y & more]
- (if (< x y)
- (if (next more)
- (recur y (first more) (next more))
- (< y (first more)))
- false)))
-
-(defn <=
- "Returns non-nil if nums are in monotonically non-decreasing order,
- otherwise false."
- {:inline (fn [x y] `(. clojure.lang.Numbers (lte ~x ~y)))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (. clojure.lang.Numbers (lte x y)))
- ([x y & more]
- (if (<= x y)
- (if (next more)
- (recur y (first more) (next more))
- (<= y (first more)))
- false)))
-
-(defn >
- "Returns non-nil if nums are in monotonically decreasing order,
- otherwise false."
- {:inline (fn [x y] `(. clojure.lang.Numbers (gt ~x ~y)))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (. clojure.lang.Numbers (gt x y)))
- ([x y & more]
- (if (> x y)
- (if (next more)
- (recur y (first more) (next more))
- (> y (first more)))
- false)))
-
-(defn >=
- "Returns non-nil if nums are in monotonically non-increasing order,
- otherwise false."
- {:inline (fn [x y] `(. clojure.lang.Numbers (gte ~x ~y)))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (. clojure.lang.Numbers (gte x y)))
- ([x y & more]
- (if (>= x y)
- (if (next more)
- (recur y (first more) (next more))
- (>= y (first more)))
- false)))
-
-(defn ==
- "Returns non-nil if nums all have the same value, otherwise false"
- {:inline (fn [x y] `(. clojure.lang.Numbers (equiv ~x ~y)))
- :inline-arities #{2}}
- ([x] true)
- ([x y] (. clojure.lang.Numbers (equiv x y)))
- ([x y & more]
- (if (== x y)
- (if (next more)
- (recur y (first more) (next more))
- (== y (first more)))
- false)))
-
-(defn max
- "Returns the greatest of the nums."
- ([x] x)
- ([x y] (if (> x y) x y))
- ([x y & more]
- (reduce max (max x y) more)))
-
-(defn min
- "Returns the least of the nums."
- ([x] x)
- ([x y] (if (< x y) x y))
- ([x y & more]
- (reduce min (min x y) more)))
-
-(defn inc
- "Returns a number one greater than num."
- {:inline (fn [x] `(. clojure.lang.Numbers (inc ~x)))}
- [x] (. clojure.lang.Numbers (inc x)))
-
-(defn dec
- "Returns a number one less than num."
- {:inline (fn [x] `(. clojure.lang.Numbers (dec ~x)))}
- [x] (. clojure.lang.Numbers (dec x)))
-
-(defn unchecked-inc
- "Returns a number one greater than x, an int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_inc ~x)))}
- [x] (. clojure.lang.Numbers (unchecked_inc x)))
-
-(defn unchecked-dec
- "Returns a number one less than x, an int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_dec ~x)))}
- [x] (. clojure.lang.Numbers (unchecked_dec x)))
-
-(defn unchecked-negate
- "Returns the negation of x, an int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_negate ~x)))}
- [x] (. clojure.lang.Numbers (unchecked_negate x)))
-
-(defn unchecked-add
- "Returns the sum of x and y, both int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_add ~x ~y)))}
- [x y] (. clojure.lang.Numbers (unchecked_add x y)))
-
-(defn unchecked-subtract
- "Returns the difference of x and y, both int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_subtract ~x ~y)))}
- [x y] (. clojure.lang.Numbers (unchecked_subtract x y)))
-
-(defn unchecked-multiply
- "Returns the product of x and y, both int or long.
- Note - uses a primitive operator subject to overflow."
- {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_multiply ~x ~y)))}
- [x y] (. clojure.lang.Numbers (unchecked_multiply x y)))
-
-(defn unchecked-divide
- "Returns the division of x by y, both int or long.
- Note - uses a primitive operator subject to truncation."
- {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_divide ~x ~y)))}
- [x y] (. clojure.lang.Numbers (unchecked_divide x y)))
-
-(defn unchecked-remainder
- "Returns the remainder of division of x by y, both int or long.
- Note - uses a primitive operator subject to truncation."
- {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_remainder ~x ~y)))}
- [x y] (. clojure.lang.Numbers (unchecked_remainder x y)))
-
-(defn pos?
- "Returns true if num is greater than zero, else false"
- {:tag Boolean
- :inline (fn [x] `(. clojure.lang.Numbers (isPos ~x)))}
- [x] (. clojure.lang.Numbers (isPos x)))
-
-(defn neg?
- "Returns true if num is less than zero, else false"
- {:tag Boolean
- :inline (fn [x] `(. clojure.lang.Numbers (isNeg ~x)))}
- [x] (. clojure.lang.Numbers (isNeg x)))
-
-(defn zero?
- "Returns true if num is zero, else false"
- {:tag Boolean
- :inline (fn [x] `(. clojure.lang.Numbers (isZero ~x)))}
- [x] (. clojure.lang.Numbers (isZero x)))
-
-(defn quot
- "quot[ient] of dividing numerator by denominator."
- [num div]
- (. clojure.lang.Numbers (quotient num div)))
-
-(defn rem
- "remainder of dividing numerator by denominator."
- [num div]
- (. clojure.lang.Numbers (remainder num div)))
-
-(defn rationalize
- "returns the rational value of num"
- [num]
- (. clojure.lang.Numbers (rationalize num)))
-
-;;Bit ops
-
-(defn bit-not
- "Bitwise complement"
- {:inline (fn [x] `(. clojure.lang.Numbers (not ~x)))}
- [x] (. clojure.lang.Numbers not x))
-
-
-(defn bit-and
- "Bitwise and"
- {:inline (fn [x y] `(. clojure.lang.Numbers (and ~x ~y)))}
- [x y] (. clojure.lang.Numbers and x y))
-
-(defn bit-or
- "Bitwise or"
- {:inline (fn [x y] `(. clojure.lang.Numbers (or ~x ~y)))}
- [x y] (. clojure.lang.Numbers or x y))
-
-(defn bit-xor
- "Bitwise exclusive or"
- {:inline (fn [x y] `(. clojure.lang.Numbers (xor ~x ~y)))}
- [x y] (. clojure.lang.Numbers xor x y))
-
-(defn bit-and-not
- "Bitwise and with complement"
- [x y] (. clojure.lang.Numbers andNot x y))
-
-
-(defn bit-clear
- "Clear bit at index n"
- [x n] (. clojure.lang.Numbers clearBit x n))
-
-(defn bit-set
- "Set bit at index n"
- [x n] (. clojure.lang.Numbers setBit x n))
-
-(defn bit-flip
- "Flip bit at index n"
- [x n] (. clojure.lang.Numbers flipBit x n))
-
-(defn bit-test
- "Test bit at index n"
- [x n] (. clojure.lang.Numbers testBit x n))
-
-
-(defn bit-shift-left
- "Bitwise shift left"
- [x n] (. clojure.lang.Numbers shiftLeft x n))
-
-(defn bit-shift-right
- "Bitwise shift right"
- [x n] (. clojure.lang.Numbers shiftRight x n))
-
-(defn even?
- "Returns true if n is even, throws an exception if n is not an integer"
- [n] (zero? (bit-and n 1)))
-
-(defn odd?
- "Returns true if n is odd, throws an exception if n is not an integer"
- [n] (not (even? n)))
-
-
-;;
-
-(defn complement
- "Takes a fn f and returns a fn that takes the same arguments as f,
- has the same effects, if any, and returns the opposite truth value."
- [f]
- (fn
- ([] (not (f)))
- ([x] (not (f x)))
- ([x y] (not (f x y)))
- ([x y & zs] (not (apply f x y zs)))))
-
-(defn constantly
- "Returns a function that takes any number of arguments and returns x."
- [x] (fn [& args] x))
-
-(defn identity
- "Returns its argument."
- [x] x)
-
-;;Collection stuff
-
-
-
-(defn count
- "Returns the number of items in the collection. (count nil) returns
- 0. Also works on strings, arrays, and Java Collections and Maps"
- [coll] (. clojure.lang.RT (count coll)))
-
-;;list stuff
-(defn peek
- "For a list or queue, same as first, for a vector, same as, but much
- more efficient than, last. If the collection is empty, returns nil."
- [coll] (. clojure.lang.RT (peek coll)))
-
-(defn pop
- "For a list or queue, returns a new list/queue without the first
- item, for a vector, returns a new vector without the last item. If
- the collection is empty, throws an exception. Note - not the same
- as next/butlast."
- [coll] (. clojure.lang.RT (pop coll)))
-
-(defn nth
- "Returns the value at the index. get returns nil if index out of
- bounds, nth throws an exception unless not-found is supplied. nth
- also works for strings, Java arrays, regex Matchers and Lists, and,
- in O(n) time, for sequences."
- ([coll index] (. clojure.lang.RT (nth coll index)))
- ([coll index not-found] (. clojure.lang.RT (nth coll index not-found))))
-
-;;map stuff
-
-(defn contains?
- "Returns true if key is present in the given collection, otherwise
- returns false. Note that for numerically indexed collections like
- vectors and Java arrays, this tests if the numeric key is within the
- range of indexes. 'contains?' operates constant or logarithmic time;
- it will not perform a linear search for a value. See also 'some'."
- [coll key] (. clojure.lang.RT (contains coll key)))
-
-(defn get
- "Returns the value mapped to key, not-found or nil if key not present."
- ([map key]
- (. clojure.lang.RT (get map key)))
- ([map key not-found]
- (. clojure.lang.RT (get map key not-found))))
-
-(defn dissoc
- "dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
- that does not contain a mapping for key(s)."
- ([map] map)
- ([map key]
- (. clojure.lang.RT (dissoc map key)))
- ([map key & ks]
- (let [ret (dissoc map key)]
- (if ks
- (recur ret (first ks) (next ks))
- ret))))
-
-(defn disj
- "disj[oin]. Returns a new set of the same (hashed/sorted) type, that
- does not contain key(s)."
- ([set] set)
- ([#^clojure.lang.IPersistentSet set key]
- (. set (disjoin key)))
- ([set key & ks]
- (let [ret (disj set key)]
- (if ks
- (recur ret (first ks) (next ks))
- ret))))
-
-(defn find
- "Returns the map entry for key, or nil if key not present."
- [map key] (. clojure.lang.RT (find map key)))
-
-(defn select-keys
- "Returns a map containing only those entries in map whose key is in keys"
- [map keyseq]
- (loop [ret {} keys (seq keyseq)]
- (if keys
- (let [entry (. clojure.lang.RT (find map (first keys)))]
- (recur
- (if entry
- (conj ret entry)
- ret)
- (next keys)))
- ret)))
-
-(defn keys
- "Returns a sequence of the map's keys."
- [map] (. clojure.lang.RT (keys map)))
-
-(defn vals
- "Returns a sequence of the map's values."
- [map] (. clojure.lang.RT (vals map)))
-
-(defn key
- "Returns the key of the map entry."
- [#^java.util.Map$Entry e]
- (. e (getKey)))
-
-(defn val
- "Returns the value in the map entry."
- [#^java.util.Map$Entry e]
- (. e (getValue)))
-
-(defn rseq
- "Returns, in constant time, a seq of the items in rev (which
- can be a vector or sorted-map), in reverse order. If rev is empty returns nil"
- [#^clojure.lang.Reversible rev]
- (. rev (rseq)))
-
-(defn name
- "Returns the name String of a symbol or keyword."
- {:tag String}
- [#^clojure.lang.Named x]
- (. x (getName)))
-
-(defn namespace
- "Returns the namespace String of a symbol or keyword, or nil if not present."
- {:tag String}
- [#^clojure.lang.Named x]
- (. x (getNamespace)))
-
-(defmacro locking
- "Executes exprs in an implicit do, while holding the monitor of x.
- Will release the monitor of x in all circumstances."
- [x & body]
- `(let [lockee# ~x]
- (try
- (monitor-enter lockee#)
- ~@body
- (finally
- (monitor-exit lockee#)))))
-
-(defmacro ..
- "form => fieldName-symbol or (instanceMethodName-symbol args*)
-
- Expands into a member access (.) of the first member on the first
- argument, followed by the next member on the result, etc. For
- instance:
-
- (.. System (getProperties) (get \"os.name\"))
-
- expands to:
-
- (. (. System (getProperties)) (get \"os.name\"))
-
- but is easier to write, read, and understand."
- ([x form] `(. ~x ~form))
- ([x form & more] `(.. (. ~x ~form) ~@more)))
-
-(defmacro ->
- "Threads the expr through the forms. Inserts x as the
- second item in the first form, making a list of it if it is not a
- list already. If there are more forms, inserts the first form as the
- second item in second form, etc."
- ([x form] (if (seq? form)
- `(~(first form) ~x ~@(next form))
- (list form x)))
- ([x form & more] `(-> (-> ~x ~form) ~@more)))
-
-;;multimethods
-(def global-hierarchy)
-
-(defmacro defmulti
- "Creates a new multimethod with the associated dispatch function.
- The docstring and attribute-map are optional.
-
- Options are key-value pairs and may be one of:
- :default the default dispatch value, defaults to :default
- :hierarchy the isa? hierarchy to use for dispatching
- defaults to the global hierarchy"
- {:arglists '([name docstring? attr-map? dispatch-fn & options])}
- [mm-name & options]
- (let [docstring (if (string? (first options))
- (first options)
- nil)
- options (if (string? (first options))
- (next options)
- options)
- m (if (map? (first options))
- (first options)
- {})
- options (if (map? (first options))
- (next options)
- options)
- dispatch-fn (first options)
- options (next options)
- m (assoc m :tag 'clojure.lang.MultiFn)
- m (if docstring
- (assoc m :doc docstring)
- m)
- m (if (meta mm-name)
- (conj (meta mm-name) m)
- m)]
- (when (= (count options) 1)
- (throw (Exception. "The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)")))
- (let [options (apply hash-map options)
- default (get options :default :default)
- hierarchy (get options :hierarchy #'global-hierarchy)]
- `(def ~(with-meta mm-name m)
- (new clojure.lang.MultiFn ~(name mm-name) ~dispatch-fn ~default ~hierarchy)))))
-
-(defmacro defmethod
- "Creates and installs a new method of multimethod associated with dispatch-value. "
- [multifn dispatch-val & fn-tail]
- `(. ~multifn addMethod ~dispatch-val (fn ~@fn-tail)))
-
-(defn remove-method
- "Removes the method of multimethod associated with dispatch-value."
- [#^clojure.lang.MultiFn multifn dispatch-val]
- (. multifn removeMethod dispatch-val))
-
-(defn prefer-method
- "Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y when there is a conflict"
- [#^clojure.lang.MultiFn multifn dispatch-val-x dispatch-val-y]
- (. multifn preferMethod dispatch-val-x dispatch-val-y))
-
-(defn methods
- "Given a multimethod, returns a map of dispatch values -> dispatch fns"
- [#^clojure.lang.MultiFn multifn] (.getMethodTable multifn))
-
-(defn get-method
- "Given a multimethod and a dispatch value, returns the dispatch fn
- that would apply to that value, or nil if none apply and no default"
- [#^clojure.lang.MultiFn multifn dispatch-val] (.getMethod multifn dispatch-val))
-
-(defn prefers
- "Given a multimethod, returns a map of preferred value -> set of other values"
- [#^clojure.lang.MultiFn multifn] (.getPreferTable multifn))
-
-;;;;;;;;; var stuff
-
-(defmacro #^{:private true} assert-args [fnname & pairs]
- `(do (when-not ~(first pairs)
- (throw (IllegalArgumentException.
- ~(str fnname " requires " (second pairs)))))
- ~(let [more (nnext pairs)]
- (when more
- (list* `assert-args fnname more)))))
-
-(defmacro if-let
- "bindings => binding-form test
-
- If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
- ([bindings then]
- `(if-let ~bindings ~then nil))
- ([bindings then else & oldform]
- (assert-args if-let
- (and (vector? bindings) (nil? oldform)) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [form (bindings 0) tst (bindings 1)]
- `(let [temp# ~tst]
- (if temp#
- (let [~form temp#]
- ~then)
- ~else)))))
-
-(defmacro when-let
- "bindings => binding-form test
-
- When test is true, evaluates body with binding-form bound to the value of test"
- [bindings & body]
- (assert-args when-let
- (vector? bindings) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [form (bindings 0) tst (bindings 1)]
- `(let [temp# ~tst]
- (when temp#
- (let [~form temp#]
- ~@body)))))
-
-(defmacro binding
- "binding => var-symbol init-expr
-
- Creates new bindings for the (already-existing) vars, with the
- supplied initial values, executes the exprs in an implicit do, then
- re-establishes the bindings that existed before."
- [bindings & body]
- (assert-args binding
- (vector? bindings) "a vector for its binding"
- (even? (count bindings)) "an even number of forms in binding vector")
- (let [var-ize (fn [var-vals]
- (loop [ret [] vvs (seq var-vals)]
- (if vvs
- (recur (conj (conj ret `(var ~(first vvs))) (second vvs))
- (next (next vvs)))
- (seq ret))))]
- `(do
- (. clojure.lang.Var (pushThreadBindings (hash-map ~@(var-ize bindings))))
- (try
- ~@body
- (finally
- (. clojure.lang.Var (popThreadBindings)))))))
-
-(defn find-var
- "Returns the global var named by the namespace-qualified symbol, or
- nil if no var with that name."
- [sym] (. clojure.lang.Var (find sym)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Refs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defn #^{:private true}
- setup-reference [#^clojure.lang.ARef r options]
- (let [opts (apply hash-map options)]
- (when (:meta opts)
- (.resetMeta r (:meta opts)))
- (when (:validator opts)
- (.setValidator r (:validator opts)))
- r))
-
-(defn agent
- "Creates and returns an agent with an initial value of state and
- zero or more options (in any order):
-
- :meta metadata-map
-
- :validator validate-fn
-
- If metadata-map is supplied, it will be come the metadata on the
- agent. validate-fn must be nil or a side-effect-free fn of one
- argument, which will be passed the intended new state on any state
- change. If the new state is unacceptable, the validate-fn should
- return false or throw an exception."
- ([state] (new clojure.lang.Agent state))
- ([state & options]
- (setup-reference (agent state) options)))
-
-(defn send
- "Dispatch an action to an agent. Returns the agent immediately.
- Subsequently, in a thread from a thread pool, the state of the agent
- will be set to the value of:
-
- (apply action-fn state-of-agent args)"
- [#^clojure.lang.Agent a f & args]
- (. a (dispatch f args false)))
-
-(defn send-off
- "Dispatch a potentially blocking action to an agent. Returns the
- agent immediately. Subsequently, in a separate thread, the state of
- the agent will be set to the value of:
-
- (apply action-fn state-of-agent args)"
- [#^clojure.lang.Agent a f & args]
- (. a (dispatch f args true)))
-
-(defn release-pending-sends
- "Normally, actions sent directly or indirectly during another action
- are held until the action completes (changes the agent's
- state). This function can be used to dispatch any pending sent
- actions immediately. This has no impact on actions sent during a
- transaction, which are still held until commit. If no action is
- occurring, does nothing. Returns the number of actions dispatched."
- [] (clojure.lang.Agent/releasePendingSends))
-
-(defn add-watch
- "Experimental.
- Adds a watch function to an agent/atom/var/ref reference. The watch
- fn must be a fn of 4 args: a key, the reference, its old-state, its
- new-state. Whenever the reference's state might have been changed,
- any registered watches will have their functions called. The watch fn
- will be called synchronously, on the agent's thread if an agent,
- before any pending sends if agent or ref. Note that an atom's or
- ref's state may have changed again prior to the fn call, so use
- old/new-state rather than derefing the reference. Note also that watch
- fns may be called from multiple threads simultaneously. Var watchers
- are triggered only by root binding changes, not thread-local
- set!s. Keys must be unique per reference, and can be used to remove
- the watch with remove-watch, but are otherwise considered opaque by
- the watch mechanism."
- [#^clojure.lang.IRef reference key fn] (.addWatch reference key fn))
-
-(defn remove-watch
- "Experimental.
- Removes a watch (set by add-watch) from a reference"
- [#^clojure.lang.IRef reference key]
- (.removeWatch reference key))
-
-(defn add-watcher
- "Experimental.
- Adds a watcher to an agent/atom/var/ref reference. The watcher must
- be an Agent, and the action a function of the agent's state and one
- additional arg, the reference. Whenever the reference's state
- changes, any registered watchers will have their actions
- sent. send-type must be one of :send or :send-off. The actions will
- be sent after the reference's state is changed. Var watchers are
- triggered only by root binding changes, not thread-local set!s"
- [#^clojure.lang.IRef reference send-type watcher-agent action-fn]
- (add-watch reference watcher-agent
- (fn [watcher-agent reference old-state new-state]
- (when-not (identical? old-state new-state)
- ((if (= send-type :send-off) send-off send)
- watcher-agent action-fn reference)))))
-
-(defn remove-watcher
- "Experimental.
- Removes a watcher (set by add-watcher) from a reference"
- [reference watcher-agent]
- (remove-watch reference watcher-agent))
-
-(defn agent-errors
- "Returns a sequence of the exceptions thrown during asynchronous
- actions of the agent."
- [#^clojure.lang.Agent a] (. a (getErrors)))
-
-(defn clear-agent-errors
- "Clears any exceptions thrown during asynchronous actions of the
- agent, allowing subsequent actions to occur."
- [#^clojure.lang.Agent a] (. a (clearErrors)))
-
-(defn shutdown-agents
- "Initiates a shutdown of the thread pools that back the agent
- system. Running actions will complete, but no new actions will be
- accepted"
- [] (. clojure.lang.Agent shutdown))
-
-(defn ref
- "Creates and returns a Ref with an initial value of x and zero or
- more options (in any order):
-
- :meta metadata-map
-
- :validator validate-fn
-
- If metadata-map is supplied, it will be come the metadata on the
- ref. validate-fn must be nil or a side-effect-free fn of one
- argument, which will be passed the intended new state on any state
- change. If the new state is unacceptable, the validate-fn should
- return false or throw an exception. validate-fn will be called on
- transaction commit, when all refs have their final values."
- ([x] (new clojure.lang.Ref x))
- ([x & options] (setup-reference (ref x) options)))
-
-(defn deref
- "Also reader macro: @ref/@agent/@var/@atom/@delay/@future. Within a transaction,
- returns the in-transaction-value of ref, else returns the
- most-recently-committed value of ref. When applied to a var, agent
- or atom, returns its current state. When applied to a delay, forces
- it if not already forced. When applied to a future, will block if
- computation not complete"
- [#^clojure.lang.IDeref ref] (.deref ref))
-
-(defn atom
- "Creates and returns an Atom with an initial value of x and zero or
- more options (in any order):
-
- :meta metadata-map
-
- :validator validate-fn
-
- If metadata-map is supplied, it will be come the metadata on the
- atom. validate-fn must be nil or a side-effect-free fn of one
- argument, which will be passed the intended new state on any state
- change. If the new state is unacceptable, the validate-fn should
- return false or throw an exception."
- ([x] (new clojure.lang.Atom x))
- ([x & options] (setup-reference (atom x) options)))
-
-(defn swap!
- "Atomically swaps the value of atom to be:
- (apply f current-value-of-atom args). Note that f may be called
- multiple times, and thus should be free of side effects. Returns
- the value that was swapped in."
- ([#^clojure.lang.Atom atom f] (.swap atom f))
- ([#^clojure.lang.Atom atom f x] (.swap atom f x))
- ([#^clojure.lang.Atom atom f x y] (.swap atom f x y))
- ([#^clojure.lang.Atom atom f x y & args] (.swap atom f x y args)))
-
-(defn compare-and-set!
- "Atomically sets the value of atom to newval if and only if the
- current value of the atom is identical to oldval. Returns true if
- set happened, else false"
- [#^clojure.lang.Atom atom oldval newval] (.compareAndSet atom oldval newval))
-
-(defn reset!
- "Sets the value of atom to newval without regard for the
- current value. Returns newval."
- [#^clojure.lang.Atom atom newval] (.reset atom newval))
-
-(defn set-validator!
- "Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a
- side-effect-free fn of one argument, which will be passed the intended
- new state on any state change. If the new state is unacceptable, the
- validator-fn should return false or throw an exception. If the current state (root
- value if var) is not acceptable to the new validator, an exception
- will be thrown and the validator will not be changed."
- [#^clojure.lang.IRef iref validator-fn] (. iref (setValidator validator-fn)))
-
-(defn get-validator
- "Gets the validator-fn for a var/ref/agent/atom."
- [#^clojure.lang.IRef iref] (. iref (getValidator)))
-
-(defn alter-meta!
- "Atomically sets the metadata for a namespace/var/ref/agent/atom to be:
-
- (apply f its-current-meta args)
-
- f must be free of side-effects"
- [#^clojure.lang.IReference iref f & args] (.alterMeta iref f args))
-
-(defn reset-meta!
- "Atomically resets the metadata for a namespace/var/ref/agent/atom"
- [#^clojure.lang.IReference iref metadata-map] (.resetMeta iref metadata-map))
-
-(defn commute
- "Must be called in a transaction. Sets the in-transaction-value of
- ref to:
-
- (apply fun in-transaction-value-of-ref args)
-
- and returns the in-transaction-value of ref.
-
- At the commit point of the transaction, sets the value of ref to be:
-
- (apply fun most-recently-committed-value-of-ref args)
-
- Thus fun should be commutative, or, failing that, you must accept
- last-one-in-wins behavior. commute allows for more concurrency than
- ref-set."
-
- [#^clojure.lang.Ref ref fun & args]
- (. ref (commute fun args)))
-
-(defn alter
- "Must be called in a transaction. Sets the in-transaction-value of
- ref to:
-
- (apply fun in-transaction-value-of-ref args)
-
- and returns the in-transaction-value of ref."
- [#^clojure.lang.Ref ref fun & args]
- (. ref (alter fun args)))
-
-(defn ref-set
- "Must be called in a transaction. Sets the value of ref.
- Returns val."
- [#^clojure.lang.Ref ref val]
- (. ref (set val)))
-
-(defn ensure
- "Must be called in a transaction. Protects the ref from modification
- by other transactions. Returns the in-transaction-value of
- ref. Allows for more concurrency than (ref-set ref @ref)"
- [#^clojure.lang.Ref ref]
- (. ref (touch))
- (. ref (deref)))
-
-(defmacro sync
- "transaction-flags => TBD, pass nil for now
-
- Runs the exprs (in an implicit do) in a transaction that encompasses
- exprs and any nested calls. Starts a transaction if none is already
- running on this thread. Any uncaught exception will abort the
- transaction and flow out of sync. The exprs may be run more than
- once, but any effects on Refs will be atomic."
- [flags-ignored-for-now & body]
- `(. clojure.lang.LockingTransaction
- (runInTransaction (fn [] ~@body))))
-
-
-(defmacro io!
- "If an io! block occurs in a transaction, throws an
- IllegalStateException, else runs body in an implicit do. If the
- first expression in body is a literal string, will use that as the
- exception message."
- [& body]
- (let [message (when (string? (first body)) (first body))
- body (if message (next body) body)]
- `(if (clojure.lang.LockingTransaction/isRunning)
- (throw (new IllegalStateException ~(or message "I/O in transaction")))
- (do ~@body))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fn stuff ;;;;;;;;;;;;;;;;
-
-
-(defn comp
- "Takes a set of functions and returns a fn that is the composition
- of those fns. The returned fn takes a variable number of args,
- applies the rightmost of fns to the args, the next
- fn (right-to-left) to the result, etc."
- [& fs]
- (let [fs (reverse fs)]
- (fn [& args]
- (loop [ret (apply (first fs) args) fs (next fs)]
- (if fs
- (recur ((first fs) ret) (next fs))
- ret)))))
-
-(defn partial
- "Takes a function f and fewer than the normal arguments to f, and
- returns a fn that takes a variable number of additional args. When
- called, the returned function calls f with args + additional args."
- ([f arg1]
- (fn [& args] (apply f arg1 args)))
- ([f arg1 arg2]
- (fn [& args] (apply f arg1 arg2 args)))
- ([f arg1 arg2 arg3]
- (fn [& args] (apply f arg1 arg2 arg3 args)))
- ([f arg1 arg2 arg3 & more]
- (fn [& args] (apply f arg1 arg2 arg3 (concat more args)))))
-
-;;;;;;;;;;;;;;;;;;; sequence fns ;;;;;;;;;;;;;;;;;;;;;;;
-(defn stream?
- "Returns true if x is an instance of Stream"
- [x] (instance? clojure.lang.Stream x))
-
-
-(defn sequence
- "Coerces coll to a (possibly empty) sequence, if it is not already
- one. Will not force a lazy seq. (sequence nil) yields ()"
- [coll]
- (cond
- (seq? coll) coll
- (stream? coll) (.sequence #^clojure.lang.Stream coll)
- :else (or (seq coll) ())))
-
-(defn every?
- "Returns true if (pred x) is logical true for every x in coll, else
- false."
- {:tag Boolean}
- [pred coll]
- (if (seq coll)
- (and (pred (first coll))
- (recur pred (next coll)))
- true))
-
-(def
- #^{:tag Boolean
- :doc "Returns false if (pred x) is logical true for every x in
- coll, else true."
- :arglists '([pred coll])}
- not-every? (comp not every?))
-
-(defn some
- "Returns the first logical true value of (pred x) for any x in coll,
- else nil. One common idiom is to use a set as pred, for example
- this will return true if :fred is in the sequence, otherwise nil:
- (some #{:fred} coll)"
- [pred coll]
- (when (seq coll)
- (or (pred (first coll)) (recur pred (next coll)))))
-
-(def
- #^{:tag Boolean
- :doc "Returns false if (pred x) is logical true for any x in coll,
- else true."
- :arglists '([pred coll])}
- not-any? (comp not some))
-
-(defn map
- "Returns a lazy sequence consisting of the result of applying f to the
- set of first items of each coll, followed by applying f to the set
- of second items in each coll, until any one of the colls is
- exhausted. Any remaining items in other colls are ignored. Function
- f should accept number-of-colls arguments."
- ([f coll]
- (lazy-seq
- (when-let [s (seq coll)]
- (cons (f (first s)) (map f (rest s))))))
- ([f c1 c2]
- (lazy-seq
- (let [s1 (seq c1) s2 (seq c2)]
- (when (and s1 s2)
- (cons (f (first s1) (first s2))
- (map f (rest s1) (rest s2)))))))
- ([f c1 c2 c3]
- (lazy-seq
- (let [s1 (seq c1) s2 (seq c2) s3 (seq c3)]
- (when (and s1 s2 s3)
- (cons (f (first s1) (first s2) (first s3))
- (map f (rest s1) (rest s2) (rest s3)))))))
- ([f c1 c2 c3 & colls]
- (let [step (fn step [cs]
- (lazy-seq
- (let [ss (map seq cs)]
- (when (every? identity ss)
- (cons (map first ss) (step (map rest ss)))))))]
- (map #(apply f %) (step (conj colls c3 c2 c1))))))
-
-(defn mapcat
- "Returns the result of applying concat to the result of applying map
- to f and colls. Thus function f should return a collection."
- [f & colls]
- (apply concat (apply map f colls)))
-
-(defn filter
- "Returns a lazy sequence of the items in coll for which
- (pred item) returns true. pred must be free of side-effects."
- [pred coll]
- (let [step (fn [p c]
- (when-let [s (seq c)]
- (if (p (first s))
- (cons (first s) (filter p (rest s)))
- (recur p (rest s)))))]
- (lazy-seq (step pred coll))))
-
-
-(defn remove
- "Returns a lazy sequence of the items in coll for which
- (pred item) returns false. pred must be free of side-effects."
- [pred coll]
- (filter (complement pred) coll))
-
-(defn take
- "Returns a lazy sequence of the first n items in coll, or all items if
- there are fewer than n."
- [n coll]
- (lazy-seq
- (when (pos? n)
- (when-let [s (seq coll)]
- (cons (first s) (take (dec n) (rest s)))))))
-
-(defn take-while
- "Returns a lazy sequence of successive items from coll while
- (pred item) returns true. pred must be free of side-effects."
- [pred coll]
- (lazy-seq
- (when-let [s (seq coll)]
- (when (pred (first s))
- (cons (first s) (take-while pred (rest s)))))))
-
-(defn drop
- "Returns a lazy sequence of all but the first n items in coll."
- [n coll]
- (let [step (fn [n coll]
- (let [s (seq coll)]
- (if (and (pos? n) s)
- (recur (dec n) (rest s))
- s)))]
- (lazy-seq (step n coll))))
-
-(defn drop-last
- "Return a lazy sequence of all but the last n (default 1) items in coll"
- ([s] (drop-last 1 s))
- ([n s] (map (fn [x _] x) s (drop n s))))
-
-(defn drop-while
- "Returns a lazy sequence of the items in coll starting from the first
- item for which (pred item) returns nil."
- [pred coll]
- (let [step (fn [pred coll]
- (let [s (seq coll)]
- (if (and s (pred (first s)))
- (recur pred (rest s))
- s)))]
- (lazy-seq (step pred coll))))
-
-(defn cycle
- "Returns a lazy (infinite!) sequence of repetitions of the items in coll."
- [coll] (lazy-seq
- (when-let [s (seq coll)]
- (concat s (cycle s)))))
-
-(defn split-at
- "Returns a vector of [(take n coll) (drop n coll)]"
- [n coll]
- [(take n coll) (drop n coll)])
-
-(defn split-with
- "Returns a vector of [(take-while pred coll) (drop-while pred coll)]"
- [pred coll]
- [(take-while pred coll) (drop-while pred coll)])
-
-(defn repeat
- "Returns a lazy (infinite!, or length n if supplied) sequence of xs."
- ([x] (lazy-seq (cons x (repeat x))))
- ([n x] (take n (repeat x))))
-
-(defn replicate
- "Returns a lazy seq of n xs."
- [n x] (take n (repeat x)))
-
-(defn iterate
- "Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
- [f x] (cons x (lazy-seq (iterate f (f x)))))
-
-(defn range
- "Returns a lazy seq of nums from start (inclusive) to end
- (exclusive), by step, where start defaults to 0 and step to 1."
- ([end] (if (and (> end 0) (<= end (. Integer MAX_VALUE)))
- (new clojure.lang.Range 0 end)
- (take end (iterate inc 0))))
- ([start end] (if (and (< start end)
- (>= start (. Integer MIN_VALUE))
- (<= end (. Integer MAX_VALUE)))
- (new clojure.lang.Range start end)
- (take (- end start) (iterate inc start))))
- ([start end step]
- (take-while (partial (if (pos? step) > <) end) (iterate (partial + step) start))))
-
-(defn merge
- "Returns a map that consists of the rest of the maps conj-ed onto
- the first. If a key occurs in more than one map, the mapping from
- the latter (left-to-right) will be the mapping in the result."
- [& maps]
- (when (some identity maps)
- (reduce #(conj (or %1 {}) %2) maps)))
-
-(defn merge-with
- "Returns a map that consists of the rest of the maps conj-ed onto
- the first. If a key occurs in more than one map, the mapping(s)
- from the latter (left-to-right) will be combined with the mapping in
- the result by calling (f val-in-result val-in-latter)."
- [f & maps]
- (when (some identity maps)
- (let [merge-entry (fn [m e]
- (let [k (key e) v (val e)]
- (if (contains? m k)
- (assoc m k (f (m k) v))
- (assoc m k v))))
- merge2 (fn [m1 m2]
- (reduce merge-entry (or m1 {}) (seq m2)))]
- (reduce merge2 maps))))
-
-
-
-(defn zipmap
- "Returns a map with the keys mapped to the corresponding vals."
- [keys vals]
- (loop [map {}
- ks (seq keys)
- vs (seq vals)]
- (if (and ks vs)
- (recur (assoc map (first ks) (first vs))
- (next ks)
- (next vs))
- map)))
-
-(defn line-seq
- "Returns the lines of text from rdr as a lazy sequence of strings.
- rdr must implement java.io.BufferedReader."
- [#^java.io.BufferedReader rdr]
- (lazy-seq
- (let [line (. rdr (readLine))]
- (when line
- (cons line (line-seq rdr))))))
-
-(defn comparator
- "Returns an implementation of java.util.Comparator based upon pred."
- [pred]
- (fn [x y]
- (cond (pred x y) -1 (pred y x) 1 :else 0)))
-
-(defn sort
- "Returns a sorted sequence of the items in coll. If no comparator is
- supplied, uses compare. comparator must
- implement java.util.Comparator."
- ([coll]
- (sort compare coll))
- ([#^java.util.Comparator comp coll]
- (if (seq coll)
- (let [a (to-array coll)]
- (. java.util.Arrays (sort a comp))
- (seq a))
- ())))
-
-(defn sort-by
- "Returns a sorted sequence of the items in coll, where the sort
- order is determined by comparing (keyfn item). If no comparator is
- supplied, uses compare. comparator must
- implement java.util.Comparator."
- ([keyfn coll]
- (sort-by keyfn compare coll))
- ([keyfn #^java.util.Comparator comp coll]
- (sort (fn [x y] (. comp (compare (keyfn x) (keyfn y)))) coll)))
-
-(defn partition
- "Returns a lazy sequence of lists of n items each, at offsets step
- apart. If step is not supplied, defaults to n, i.e. the partitions
- do not overlap."
- ([n coll]
- (partition n n coll))
- ([n step coll]
- (lazy-seq
- (when-let [s (seq coll)]
- (let [p (take n s)]
- (when (= n (count p))
- (cons p (partition n step (drop step s)))))))))
-
-;; evaluation
-
-(defn eval
- "Evaluates the form data structure (not text!) and returns the result."
- [form] (. clojure.lang.Compiler (eval form)))
-
-(defmacro doseq
- "Repeatedly executes body (presumably for side-effects) with
- bindings and filtering as provided by \"for\". Does not retain
- the head of the sequence. Returns nil."
- [seq-exprs & body]
- (assert-args doseq
- (vector? seq-exprs) "a vector for its binding"
- (even? (count seq-exprs)) "an even number of forms in binding vector")
- (let [step (fn step [recform exprs]
- (if-not exprs
- [true `(do ~@body)]
- (let [k (first exprs)
- v (second exprs)
- seqsym (when-not (keyword? k) (gensym))
- recform (if (keyword? k) recform `(recur (next ~seqsym)))
- steppair (step recform (nnext exprs))
- needrec (steppair 0)
- subform (steppair 1)]
- (cond
- (= k :let) [needrec `(let ~v ~subform)]
- (= k :while) [false `(when ~v
- ~subform
- ~@(when needrec [recform]))]
- (= k :when) [false `(if ~v
- (do
- ~subform
- ~@(when needrec [recform]))
- ~recform)]
- :else [true `(loop [~seqsym (seq ~v)]
- (when ~seqsym
- (let [~k (first ~seqsym)]
- ~subform
- ~@(when needrec [recform]))))]))))]
- (nth (step nil (seq seq-exprs)) 1)))
-
-(defn dorun
- "When lazy sequences are produced via functions that have side
- effects, any effects other than those needed to produce the first
- element in the seq do not occur until the seq is consumed. dorun can
- be used to force any effects. Walks through the successive nexts of
- the seq, does not retain the head and returns nil."
- ([coll]
- (when (seq coll)
- (recur (next coll))))
- ([n coll]
- (when (and (seq coll) (pos? n))
- (recur (dec n) (next coll)))))
-
-(defn doall
- "When lazy sequences are produced via functions that have side
- effects, any effects other than those needed to produce the first
- element in the seq do not occur until the seq is consumed. doall can
- be used to force any effects. Walks through the successive nexts of
- the seq, retains the head and returns it, thus causing the entire
- seq to reside in memory at one time."
- ([coll]
- (dorun coll)
- coll)
- ([n coll]
- (dorun n coll)
- coll))
-
-(defn await
- "Blocks the current thread (indefinitely!) until all actions
- dispatched thus far, from this thread or agent, to the agent(s) have
- occurred."
- [& agents]
- (io! "await in transaction"
- (when *agent*
- (throw (new Exception "Can't await in agent action")))
- (let [latch (new java.util.concurrent.CountDownLatch (count agents))
- count-down (fn [agent] (. latch (countDown)) agent)]
- (doseq [agent agents]
- (send agent count-down))
- (. latch (await)))))
-
-(defn await1 [#^clojure.lang.Agent a]
- (when (pos? (.getQueueCount a))
- (await a))
- a)
-
-(defn await-for
- "Blocks the current thread until all actions dispatched thus
- far (from this thread or agent) to the agents have occurred, or the
- timeout (in milliseconds) has elapsed. Returns nil if returning due
- to timeout, non-nil otherwise."
- [timeout-ms & agents]
- (io! "await-for in transaction"
- (when *agent*
- (throw (new Exception "Can't await in agent action")))
- (let [latch (new java.util.concurrent.CountDownLatch (count agents))
- count-down (fn [agent] (. latch (countDown)) agent)]
- (doseq [agent agents]
- (send agent count-down))
- (. latch (await timeout-ms (. java.util.concurrent.TimeUnit MILLISECONDS))))))
-
-(defmacro dotimes
- "bindings => name n
-
- Repeatedly executes body (presumably for side-effects) with name
- bound to integers from 0 through n-1."
- [bindings & body]
- (assert-args dotimes
- (vector? bindings) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [i (first bindings)
- n (second bindings)]
- `(let [n# (int ~n)]
- (loop [~i (int 0)]
- (when (< ~i n#)
- ~@body
- (recur (unchecked-inc ~i)))))))
-
-(defn import
- "import-list => (package-symbol class-name-symbols*)
-
- For each name in class-name-symbols, adds a mapping from name to the
- class named by package.name to the current namespace. Use :import in the ns
- macro in preference to calling this directly."
- [& import-symbols-or-lists]
- (let [#^clojure.lang.Namespace ns *ns*]
- (doseq [spec import-symbols-or-lists]
- (if (symbol? spec)
- (let [n (name spec)
- dot (.lastIndexOf n (. clojure.lang.RT (intCast \.)))
- c (symbol (.substring n (inc dot)))]
- (. ns (importClass c (. clojure.lang.RT (classForName (name spec))))))
- (let [pkg (first spec)
- classes (next spec)]
- (doseq [c classes]
- (. ns (importClass c (. clojure.lang.RT (classForName (str pkg "." c)))))))))))
-
-
-(defn into-array
- "Returns an array with components set to the values in aseq. The array's
- component type is type if provided, or the type of the first value in
- aseq if present, or Object. All values in aseq must be compatible with
- the component type. Class objects for the primitive types can be obtained
- using, e.g., Integer/TYPE."
- ([aseq]
- (clojure.lang.RT/seqToTypedArray (seq aseq)))
- ([type aseq]
- (clojure.lang.RT/seqToTypedArray type (seq aseq))))
-
-(defn into
- "Returns a new coll consisting of to-coll with all of the items of
- from-coll conjoined."
- [to from]
- (let [ret to items (seq from)]
- (if items
- (recur (conj ret (first items)) (next items))
- ret)))
-
-(defn #^{:private true}
- array [& items]
- (into-array items))
-
-(defn #^Class class
- "Returns the Class of x"
- [#^Object x] (if (nil? x) x (. x (getClass))))
-
-(defn type
- "Returns the :type metadata of x, or its Class if none"
- [x]
- (or (:type (meta x)) (class x)))
-
-(defn num
- "Coerce to Number"
- {:tag Number
- :inline (fn [x] `(. clojure.lang.Numbers (num ~x)))}
- [x] (. clojure.lang.Numbers (num x)))
-
-(defn int
- "Coerce to int"
- {:tag Integer
- :inline (fn [x] `(. clojure.lang.RT (intCast ~x)))}
- [x] (. clojure.lang.RT (intCast x)))
-
-(defn long
- "Coerce to long"
- {:tag Long
- :inline (fn [x] `(. clojure.lang.RT (longCast ~x)))}
- [#^Number x] (. x (longValue)))
-
-(defn float
- "Coerce to float"
- {:tag Float
- :inline (fn [x] `(. clojure.lang.RT (floatCast ~x)))}
- [#^Number x] (. x (floatValue)))
-
-(defn double
- "Coerce to double"
- {:tag Double
- :inline (fn [x] `(. clojure.lang.RT (doubleCast ~x)))}
- [#^Number x] (. x (doubleValue)))
-
-(defn short
- "Coerce to short"
- {:tag Short
- :inline (fn [x] `(. clojure.lang.RT (shortCast ~x)))}
- [#^Number x] (. x (shortValue)))
-
-(defn byte
- "Coerce to byte"
- {:tag Byte
- :inline (fn [x] `(. clojure.lang.RT (byteCast ~x)))}
- [#^Number x] (. x (byteValue)))
-
-(defn char
- "Coerce to char"
- {:tag Character
- :inline (fn [x] `(. clojure.lang.RT (charCast ~x)))}
- [x] (. clojure.lang.RT (charCast x)))
-
-(defn boolean
- "Coerce to boolean"
- {:tag Boolean
- :inline (fn [x] `(. clojure.lang.RT (booleanCast ~x)))}
- [x] (if x true false))
-
-(defn number?
- "Returns true if x is a Number"
- [x]
- (instance? Number x))
-
-(defn integer?
- "Returns true if n is an integer"
- [n]
- (or (instance? Integer n)
- (instance? Long n)
- (instance? BigInteger n)
- (instance? Short n)
- (instance? Byte n)))
-
-(defn mod
- "Modulus of num and div. Truncates toward negative infinity."
- [num div]
- (let [m (rem num div)]
- (if (or (zero? m) (pos? (* num div)))
- m
- (+ m div))))
-
-(defn ratio?
- "Returns true if n is a Ratio"
- [n] (instance? clojure.lang.Ratio n))
-
-(defn decimal?
- "Returns true if n is a BigDecimal"
- [n] (instance? BigDecimal n))
-
-(defn float?
- "Returns true if n is a floating point number"
- [n]
- (or (instance? Double n)
- (instance? Float n)))
-
-(defn rational? [n]
- "Returns true if n is a rational number"
- (or (integer? n) (ratio? n) (decimal? n)))
-
-(defn bigint
- "Coerce to BigInteger"
- {:tag BigInteger}
- [x] (cond
- (instance? BigInteger x) x
- (decimal? x) (.toBigInteger #^BigDecimal x)
- (number? x) (BigInteger/valueOf (long x))
- :else (BigInteger. x)))
-
-(defn bigdec
- "Coerce to BigDecimal"
- {:tag BigDecimal}
- [x] (cond
- (decimal? x) x
- (float? x) (. BigDecimal valueOf (double x))
- (ratio? x) (/ (BigDecimal. (.numerator x)) (.denominator x))
- (instance? BigInteger x) (BigDecimal. #^BigInteger x)
- (number? x) (BigDecimal/valueOf (long x))
- :else (BigDecimal. x)))
-
-(def #^{:private true} print-initialized false)
-
-(defmulti print-method (fn [x writer] (type x)))
-(defmulti print-dup (fn [x writer] (class x)))
-
-(defn pr-on
- {:private true}
- [x w]
- (if *print-dup*
- (print-dup x w)
- (print-method x w))
- nil)
-
-(defn pr
- "Prints the object(s) to the output stream that is the current value
- of *out*. Prints the object(s), separated by spaces if there is
- more than one. By default, pr and prn print in a way that objects
- can be read by the reader"
- ([] nil)
- ([x]
- (pr-on x *out*))
- ([x & more]
- (pr x)
- (. *out* (append \space))
- (apply pr more)))
-
-(defn newline
- "Writes a newline to the output stream that is the current value of
- *out*"
- []
- (. *out* (append \newline))
- nil)
-
-(defn flush
- "Flushes the output stream that is the current value of
- *out*"
- []
- (. *out* (flush))
- nil)
-
-(defn prn
- "Same as pr followed by (newline). Observes *flush-on-newline*"
- [& more]
- (apply pr more)
- (newline)
- (when *flush-on-newline*
- (flush)))
-
-(defn print
- "Prints the object(s) to the output stream that is the current value
- of *out*. print and println produce output for human consumption."
- [& more]
- (binding [*print-readably* nil]
- (apply pr more)))
-
-(defn println
- "Same as print followed by (newline)"
- [& more]
- (binding [*print-readably* nil]
- (apply prn more)))
-
-
-(defn read
- "Reads the next object from stream, which must be an instance of
- java.io.PushbackReader or some derivee. stream defaults to the
- current value of *in* ."
- ([]
- (read *in*))
- ([stream]
- (read stream true nil))
- ([stream eof-error? eof-value]
- (read stream eof-error? eof-value false))
- ([stream eof-error? eof-value recursive?]
- (. clojure.lang.LispReader (read stream (boolean eof-error?) eof-value recursive?))))
-
-(defn read-line
- "Reads the next line from stream that is the current value of *in* ."
- []
- (if (instance? clojure.lang.LineNumberingPushbackReader *in*)
- (.readLine #^clojure.lang.LineNumberingPushbackReader *in*)
- (.readLine #^java.io.BufferedReader *in*)))
-
-(defn read-string
- "Reads one object from the string s"
- [s] (clojure.lang.RT/readString s))
-
-(defn subvec
- "Returns a persistent vector of the items in vector from
- start (inclusive) to end (exclusive). If end is not supplied,
- defaults to (count vector). This operation is O(1) and very fast, as
- the resulting vector shares structure with the original and no
- trimming is done."
- ([v start]
- (subvec v start (count v)))
- ([v start end]
- (. clojure.lang.RT (subvec v start end))))
-
-(defmacro with-open
- "bindings => [name init ...]
-
- Evaluates body in a try expression with names bound to the values
- of the inits, and a finally clause that calls (.close name) on each
- name in reverse order."
- [bindings & body]
- (assert-args with-open
- (vector? bindings) "a vector for its binding"
- (even? (count bindings)) "an even number of forms in binding vector")
- (cond
- (= (count bindings) 0) `(do ~@body)
- (symbol? (bindings 0)) `(let ~(subvec bindings 0 2)
- (try
- (with-open ~(subvec bindings 2) ~@body)
- (finally
- (. ~(bindings 0) close))))
- :else (throw (IllegalArgumentException.
- "with-open only allows Symbols in bindings"))))
-
-(defmacro doto
- "Evaluates x then calls all of the methods and functions with the
- value of x supplied at the from of the given arguments. The forms
- are evaluated in order. Returns x.
-
- (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
- [x & forms]
- (let [gx (gensym)]
- `(let [~gx ~x]
- ~@(map (fn [f]
- (if (seq? f)
- `(~(first f) ~gx ~@(next f))
- `(~f ~gx)))
- forms)
- ~gx)))
-
-(defmacro memfn
- "Expands into code that creates a fn that expects to be passed an
- object and any args and calls the named instance method on the
- object passing the args. Use when you want to treat a Java method as
- a first-class fn."
- [name & args]
- `(fn [target# ~@args]
- (. target# (~name ~@args))))
-
-(defmacro time
- "Evaluates expr and prints the time it took. Returns the value of
- expr."
- [expr]
- `(let [start# (. System (nanoTime))
- ret# ~expr]
- (prn (str "Elapsed time: " (/ (double (- (. System (nanoTime)) start#)) 1000000.0) " msecs"))
- ret#))
-
-
-
-(import '(java.lang.reflect Array))
-
-(defn alength
- "Returns the length of the Java array. Works on arrays of all
- types."
- {:inline (fn [a] `(. clojure.lang.RT (alength ~a)))}
- [array] (. clojure.lang.RT (alength array)))
-
-(defn aclone
- "Returns a clone of the Java array. Works on arrays of known
- types."
- {:inline (fn [a] `(. clojure.lang.RT (aclone ~a)))}
- [array] (. clojure.lang.RT (aclone array)))
-
-(defn aget
- "Returns the value at the index/indices. Works on Java arrays of all
- types."
- {:inline (fn [a i] `(. clojure.lang.RT (aget ~a ~i)))
- :inline-arities #{2}}
- ([array idx]
- (clojure.lang.Reflector/prepRet (. Array (get array idx))))
- ([array idx & idxs]
- (apply aget (aget array idx) idxs)))
-
-(defn aset
- "Sets the value at the index/indices. Works on Java arrays of
- reference types. Returns val."
- {:inline (fn [a i v] `(. clojure.lang.RT (aset ~a ~i ~v)))
- :inline-arities #{3}}
- ([array idx val]
- (. Array (set array idx val))
- val)
- ([array idx idx2 & idxv]
- (apply aset (aget array idx) idx2 idxv)))
-
-(defmacro
- #^{:private true}
- def-aset [name method coerce]
- `(defn ~name
- {:arglists '([~'array ~'idx ~'val] [~'array ~'idx ~'idx2 & ~'idxv])}
- ([array# idx# val#]
- (. Array (~method array# idx# (~coerce val#)))
- val#)
- ([array# idx# idx2# & idxv#]
- (apply ~name (aget array# idx#) idx2# idxv#))))
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."}
- aset-int setInt int)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."}
- aset-long setLong long)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."}
- aset-boolean setBoolean boolean)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."}
- aset-float setFloat float)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."}
- aset-double setDouble double)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."}
- aset-short setShort short)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."}
- aset-byte setByte byte)
-
-(def-aset
- #^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."}
- aset-char setChar char)
-
-(defn make-array
- "Creates and returns an array of instances of the specified class of
- the specified dimension(s). Note that a class object is required.
- Class objects can be obtained by using their imported or
- fully-qualified name. Class objects for the primitive types can be
- obtained using, e.g., Integer/TYPE."
- ([#^Class type len]
- (. Array (newInstance type (int len))))
- ([#^Class type dim & more-dims]
- (let [dims (cons dim more-dims)
- #^"[I" dimarray (make-array (. Integer TYPE) (count dims))]
- (dotimes [i (alength dimarray)]
- (aset-int dimarray i (nth dims i)))
- (. Array (newInstance type dimarray)))))
-
-(defn to-array-2d
- "Returns a (potentially-ragged) 2-dimensional array of Objects
- containing the contents of coll, which can be any Collection of any
- Collection."
- {:tag "[[Ljava.lang.Object;"}
- [#^java.util.Collection coll]
- (let [ret (make-array (. Class (forName "[Ljava.lang.Object;")) (. coll (size)))]
- (loop [i 0 xs (seq coll)]
- (when xs
- (aset ret i (to-array (first xs)))
- (recur (inc i) (next xs))))
- ret))
-
-(defn macroexpand-1
- "If form represents a macro form, returns its expansion,
- else returns form."
- [form]
- (. clojure.lang.Compiler (macroexpand1 form)))
-
-(defn macroexpand
- "Repeatedly calls macroexpand-1 on form until it no longer
- represents a macro form, then returns it. Note neither
- macroexpand-1 nor macroexpand expand macros in subforms."
- [form]
- (let [ex (macroexpand-1 form)]
- (if (identical? ex form)
- form
- (macroexpand ex))))
-
-(defn create-struct
- "Returns a structure basis object."
- [& keys]
- (. clojure.lang.PersistentStructMap (createSlotMap keys)))
-
-(defmacro defstruct
- "Same as (def name (create-struct keys...))"
- [name & keys]
- `(def ~name (create-struct ~@keys)))
-
-(defn struct-map
- "Returns a new structmap instance with the keys of the
- structure-basis. keyvals may contain all, some or none of the basis
- keys - where values are not supplied they will default to nil.
- keyvals can also contain keys not in the basis."
- [s & inits]
- (. clojure.lang.PersistentStructMap (create s inits)))
-
-(defn struct
- "Returns a new structmap instance with the keys of the
- structure-basis. vals must be supplied for basis keys in order -
- where values are not supplied they will default to nil."
- [s & vals]
- (. clojure.lang.PersistentStructMap (construct s vals)))
-
-(defn accessor
- "Returns a fn that, given an instance of a structmap with the basis,
- returns the value at the key. The key must be in the basis. The
- returned function should be (slightly) more efficient than using
- get, but such use of accessors should be limited to known
- performance-critical areas."
- [s key]
- (. clojure.lang.PersistentStructMap (getAccessor s key)))
-
-(defn load-reader
- "Sequentially read and evaluate the set of forms contained in the
- stream/file"
- [rdr] (. clojure.lang.Compiler (load rdr)))
-
-(defn load-string
- "Sequentially read and evaluate the set of forms contained in the
- string"
- [s]
- (let [rdr (-> (java.io.StringReader. s)
- (clojure.lang.LineNumberingPushbackReader.))]
- (load-reader rdr)))
-
-(defn set
- "Returns a set of the distinct elements of coll."
- [coll] (apply hash-set coll))
-
-(defn #^{:private true}
- filter-key [keyfn pred amap]
- (loop [ret {} es (seq amap)]
- (if es
- (if (pred (keyfn (first es)))
- (recur (assoc ret (key (first es)) (val (first es))) (next es))
- (recur ret (next es)))
- ret)))
-
-(defn find-ns
- "Returns the namespace named by the symbol or nil if it doesn't exist."
- [sym] (clojure.lang.Namespace/find sym))
-
-(defn create-ns
- "Create a new namespace named by the symbol if one doesn't already
- exist, returns it or the already-existing namespace of the same
- name."
- [sym] (clojure.lang.Namespace/findOrCreate sym))
-
-(defn remove-ns
- "Removes the namespace named by the symbol. Use with caution.
- Cannot be used to remove the clojure namespace."
- [sym] (clojure.lang.Namespace/remove sym))
-
-(defn all-ns
- "Returns a sequence of all namespaces."
- [] (clojure.lang.Namespace/all))
-
-(defn #^clojure.lang.Namespace the-ns
- "If passed a namespace, returns it. Else, when passed a symbol,
- returns the namespace named by it, throwing an exception if not
- found."
- [x]
- (if (instance? clojure.lang.Namespace x)
- x
- (or (find-ns x) (throw (Exception. (str "No namespace: " x " found"))))))
-
-(defn ns-name
- "Returns the name of the namespace, a symbol."
- [ns]
- (.getName (the-ns ns)))
-
-(defn ns-map
- "Returns a map of all the mappings for the namespace."
- [ns]
- (.getMappings (the-ns ns)))
-
-(defn ns-unmap
- "Removes the mappings for the symbol from the namespace."
- [ns sym]
- (.unmap (the-ns ns) sym))
-
-;(defn export [syms]
-; (doseq [sym syms]
-; (.. *ns* (intern sym) (setExported true))))
-
-(defn ns-publics
- "Returns a map of the public intern mappings for the namespace."
- [ns]
- (let [ns (the-ns ns)]
- (filter-key val (fn [#^clojure.lang.Var v] (and (instance? clojure.lang.Var v)
- (= ns (.ns v))
- (.isPublic v)))
- (ns-map ns))))
-
-(defn ns-imports
- "Returns a map of the import mappings for the namespace."
- [ns]
- (filter-key val (partial instance? Class) (ns-map ns)))
-
-(defn refer
- "refers to all public vars of ns, subject to filters.
- filters can include at most one each of:
-
- :exclude list-of-symbols
- :only list-of-symbols
- :rename map-of-fromsymbol-tosymbol
-
- For each public interned var in the namespace named by the symbol,
- adds a mapping from the name of the var to the var to the current
- namespace. Throws an exception if name is already mapped to
- something else in the current namespace. Filters can be used to
- select a subset, via inclusion or exclusion, or to provide a mapping
- to a symbol different from the var's name, in order to prevent
- clashes. Use :use in the ns macro in preference to calling this directly."
- [ns-sym & filters]
- (let [ns (or (find-ns ns-sym) (throw (new Exception (str "No namespace: " ns-sym))))
- fs (apply hash-map filters)
- nspublics (ns-publics ns)
- rename (or (:rename fs) {})
- exclude (set (:exclude fs))
- to-do (or (:only fs) (keys nspublics))]
- (doseq [sym to-do]
- (when-not (exclude sym)
- (let [v (nspublics sym)]
- (when-not v
- (throw (new java.lang.IllegalAccessError (str sym " is not public"))))
- (. *ns* (refer (or (rename sym) sym) v)))))))
-
-(defn ns-refers
- "Returns a map of the refer mappings for the namespace."
- [ns]
- (let [ns (the-ns ns)]
- (filter-key val (fn [#^clojure.lang.Var v] (and (instance? clojure.lang.Var v)
- (not= ns (.ns v))))
- (ns-map ns))))
-
-(defn ns-interns
- "Returns a map of the intern mappings for the namespace."
- [ns]
- (let [ns (the-ns ns)]
- (filter-key val (fn [#^clojure.lang.Var v] (and (instance? clojure.lang.Var v)
- (= ns (.ns v))))
- (ns-map ns))))
-
-(defn alias
- "Add an alias in the current namespace to another
- namespace. Arguments are two symbols: the alias to be used, and
- the symbolic name of the target namespace. Use :as in the ns macro in preference
- to calling this directly."
- [alias namespace-sym]
- (.addAlias *ns* alias (find-ns namespace-sym)))
-
-(defn ns-aliases
- "Returns a map of the aliases for the namespace."
- [ns]
- (.getAliases (the-ns ns)))
-
-(defn ns-unalias
- "Removes the alias for the symbol from the namespace."
- [ns sym]
- (.removeAlias (the-ns ns) sym))
-
-(defn take-nth
- "Returns a lazy seq of every nth item in coll."
- [n coll]
- (lazy-seq
- (when-let [s (seq coll)]
- (cons (first s) (take-nth n (drop n s))))))
-
-(defn interleave
- "Returns a lazy seq of the first item in each coll, then the second
- etc."
- [& colls]
- (apply concat (apply map list colls)))
-
-(defn var-get
- "Gets the value in the var object"
- [#^clojure.lang.Var x] (. x (get)))
-
-(defn var-set
- "Sets the value in the var object to val. The var must be
- thread-locally bound."
- [#^clojure.lang.Var x val] (. x (set val)))
-
-(defmacro with-local-vars
- "varbinding=> symbol init-expr
-
- Executes the exprs in a context in which the symbols are bound to
- vars with per-thread bindings to the init-exprs. The symbols refer
- to the var objects themselves, and must be accessed with var-get and
- var-set"
- [name-vals-vec & body]
- (assert-args with-local-vars
- (vector? name-vals-vec) "a vector for its binding"
- (even? (count name-vals-vec)) "an even number of forms in binding vector")
- `(let [~@(interleave (take-nth 2 name-vals-vec)
- (repeat '(. clojure.lang.Var (create))))]
- (. clojure.lang.Var (pushThreadBindings (hash-map ~@name-vals-vec)))
- (try
- ~@body
- (finally (. clojure.lang.Var (popThreadBindings))))))
-
-(defn ns-resolve
- "Returns the var or Class to which a symbol will be resolved in the
- namespace, else nil. Note that if the symbol is fully qualified,
- the var/Class to which it resolves need not be present in the
- namespace."
- [ns sym]
- (clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))
-
-(defn resolve
- "same as (ns-resolve *ns* symbol)"
- [sym] (ns-resolve *ns* sym))
-
-(defn array-map
- "Constructs an array-map."
- ([] (. clojure.lang.PersistentArrayMap EMPTY))
- ([& keyvals] (new clojure.lang.PersistentArrayMap (to-array keyvals))))
-
-(defn nthnext
- "Returns the nth next of coll, (seq coll) when n is 0."
- [coll n]
- (loop [n n xs (seq coll)]
- (if (and xs (pos? n))
- (recur (dec n) (next xs))
- xs)))
-
-
-;redefine let and loop with destructuring
-(defn destructure [bindings]
- (let [bmap (apply array-map bindings)
- pb (fn pb [bvec b v]
- (let [pvec
- (fn [bvec b val]
- (let [gvec (gensym "vec__")]
- (loop [ret (-> bvec (conj gvec) (conj val))
- n 0
- bs b
- seen-rest? false]
- (if (seq bs)
- (let [firstb (first bs)]
- (cond
- (= firstb '&) (recur (pb ret (second bs) (list `nthnext gvec n))
- n
- (nnext bs)
- true)
- (= firstb :as) (pb ret (second bs) gvec)
- :else (if seen-rest?
- (throw (new Exception "Unsupported binding form, only :as can follow & parameter"))
- (recur (pb ret firstb (list `nth gvec n nil))
- (inc n)
- (next bs)
- seen-rest?))))
- ret))))
- pmap
- (fn [bvec b v]
- (let [gmap (or (:as b) (gensym "map__"))
- defaults (:or b)]
- (loop [ret (-> bvec (conj gmap) (conj v))
- bes (reduce
- (fn [bes entry]
- (reduce #(assoc %1 %2 ((val entry) %2))
- (dissoc bes (key entry))
- ((key entry) bes)))
- (dissoc b :as :or)
- {:keys #(keyword (str %)), :strs str, :syms #(list `quote %)})]
- (if (seq bes)
- (let [bb (key (first bes))
- bk (val (first bes))
- has-default (contains? defaults bb)]
- (recur (pb ret bb (if has-default
- (list `get gmap bk (defaults bb))
- (list `get gmap bk)))
- (next bes)))
- ret))))]
- (cond
- (symbol? b) (-> bvec (conj b) (conj v))
- (vector? b) (pvec bvec b v)
- (map? b) (pmap bvec b v)
- :else (throw (new Exception (str "Unsupported binding form: " b))))))
- process-entry (fn [bvec b] (pb bvec (key b) (val b)))]
- (if (every? symbol? (keys bmap))
- bindings
- (reduce process-entry [] bmap))))
-
-(defmacro let
- "Evaluates the exprs in a lexical context in which the symbols in
- the binding-forms are bound to their respective init-exprs or parts
- therein."
- [bindings & body]
- (assert-args let
- (vector? bindings) "a vector for its binding"
- (even? (count bindings)) "an even number of forms in binding vector")
- `(let* ~(destructure bindings) ~@body))
-
-;redefine fn with destructuring
-(defmacro fn
- "(fn name? [params* ] exprs*)
- (fn name? ([params* ] exprs*)+)
-
- params => positional-params* , or positional-params* & next-param
- positional-param => binding-form
- next-param => binding-form
- name => symbol
-
- Defines a function"
- [& sigs]
- (let [name (if (symbol? (first sigs)) (first sigs) nil)
- sigs (if name (next sigs) sigs)
- sigs (if (vector? (first sigs)) (list sigs) sigs)
- psig (fn [sig]
- (let [[params & body] sig]
- (if (every? symbol? params)
- sig
- (loop [params params
- new-params []
- lets []]
- (if params
- (if (symbol? (first params))
- (recur (next params) (conj new-params (first params)) lets)
- (let [gparam (gensym "p__")]
- (recur (next params) (conj new-params gparam)
- (-> lets (conj (first params)) (conj gparam)))))
- `(~new-params
- (let ~lets
- ~@body)))))))
- new-sigs (map psig sigs)]
- (with-meta
- (if name
- (list* 'fn* name new-sigs)
- (cons 'fn* new-sigs))
- *macro-meta*)))
-
-(defmacro loop
- "Evaluates the exprs in a lexical context in which the symbols in
- the binding-forms are bound to their respective init-exprs or parts
- therein. Acts as a recur target."
- [bindings & body]
- (assert-args loop
- (vector? bindings) "a vector for its binding"
- (even? (count bindings)) "an even number of forms in binding vector")
- (let [db (destructure bindings)]
- (if (= db bindings)
- `(loop* ~bindings ~@body)
- (let [vs (take-nth 2 (drop 1 bindings))
- bs (take-nth 2 bindings)
- gs (map (fn [b] (if (symbol? b) b (gensym))) bs)
- bfs (reduce (fn [ret [b v g]]
- (if (symbol? b)
- (conj ret g v)
- (conj ret g v b g)))
- [] (map vector bs vs gs))]
- `(let ~bfs
- (loop* ~(vec (interleave gs gs))
- (let ~(vec (interleave bs gs))
- ~@body)))))))
-
-(defmacro when-first
- "bindings => x xs
-
- Same as (when (seq xs) (let [x (first xs)] body))"
- [bindings & body]
- (assert-args when-first
- (vector? bindings) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [[x xs] bindings]
- `(when (seq ~xs)
- (let [~x (first ~xs)]
- ~@body))))
-
-(defmacro lazy-cat
- "Expands to code which yields a lazy sequence of the concatenation
- of the supplied colls. Each coll expr is not evaluated until it is
- needed.
-
- (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))"
- [& colls]
- `(concat ~@(map #(list `lazy-seq %) colls)))
-
-(defmacro for
- "List comprehension. Takes a vector of one or more
- binding-form/collection-expr pairs, each followed by zero or more
- modifiers, and yields a lazy sequence of evaluations of expr.
- Collections are iterated in a nested fashion, rightmost fastest,
- and nested coll-exprs can refer to bindings created in prior
- binding-forms. Supported modifiers are: :let [binding-form expr ...],
- :while test, :when test.
-
- (take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))"
- [seq-exprs body-expr]
- (assert-args for
- (vector? seq-exprs) "a vector for its binding"
- (even? (count seq-exprs)) "an even number of forms in binding vector")
- (let [to-groups (fn [seq-exprs]
- (reduce (fn [groups [k v]]
- (if (keyword? k)
- (conj (pop groups) (conj (peek groups) [k v]))
- (conj groups [k v])))
- [] (partition 2 seq-exprs)))
- err (fn [& msg] (throw (IllegalArgumentException. (apply str msg))))
- emit-bind (fn emit-bind [[[bind expr & mod-pairs]
- & [[_ next-expr] :as next-groups]]]
- (let [giter (gensym "iter__")
- gxs (gensym "s__")
- do-mod (fn do-mod [[[k v :as pair] & etc]]
- (cond
- (= k :let) `(let ~v ~(do-mod etc))
- (= k :while) `(when ~v ~(do-mod etc))
- (= k :when) `(if ~v
- ~(do-mod etc)
- (recur (rest ~gxs)))
- (keyword? k) (err "Invalid 'for' keyword " k)
- next-groups
- `(let [iterys# ~(emit-bind next-groups)
- fs# (seq (iterys# ~next-expr))]
- (if fs#
- (concat fs# (~giter (rest ~gxs)))
- (recur (rest ~gxs))))
- :else `(cons ~body-expr
- (~giter (rest ~gxs)))))]
- `(fn ~giter [~gxs]
- (lazy-seq
- (loop [~gxs ~gxs]
- (when-first [~bind ~gxs]
- ~(do-mod mod-pairs)))))))]
- `(let [iter# ~(emit-bind (to-groups seq-exprs))]
- (iter# ~(second seq-exprs)))))
-
-(defmacro comment
- "Ignores body, yields nil"
- [& body])
-
-(defmacro with-out-str
- "Evaluates exprs in a context in which *out* is bound to a fresh
- StringWriter. Returns the string created by any nested printing
- calls."
- [& body]
- `(let [s# (new java.io.StringWriter)]
- (binding [*out* s#]
- ~@body
- (str s#))))
-
-(defmacro with-in-str
- "Evaluates body in a context in which *in* is bound to a fresh
- StringReader initialized with the string s."
- [s & body]
- `(with-open [s# (-> (java.io.StringReader. ~s) clojure.lang.LineNumberingPushbackReader.)]
- (binding [*in* s#]
- ~@body)))
-
-(defn pr-str
- "pr to a string, returning it"
- {:tag String}
- [& xs]
- (with-out-str
- (apply pr xs)))
-
-(defn prn-str
- "prn to a string, returning it"
- {:tag String}
- [& xs]
- (with-out-str
- (apply prn xs)))
-
-(defn print-str
- "print to a string, returning it"
- {:tag String}
- [& xs]
- (with-out-str
- (apply print xs)))
-
-(defn println-str
- "println to a string, returning it"
- {:tag String}
- [& xs]
- (with-out-str
- (apply println xs)))
-
-(defmacro assert
- "Evaluates expr and throws an exception if it does not evaluate to
- logical true."
- [x]
- `(when-not ~x
- (throw (new Exception (str "Assert failed: " (pr-str '~x))))))
-
-(defn test
- "test [v] finds fn at key :test in var metadata and calls it,
- presuming failure will throw exception"
- [v]
- (let [f (:test ^v)]
- (if f
- (do (f) :ok)
- :no-test)))
-
-(defn re-pattern
- "Returns an instance of java.util.regex.Pattern, for use, e.g. in
- re-matcher."
- {:tag java.util.regex.Pattern}
- [s] (if (instance? java.util.regex.Pattern s)
- s
- (. java.util.regex.Pattern (compile s))))
-
-(defn re-matcher
- "Returns an instance of java.util.regex.Matcher, for use, e.g. in
- re-find."
- {:tag java.util.regex.Matcher}
- [#^java.util.regex.Pattern re s]
- (. re (matcher s)))
-
-(defn re-groups
- "Returns the groups from the most recent match/find. If there are no
- nested groups, returns a string of the entire match. If there are
- nested groups, returns a vector of the groups, the first element
- being the entire match."
- [#^java.util.regex.Matcher m]
- (let [gc (. m (groupCount))]
- (if (zero? gc)
- (. m (group))
- (loop [ret [] c 0]
- (if (<= c gc)
- (recur (conj ret (. m (group c))) (inc c))
- ret)))))
-
-(defn re-seq
- "Returns a lazy sequence of successive matches of pattern in string,
- using java.util.regex.Matcher.find(), each such match processed with
- re-groups."
- [#^java.util.regex.Pattern re s]
- (let [m (re-matcher re s)]
- ((fn step []
- (lazy-seq
- (when (. m (find))
- (cons (re-groups m) (step))))))))
-
-(defn re-matches
- "Returns the match, if any, of string to pattern, using
- java.util.regex.Matcher.matches(). Uses re-groups to return the
- groups."
- [#^java.util.regex.Pattern re s]
- (let [m (re-matcher re s)]
- (when (. m (matches))
- (re-groups m))))
-
-
-(defn re-find
- "Returns the next regex match, if any, of string to pattern, using
- java.util.regex.Matcher.find(). Uses re-groups to return the
- groups."
- ([#^java.util.regex.Matcher m]
- (when (. m (find))
- (re-groups m)))
- ([#^java.util.regex.Pattern re s]
- (let [m (re-matcher re s)]
- (re-find m))))
-
-(defn rand
- "Returns a random floating point number between 0 (inclusive) and
- n (default 1) (exclusive)."
- ([] (. Math (random)))
- ([n] (* n (rand))))
-
-(defn rand-int
- "Returns a random integer between 0 (inclusive) and n (exclusive)."
- [n] (int (rand n)))
-
-(defmacro defn-
- "same as defn, yielding non-public def"
- [name & decls]
- (list* `defn (with-meta name (assoc (meta name) :private true)) decls))
-
-(defn print-doc [v]
- (println "-------------------------")
- (println (str (ns-name (:ns ^v)) "/" (:name ^v)))
- (prn (:arglists ^v))
- (when (:macro ^v)
- (println "Macro"))
- (println " " (:doc ^v)))
-
-(defn find-doc
- "Prints documentation for any var whose documentation or name
- contains a match for re-string-or-pattern"
- [re-string-or-pattern]
- (let [re (re-pattern re-string-or-pattern)]
- (doseq [ns (all-ns)
- v (sort-by (comp :name meta) (vals (ns-interns ns)))
- :when (and (:doc ^v)
- (or (re-find (re-matcher re (:doc ^v)))
- (re-find (re-matcher re (str (:name ^v))))))]
- (print-doc v))))
-
-(defn special-form-anchor
- "Returns the anchor tag on http://clojure.org/special_forms for the
- special form x, or nil"
- [x]
- (#{'. 'def 'do 'fn 'if 'let 'loop 'monitor-enter 'monitor-exit 'new
- 'quote 'recur 'set! 'throw 'try 'var} x))
-
-(defn syntax-symbol-anchor
- "Returns the anchor tag on http://clojure.org/special_forms for the
- special form that uses syntax symbol x, or nil"
- [x]
- ({'& 'fn 'catch 'try 'finally 'try} x))
-
-(defn print-special-doc
- [name type anchor]
- (println "-------------------------")
- (println name)
- (println type)
- (println (str " Please see http://clojure.org/special_forms#" anchor)))
-
-(defn print-namespace-doc
- "Print the documentation string of a Namespace."
- [nspace]
- (println "-------------------------")
- (println (str (ns-name nspace)))
- (println " " (:doc ^nspace)))
-
-(defmacro doc
- "Prints documentation for a var or special form given its name"
- [name]
- (cond
- (special-form-anchor `~name)
- `(print-special-doc '~name "Special Form" (special-form-anchor '~name))
- (syntax-symbol-anchor `~name)
- `(print-special-doc '~name "Syntax Symbol" (syntax-symbol-anchor '~name))
- :else
- (let [nspace (find-ns name)]
- (if nspace
- `(print-namespace-doc ~nspace)
- `(print-doc (var ~name))))))
-
- (defn tree-seq
- "Returns a lazy sequence of the nodes in a tree, via a depth-first walk.
- branch? must be a fn of one arg that returns true if passed a node
- that can have children (but may not). children must be a fn of one
- arg that returns a sequence of the children. Will only be called on
- nodes for which branch? returns true. Root is the root node of the
- tree."
- [branch? children root]
- (let [walk (fn walk [node]
- (lazy-seq
- (cons node
- (when (branch? node)
- (mapcat walk (children node))))))]
- (walk root)))
-
-(defn file-seq
- "A tree seq on java.io.Files"
- [dir]
- (tree-seq
- (fn [#^java.io.File f] (. f (isDirectory)))
- (fn [#^java.io.File d] (seq (. d (listFiles))))
- dir))
-
-(defn xml-seq
- "A tree seq on the xml elements as per xml/parse"
- [root]
- (tree-seq
- (complement string?)
- (comp seq :content)
- root))
-
-(defn special-symbol?
- "Returns true if s names a special form"
- [s]
- (contains? (. clojure.lang.Compiler specials) s))
-
-(defn var?
- "Returns true if v is of type clojure.lang.Var"
- [v] (instance? clojure.lang.Var v))
-
-(defn slurp
- "Reads the file named by f into a string and returns it."
- [#^String f]
- (with-open [r (new java.io.BufferedReader (new java.io.FileReader f))]
- (let [sb (new StringBuilder)]
- (loop [c (. r (read))]
- (if (neg? c)
- (str sb)
- (do
- (. sb (append (char c)))
- (recur (. r (read)))))))))
-
-(defn subs
- "Returns the substring of s beginning at start inclusive, and ending
- at end (defaults to length of string), exclusive."
- ([#^String s start] (. s (substring start)))
- ([#^String s start end] (. s (substring start end))))
-
-(defn max-key
- "Returns the x for which (k x), a number, is greatest."
- ([k x] x)
- ([k x y] (if (> (k x) (k y)) x y))
- ([k x y & more]
- (reduce #(max-key k %1 %2) (max-key k x y) more)))
-
-(defn min-key
- "Returns the x for which (k x), a number, is least."
- ([k x] x)
- ([k x y] (if (< (k x) (k y)) x y))
- ([k x y & more]
- (reduce #(min-key k %1 %2) (min-key k x y) more)))
-
-(defn distinct
- "Returns a lazy sequence of the elements of coll with duplicates removed"
- [coll]
- (let [step (fn step [xs seen]
- (lazy-seq
- ((fn [[f :as xs] seen]
- (when-let [s (seq xs)]
- (if (contains? seen f)
- (recur (rest s) seen)
- (cons f (step (rest s) (conj seen f))))))
- xs seen)))]
- (step coll #{})))
-
-
-
-(defn replace
- "Given a map of replacement pairs and a vector/collection, returns a
- vector/seq with any elements = a key in smap replaced with the
- corresponding val in smap"
- [smap coll]
- (if (vector? coll)
- (reduce (fn [v i]
- (if-let [e (find smap (nth v i))]
- (assoc v i (val e))
- v))
- coll (range (count coll)))
- (map #(if-let [e (find smap %)] (val e) %) coll)))
-
-(defmacro dosync
- "Runs the exprs (in an implicit do) in a transaction that encompasses
- exprs and any nested calls. Starts a transaction if none is already
- running on this thread. Any uncaught exception will abort the
- transaction and flow out of dosync. The exprs may be run more than
- once, but any effects on Refs will be atomic."
- [& exprs]
- `(sync nil ~@exprs))
-
-(defmacro with-precision
- "Sets the precision and rounding mode to be used for BigDecimal operations.
-
- Usage: (with-precision 10 (/ 1M 3))
- or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3))
-
- The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN,
- HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."
- [precision & exprs]
- (let [[body rm] (if (= (first exprs) :rounding)
- [(next (next exprs))
- `((. java.math.RoundingMode ~(second exprs)))]
- [exprs nil])]
- `(binding [*math-context* (java.math.MathContext. ~precision ~@rm)]
- ~@body)))
-
-(defn bound-fn
- {:private true}
- [#^clojure.lang.Sorted sc test key]
- (fn [e]
- (test (.. sc comparator (compare (. sc entryKey e) key)) 0)))
-
-(defn subseq
- "sc must be a sorted collection, test(s) one of <, <=, > or
- >=. Returns a seq of those entries with keys ek for
- which (test (.. sc comparator (compare ek key)) 0) is true"
- ([#^clojure.lang.Sorted sc test key]
- (let [include (bound-fn sc test key)]
- (if (#{> >=} test)
- (when-let [[e :as s] (. sc seqFrom key true)]
- (if (include e) s (next s)))
- (take-while include (. sc seq true)))))
- ([#^clojure.lang.Sorted sc start-test start-key end-test end-key]
- (when-let [[e :as s] (. sc seqFrom start-key true)]
- (take-while (bound-fn sc end-test end-key)
- (if ((bound-fn sc start-test start-key) e) s (next s))))))
-
-(defn rsubseq
- "sc must be a sorted collection, test(s) one of <, <=, > or
- >=. Returns a reverse seq of those entries with keys ek for
- which (test (.. sc comparator (compare ek key)) 0) is true"
- ([#^clojure.lang.Sorted sc test key]
- (let [include (bound-fn sc test key)]
- (if (#{< <=} test)
- (when-let [[e :as s] (. sc seqFrom key false)]
- (if (include e) s (next s)))
- (take-while include (. sc seq false)))))
- ([#^clojure.lang.Sorted sc start-test start-key end-test end-key]
- (when-let [[e :as s] (. sc seqFrom end-key false)]
- (take-while (bound-fn sc start-test start-key)
- (if ((bound-fn sc end-test end-key) e) s (next s))))))
-
-(defn repeatedly
- "Takes a function of no args, presumably with side effects, and returns an infinite
- lazy sequence of calls to it"
- [f] (lazy-seq (cons (f) (repeatedly f))))
-
-(defn add-classpath
- "Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"
- [url] (. clojure.lang.RT addURL url))
-
-
-
-(defn hash
- "Returns the hash code of its argument"
- [x] (. clojure.lang.Util (hash x)))
-
-(defn interpose
- "Returns a lazy seq of the elements of coll separated by sep"
- [sep coll] (drop 1 (interleave (repeat sep) coll)))
-
-(defmacro definline
- "Experimental - like defmacro, except defines a named function whose
- body is the expansion, calls to which may be expanded inline as if
- it were a macro. Cannot be used with variadic (&) args."
- [name & decl]
- (let [[pre-args [args expr]] (split-with (comp not vector?) decl)]
- `(do
- (defn ~name ~@pre-args ~args ~(apply (eval (list `fn args expr)) args))
- (alter-meta! (var ~name) assoc :inline (fn ~args ~expr))
- (var ~name))))
-
-(defn empty
- "Returns an empty collection of the same category as coll, or nil"
- [coll]
- (when (instance? clojure.lang.IPersistentCollection coll)
- (.empty #^clojure.lang.IPersistentCollection coll)))
-
-(defmacro amap
- "Maps an expression across an array a, using an index named idx, and
- return value named ret, initialized to a clone of a, then setting each element of
- ret to the evaluation of expr, returning the new array ret."
- [a idx ret expr]
- `(let [a# ~a
- ~ret (aclone a#)]
- (loop [~idx (int 0)]
- (if (< ~idx (alength a#))
- (do
- (aset ~ret ~idx ~expr)
- (recur (unchecked-inc ~idx)))
- ~ret))))
-
-(defmacro areduce
- "Reduces an expression across an array a, using an index named idx,
- and return value named ret, initialized to init, setting ret to the evaluation of expr at
- each step, returning ret."
- [a idx ret init expr]
- `(let [a# ~a]
- (loop [~idx (int 0) ~ret ~init]
- (if (< ~idx (alength a#))
- (recur (unchecked-inc ~idx) ~expr)
- ~ret))))
-
-(defn float-array
- "Creates an array of floats"
- {:inline (fn [& args] `(. clojure.lang.Numbers float_array ~@args))
- :inline-arities #{1 2}}
- ([size-or-seq] (. clojure.lang.Numbers float_array size-or-seq))
- ([size init-val-or-seq] (. clojure.lang.Numbers float_array size init-val-or-seq)))
-
-(defn double-array
- "Creates an array of doubles"
- {:inline (fn [& args] `(. clojure.lang.Numbers double_array ~@args))
- :inline-arities #{1 2}}
- ([size-or-seq] (. clojure.lang.Numbers double_array size-or-seq))
- ([size init-val-or-seq] (. clojure.lang.Numbers double_array size init-val-or-seq)))
-
-(defn int-array
- "Creates an array of ints"
- {:inline (fn [& args] `(. clojure.lang.Numbers int_array ~@args))
- :inline-arities #{1 2}}
- ([size-or-seq] (. clojure.lang.Numbers int_array size-or-seq))
- ([size init-val-or-seq] (. clojure.lang.Numbers int_array size init-val-or-seq)))
-
-(defn long-array
- "Creates an array of ints"
- {:inline (fn [& args] `(. clojure.lang.Numbers long_array ~@args))
- :inline-arities #{1 2}}
- ([size-or-seq] (. clojure.lang.Numbers long_array size-or-seq))
- ([size init-val-or-seq] (. clojure.lang.Numbers long_array size init-val-or-seq)))
-
-(definline floats
- "Casts to float[]"
- [xs] `(. clojure.lang.Numbers floats ~xs))
-
-(definline ints
- "Casts to int[]"
- [xs] `(. clojure.lang.Numbers ints ~xs))
-
-(definline doubles
- "Casts to double[]"
- [xs] `(. clojure.lang.Numbers doubles ~xs))
-
-(definline longs
- "Casts to long[]"
- [xs] `(. clojure.lang.Numbers longs ~xs))
-
-(import '(java.util.concurrent BlockingQueue LinkedBlockingQueue))
-
-(defn seque
- "Creates a queued seq on another (presumably lazy) seq s. The queued
- seq will produce a concrete seq in the background, and can get up to
- n items ahead of the consumer. n-or-q can be an integer n buffer
- size, or an instance of java.util.concurrent BlockingQueue. Note
- that reading from a seque can block if the reader gets ahead of the
- producer."
- ([s] (seque 100 s))
- ([n-or-q s]
- (let [#^BlockingQueue q (if (instance? BlockingQueue n-or-q)
- n-or-q
- (LinkedBlockingQueue. (int n-or-q)))
- NIL (Object.) ;nil sentinel since LBQ doesn't support nils
- agt (agent (seq s))
- fill (fn [s]
- (try
- (loop [[x & xs :as s] s]
- (if s
- (if (.offer q (if (nil? x) NIL x))
- (recur xs)
- s)
- (.put q q))) ; q itself is eos sentinel
- (catch Exception e
- (.put q q)
- (throw e))))
- drain (fn drain []
- (lazy-seq
- (let [x (.take q)]
- (if (identical? x q) ;q itself is eos sentinel
- (do @agt nil) ;touch agent just to propagate errors
- (do
- (send-off agt fill)
- (cons (if (identical? x NIL) nil x) (drain)))))))]
- (send-off agt fill)
- (drain))))
-
-(defn class?
- "Returns true if x is an instance of Class"
- [x] (instance? Class x))
-
-(defn alter-var-root
- "Atomically alters the root binding of var v by applying f to its
- current value plus any args"
- [#^clojure.lang.Var v f & args] (.alterRoot v f args))
-
-(defn make-hierarchy
- "Creates a hierarchy object for use with derive, isa? etc."
- [] {:parents {} :descendants {} :ancestors {}})
-
-(def #^{:private true}
- global-hierarchy (make-hierarchy))
-
-(defn not-empty
- "If coll is empty, returns nil, else coll"
- [coll] (when (seq coll) coll))
-
-(defn bases
- "Returns the immediate superclass and direct interfaces of c, if any"
- [#^Class c]
- (let [i (.getInterfaces c)
- s (.getSuperclass c)]
- (not-empty
- (if s (cons s i) i))))
-
-(defn supers
- "Returns the immediate and indirect superclasses and interfaces of c, if any"
- [#^Class class]
- (loop [ret (set (bases class)) cs ret]
- (if (seq cs)
- (let [c (first cs) bs (bases c)]
- (recur (into ret bs) (into (disj cs c) bs)))
- (not-empty ret))))
-
-(defn isa?
- "Returns true if (= child parent), or child is directly or indirectly derived from
- parent, either via a Java type inheritance relationship or a
- relationship established via derive. h must be a hierarchy obtained
- from make-hierarchy, if not supplied defaults to the global
- hierarchy"
- ([child parent] (isa? global-hierarchy child parent))
- ([h child parent]
- (or (= child parent)
- (and (class? parent) (class? child)
- (. #^Class parent isAssignableFrom child))
- (contains? ((:ancestors h) child) parent)
- (and (class? child) (some #(contains? ((:ancestors h) %) parent) (supers child)))
- (and (vector? parent) (vector? child)
- (= (count parent) (count child))
- (loop [ret true i 0]
- (if (or (not ret) (= i (count parent)))
- ret
- (recur (isa? h (child i) (parent i)) (inc i))))))))
-
-(defn parents
- "Returns the immediate parents of tag, either via a Java type
- inheritance relationship or a relationship established via derive. h
- must be a hierarchy obtained from make-hierarchy, if not supplied
- defaults to the global hierarchy"
- ([tag] (parents global-hierarchy tag))
- ([h tag] (not-empty
- (let [tp (get (:parents h) tag)]
- (if (class? tag)
- (into (set (bases tag)) tp)
- tp)))))
-
-(defn ancestors
- "Returns the immediate and indirect parents of tag, either via a Java type
- inheritance relationship or a relationship established via derive. h
- must be a hierarchy obtained from make-hierarchy, if not supplied
- defaults to the global hierarchy"
- ([tag] (ancestors global-hierarchy tag))
- ([h tag] (not-empty
- (let [ta (get (:ancestors h) tag)]
- (if (class? tag)
- (let [superclasses (set (supers tag))]
- (reduce into superclasses
- (cons ta
- (map #(get (:ancestors h) %) superclasses))))
- ta)))))
-
-(defn descendants
- "Returns the immediate and indirect children of tag, through a
- relationship established via derive. h must be a hierarchy obtained
- from make-hierarchy, if not supplied defaults to the global
- hierarchy. Note: does not work on Java type inheritance
- relationships."
- ([tag] (descendants global-hierarchy tag))
- ([h tag] (if (class? tag)
- (throw (java.lang.UnsupportedOperationException. "Can't get descendants of classes"))
- (not-empty (get (:descendants h) tag)))))
-
-(defn derive
- "Establishes a parent/child relationship between parent and
- tag. Parent must be a namespace-qualified symbol or keyword and
- child can be either a namespace-qualified symbol or keyword or a
- class. h must be a hierarchy obtained from make-hierarchy, if not
- supplied defaults to, and modifies, the global hierarchy."
- ([tag parent]
- (assert (namespace parent))
- (assert (or (class? tag) (and (instance? clojure.lang.Named tag) (namespace tag))))
-
- (alter-var-root #'global-hierarchy derive tag parent) nil)
- ([h tag parent]
- (assert (not= tag parent))
- (assert (or (class? tag) (instance? clojure.lang.Named tag)))
- (assert (instance? clojure.lang.Named parent))
-
- (let [tp (:parents h)
- td (:descendants h)
- ta (:ancestors h)
- tf (fn [m source sources target targets]
- (reduce (fn [ret k]
- (assoc ret k
- (reduce conj (get targets k #{}) (cons target (targets target)))))
- m (cons source (sources source))))]
- (or
- (when-not (contains? (tp tag) parent)
- (when (contains? (ta tag) parent)
- (throw (Exception. (print-str tag "already has" parent "as ancestor"))))
- (when (contains? (ta parent) tag)
- (throw (Exception. (print-str "Cyclic derivation:" parent "has" tag "as ancestor"))))
- {:parents (assoc (:parents h) tag (conj (get tp tag #{}) parent))
- :ancestors (tf (:ancestors h) tag td parent ta)
- :descendants (tf (:descendants h) parent ta tag td)})
- h))))
-
-(defn underive
- "Removes a parent/child relationship between parent and
- tag. h must be a hierarchy obtained from make-hierarchy, if not
- supplied defaults to, and modifies, the global hierarchy."
- ([tag parent] (alter-var-root #'global-hierarchy underive tag parent) nil)
- ([h tag parent]
- (let [tp (:parents h)
- td (:descendants h)
- ta (:ancestors h)
- tf (fn [m source sources target targets]
- (reduce
- (fn [ret k]
- (assoc ret k
- (reduce disj (get targets k) (cons target (targets target)))))
- m (cons source (sources source))))]
- (if (contains? (tp tag) parent)
- {:parent (assoc (:parents h) tag (disj (get tp tag) parent))
- :ancestors (tf (:ancestors h) tag td parent ta)
- :descendants (tf (:descendants h) parent ta tag td)}
- h))))
-
-
-(defn distinct?
- "Returns true if no two of the arguments are ="
- {:tag Boolean}
- ([x] true)
- ([x y] (not (= x y)))
- ([x y & more]
- (if (not= x y)
- (loop [s #{x y} [x & etc :as xs] more]
- (if xs
- (if (contains? s x)
- false
- (recur (conj s x) etc))
- true))
- false)))
-
-(defn resultset-seq
- "Creates and returns a lazy sequence of structmaps corresponding to
- the rows in the java.sql.ResultSet rs"
- [#^java.sql.ResultSet rs]
- (let [rsmeta (. rs (getMetaData))
- idxs (range 1 (inc (. rsmeta (getColumnCount))))
- keys (map (comp keyword #(.toLowerCase #^String %))
- (map (fn [i] (. rsmeta (getColumnLabel i))) idxs))
- check-keys
- (or (apply distinct? keys)
- (throw (Exception. "ResultSet must have unique column labels")))
- row-struct (apply create-struct keys)
- row-values (fn [] (map (fn [#^Integer i] (. rs (getObject i))) idxs))
- rows (fn thisfn []
- (lazy-seq
- (when (. rs (next))
- (cons (apply struct row-struct (row-values)) (thisfn)))))]
- (rows)))
-
-(defn iterator-seq
- "Returns a seq on a java.util.Iterator. Note that most collections
- providing iterators implement Iterable and thus support seq directly."
- [iter]
- (clojure.lang.IteratorSeq/create iter))
-
-(defn enumeration-seq
- "Returns a seq on a java.util.Enumeration"
- [e]
- (clojure.lang.EnumerationSeq/create e))
-
-(defn format
- "Formats a string using java.lang.String.format, see java.util.Formatter for format
- string syntax"
- {:tag String}
- [fmt & args]
- (String/format fmt (to-array args)))
-
-(defn printf
- "Prints formatted output, as per format"
- [fmt & args]
- (print (apply format fmt args)))
-
-(def gen-class)
-
-(defmacro ns
- "Sets *ns* to the namespace named by name (unevaluated), creating it
- if needed. references can be zero or more of: (:refer-clojure ...)
- (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class)
- with the syntax of refer-clojure/require/use/import/load/gen-class
- respectively, except the arguments are unevaluated and need not be
- quoted. (:gen-class ...), when supplied, defaults to :name
- corresponding to the ns name, :main true, :impl-ns same as ns, and
- :init-impl-ns true. All options of gen-class are
- supported. The :gen-class directive is ignored when not
- compiling. If :gen-class is not supplied, when compiled only an
- nsname__init.class will be generated. If :refer-clojure is not used, a
- default (refer 'clojure) is used. Use of ns is preferred to
- individual calls to in-ns/require/use/import:
-
- (ns foo.bar
- (:refer-clojure :exclude [ancestors printf])
- (:require (clojure.contrib sql sql.tests))
- (:use (my.lib this that))
- (:import (java.util Date Timer Random)
- (java.sql Connection Statement)))"
-
- [name & references]
- (let [process-reference
- (fn [[kname & args]]
- `(~(symbol "clojure.core" (clojure.core/name kname))
- ~@(map #(list 'quote %) args)))
- docstring (when (string? (first references)) (first references))
- references (if docstring (next references) references)
- name (if docstring
- (with-meta name (assoc (meta name)
- :doc docstring))
- name)
- gen-class-clause (first (filter #(= :gen-class (first %)) references))
- gen-class-call
- (when gen-class-clause
- (list* `gen-class :name (.replace (str name) \- \_) :impl-ns name :main true (next gen-class-clause)))
- references (remove #(= :gen-class (first %)) references)]
- `(do
- (clojure.core/in-ns '~name)
- ~@(when gen-class-call (list gen-class-call))
- ~@(when (and (not= name 'clojure.core) (not-any? #(= :refer-clojure (first %)) references))
- `((clojure.core/refer '~'clojure.core)))
- ~@(map process-reference references))))
-
-(defmacro refer-clojure
- "Same as (refer 'clojure.core <filters>)"
- [& filters]
- `(clojure.core/refer '~'clojure.core ~@filters))
-
-(defmacro defonce
- "defs name to have the root value of the expr iff the named var has no root value,
- else expr is unevaluated"
- [name expr]
- `(let [v# (def ~name)]
- (when-not (.hasRoot v#)
- (def ~name ~expr))))
-
-;;;;;;;;;;; require/use/load, contributed by Stephen C. Gilardi ;;;;;;;;;;;;;;;;;;
-
-(defonce
- #^{:private true
- :doc "A ref to a sorted set of symbols representing loaded libs"}
- *loaded-libs* (ref (sorted-set)))
-
-(defonce
- #^{:private true
- :doc "the set of paths currently being loaded by this thread"}
- *pending-paths* #{})
-
-(defonce
- #^{:private true :doc
- "True while a verbose load is pending"}
- *loading-verbosely* false)
-
-(defn- throw-if
- "Throws an exception with a message if pred is true"
- [pred fmt & args]
- (when pred
- (let [#^String message (apply format fmt args)
- exception (Exception. message)
- raw-trace (.getStackTrace exception)
- boring? #(not= (.getMethodName #^StackTraceElement %) "doInvoke")
- trace (into-array (drop 2 (drop-while boring? raw-trace)))]
- (.setStackTrace exception trace)
- (throw exception))))
-
-(defn- libspec?
- "Returns true if x is a libspec"
- [x]
- (or (symbol? x)
- (and (vector? x)
- (or
- (nil? (second x))
- (keyword? (second x))))))
-
-(defn- prependss
- "Prepends a symbol or a seq to coll"
- [x coll]
- (if (symbol? x)
- (cons x coll)
- (concat x coll)))
-
-(defn- root-resource
- "Returns the root directory path for a lib"
- {:tag String}
- [lib]
- (str \/
- (.. (name lib)
- (replace \- \_)
- (replace \. \/))))
-
-(defn- root-directory
- "Returns the root resource path for a lib"
- [lib]
- (let [d (root-resource lib)]
- (subs d 0 (.lastIndexOf d "/"))))
-
-(def load)
-
-(defn- load-one
- "Loads a lib given its name. If need-ns, ensures that the associated
- namespace exists after loading. If require, records the load so any
- duplicate loads can be skipped."
- [lib need-ns require]
- (load (root-resource lib))
- (throw-if (and need-ns (not (find-ns lib)))
- "namespace '%s' not found after loading '%s'"
- lib (root-resource lib))
- (when require
- (dosync
- (commute *loaded-libs* conj lib))))
-
-(defn- load-all
- "Loads a lib given its name and forces a load of any libs it directly or
- indirectly loads. If need-ns, ensures that the associated namespace
- exists after loading. If require, records the load so any duplicate loads
- can be skipped."
- [lib need-ns require]
- (dosync
- (commute *loaded-libs* #(reduce conj %1 %2)
- (binding [*loaded-libs* (ref (sorted-set))]
- (load-one lib need-ns require)
- @*loaded-libs*))))
-
-(defn- load-lib
- "Loads a lib with options"
- [prefix lib & options]
- (throw-if (and prefix (pos? (.indexOf (name lib) (int \.))))
- "lib names inside prefix lists must not contain periods")
- (let [lib (if prefix (symbol (str prefix \. lib)) lib)
- opts (apply hash-map options)
- {:keys [as reload reload-all require use verbose]} opts
- loaded (contains? @*loaded-libs* lib)
- load (cond reload-all
- load-all
- (or reload (not require) (not loaded))
- load-one)
- need-ns (or as use)
- filter-opts (select-keys opts '(:exclude :only :rename))]
- (binding [*loading-verbosely* (or *loading-verbosely* verbose)]
- (if load
- (load lib need-ns require)
- (throw-if (and need-ns (not (find-ns lib)))
- "namespace '%s' not found" lib))
- (when (and need-ns *loading-verbosely*)
- (printf "(clojure.core/in-ns '%s)\n" (ns-name *ns*)))
- (when as
- (when *loading-verbosely*
- (printf "(clojure.core/alias '%s '%s)\n" as lib))
- (alias as lib))
- (when use
- (when *loading-verbosely*
- (printf "(clojure.core/refer '%s" lib)
- (doseq [opt filter-opts]
- (printf " %s '%s" (key opt) (print-str (val opt))))
- (printf ")\n"))
- (apply refer lib (mapcat seq filter-opts))))))
-
-(defn- load-libs
- "Loads libs, interpreting libspecs, prefix lists, and flags for
- forwarding to load-lib"
- [& args]
- (let [flags (filter keyword? args)
- opts (interleave flags (repeat true))
- args (filter (complement keyword?) args)]
- (doseq [arg args]
- (if (libspec? arg)
- (apply load-lib nil (prependss arg opts))
- (let [[prefix & args] arg]
- (throw-if (nil? prefix) "prefix cannot be nil")
- (doseq [arg args]
- (apply load-lib prefix (prependss arg opts))))))))
-
-;; Public
-
-(defn require
- "Loads libs, skipping any that are already loaded. Each argument is
- either a libspec that identifies a lib, a prefix list that identifies
- multiple libs whose names share a common prefix, or a flag that modifies
- how all the identified libs are loaded. Use :require in the ns macro
- in preference to calling this directly.
-
- Libs
-
- A 'lib' is a named set of resources in classpath whose contents define a
- library of Clojure code. Lib names are symbols and each lib is associated
- with a Clojure namespace and a Java package that share its name. A lib's
- name also locates its root directory within classpath using Java's
- package name to classpath-relative path mapping. All resources in a lib
- should be contained in the directory structure under its root directory.
- All definitions a lib makes should be in its associated namespace.
-
- 'require loads a lib by loading its root resource. The root resource path
- is derived from the root directory path by repeating its last component
- and appending '.clj'. For example, the lib 'x.y.z has root directory
- <classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj. The root
- resource should contain code to create the lib's namespace and load any
- additional lib resources.
-
- Libspecs
-
- A libspec is a lib name or a vector containing a lib name followed by
- options expressed as sequential keywords and arguments.
-
- Recognized options: :as
- :as takes a symbol as its argument and makes that symbol an alias to the
- lib's namespace in the current namespace.
-
- Prefix Lists
-
- It's common for Clojure code to depend on several libs whose names have
- the same prefix. When specifying libs, prefix lists can be used to reduce
- repetition. A prefix list contains the shared prefix followed by libspecs
- with the shared prefix removed from the lib names. After removing the
- prefix, the names that remain must not contain any periods.
-
- Flags
-
- A flag is a keyword.
- Recognized flags: :reload, :reload-all, :verbose
- :reload forces loading of all the identified libs even if they are
- already loaded
- :reload-all implies :reload and also forces loading of all libs that the
- identified libs directly or indirectly load via require or use
- :verbose triggers printing information about each load, alias, and refer"
-
- [& args]
- (apply load-libs :require args))
-
-(defn use
- "Like 'require, but also refers to each lib's namespace using
- clojure.core/refer. Use :use in the ns macro in preference to calling
- this directly.
-
- 'use accepts additional options in libspecs: :exclude, :only, :rename.
- The arguments and semantics for :exclude, :only, and :rename are the same
- as those documented for clojure.core/refer."
- [& args] (apply load-libs :require :use args))
-
-(defn loaded-libs
- "Returns a sorted set of symbols naming the currently loaded libs"
- [] @*loaded-libs*)
-
-(defn load
- "Loads Clojure code from resources in classpath. A path is interpreted as
- classpath-relative if it begins with a slash or relative to the root
- directory for the current namespace otherwise."
- [& paths]
- (doseq [#^String path paths]
- (let [#^String path (if (.startsWith path "/")
- path
- (str (root-directory (ns-name *ns*)) \/ path))]
- (when *loading-verbosely*
- (printf "(clojure.core/load \"%s\")\n" path)
- (flush))
-; (throw-if (*pending-paths* path)
-; "cannot load '%s' again while it is loading"
-; path)
- (when-not (*pending-paths* path)
- (binding [*pending-paths* (conj *pending-paths* path)]
- (clojure.lang.RT/load (.substring path 1)))))))
-
-(defn compile
- "Compiles the namespace named by the symbol lib into a set of
- classfiles. The source for the lib must be in a proper
- classpath-relative directory. The output files will go into the
- directory specified by *compile-path*, and that directory too must
- be in the classpath."
- [lib]
- (binding [*compile-files* true]
- (load-one lib true true))
- lib)
-
-;;;;;;;;;;;;; nested associative ops ;;;;;;;;;;;
-
-(defn get-in
- "returns the value in a nested associative structure, where ks is a sequence of keys"
- [m ks]
- (reduce get m ks))
-
-(defn assoc-in
- "Associates a value in a nested associative structure, where ks is a
- sequence of keys and v is the new value and returns a new nested structure.
- If any levels do not exist, hash-maps will be created."
- [m [k & ks] v]
- (if ks
- (assoc m k (assoc-in (get m k) ks v))
- (assoc m k v)))
-
-(defn update-in
- "'Updates' a value in a nested associative structure, where ks is a
- sequence of keys and f is a function that will take the old value
- and any supplied args and return the new value, and returns a new
- nested structure. If any levels do not exist, hash-maps will be
- created."
- ([m [k & ks] f & args]
- (if ks
- (assoc m k (apply update-in (get m k) ks f args))
- (assoc m k (apply f (get m k) args)))))
-
-
-(defn empty?
- "Returns true if coll has no items - same as (not (seq coll)).
- Please use the idiom (seq x) rather than (not (empty? x))"
- [coll] (not (seq coll)))
-
-(defn coll?
- "Returns true if x implements IPersistentCollection"
- [x] (instance? clojure.lang.IPersistentCollection x))
-
-(defn list?
- "Returns true if x implements IPersistentList"
- [x] (instance? clojure.lang.IPersistentList x))
-
-(defn set?
- "Returns true if x implements IPersistentSet"
- [x] (instance? clojure.lang.IPersistentSet x))
-
-(defn ifn?
- "Returns true if x implements IFn. Note that many data structures
- (e.g. sets and maps) implement IFn"
- [x] (instance? clojure.lang.IFn x))
-
-(defn fn?
- "Returns true if x implements Fn, i.e. is an object created via fn."
- [x] (instance? clojure.lang.Fn x))
-
-
-(defn associative?
- "Returns true if coll implements Associative"
- [coll] (instance? clojure.lang.Associative coll))
-
-(defn sequential?
- "Returns true if coll implements Sequential"
- [coll] (instance? clojure.lang.Sequential coll))
-
-(defn sorted?
- "Returns true if coll implements Sorted"
- [coll] (instance? clojure.lang.Sorted coll))
-
-(defn counted?
- "Returns true if coll implements count in constant time"
- [coll] (instance? clojure.lang.Counted coll))
-
-(defn reversible?
- "Returns true if coll implements Reversible"
- [coll] (instance? clojure.lang.Reversible coll))
-
-(def
- #^{:doc "bound in a repl thread to the most recent value printed"}
- *1)
-
-(def
- #^{:doc "bound in a repl thread to the second most recent value printed"}
- *2)
-
-(def
- #^{:doc "bound in a repl thread to the third most recent value printed"}
- *3)
-
-(def
- #^{:doc "bound in a repl thread to the most recent exception caught by the repl"}
- *e)
-
-(defmacro declare
- "defs the supplied var names with no bindings, useful for making forward declarations."
- [& names] `(do ~@(map #(list 'def %) names)))
-
-(defn trampoline
- "trampoline can be used to convert algorithms requiring mutual
- recursion without stack consumption. Calls f with supplied args, if
- any. If f returns a fn, calls that fn with no arguments, and
- continues to repeat, until the return value is not a fn, then
- returns that non-fn value. Note that if you want to return a fn as a
- final value, you must wrap it in some data structure and unpack it
- after trampoline returns."
- ([f]
- (let [ret (f)]
- (if (fn? ret)
- (recur ret)
- ret)))
- ([f & args]
- (trampoline #(apply f args))))
-
-(defn intern
- "Finds or creates a var named by the symbol name in the namespace
- ns (which can be a symbol or a namespace), setting its root binding
- to val if supplied. The namespace must exist. The var will adopt any
- metadata from the name symbol. Returns the var."
- ([ns #^clojure.lang.Symbol name]
- (let [v (clojure.lang.Var/intern (the-ns ns) name)]
- (when ^name (.setMeta v ^name))
- v))
- ([ns name val]
- (let [v (clojure.lang.Var/intern (the-ns ns) name val)]
- (when ^name (.setMeta v ^name))
- v)))
-
-(defmacro while
- "Repeatedly executes body while test expression is true. Presumes
- some side-effect will cause test to become false/nil. Returns nil"
- [test & body]
- `(loop []
- (when ~test
- ~@body
- (recur))))
-
-(defn memoize
- "Returns a memoized version of a referentially transparent function. The
- memoized version of the function keeps a cache of the mapping from arguments
- to results and, when calls with the same arguments are repeated often, has
- higher performance at the expense of higher memory use."
- [f]
- (let [mem (atom {})]
- (fn [& args]
- (if-let [e (find @mem args)]
- (val e)
- (let [ret (apply f args)]
- (swap! mem assoc args ret)
- ret)))))
-
-(defmacro condp
- "Takes a binary predicate, an expression, and a set of clauses.
- Each clause can take the form of either:
-
- test-expr result-expr
-
- test-expr :>> result-fn
-
- Note :>> is an ordinary keyword.
-
- For each clause, (pred test-expr expr) is evaluated. If it returns
- logical true, the clause is a match. If a binary clause matches, the
- result-expr is returned, if a ternary clause matches, its result-fn,
- which must be a unary function, is called with the result of the
- predicate as its argument, the result of that call being the return
- value of condp. A single default expression can follow the clauses,
- and its value will be returned if no clause matches. If no default
- expression is provided and no clause matches, an
- IllegalArgumentException is thrown."
-
- [pred expr & clauses]
- (let [gpred (gensym "pred__")
- gexpr (gensym "expr__")
- emit (fn emit [pred expr args]
- (let [[[a b c :as clause] more]
- (split-at (if (= :>> (second args)) 3 2) args)
- n (count clause)]
- (cond
- (= 0 n) `(throw (IllegalArgumentException. (str "No matching clause: " ~expr)))
- (= 1 n) a
- (= 2 n) `(if (~pred ~a ~expr)
- ~b
- ~(emit pred expr more))
- :else `(if-let [p# (~pred ~a ~expr)]
- (~c p#)
- ~(emit pred expr more)))))
- gres (gensym "res__")]
- `(let [~gpred ~pred
- ~gexpr ~expr]
- ~(emit gpred gexpr clauses))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; var documentation ;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defmacro add-doc {:private true} [name docstring]
- `(alter-meta! (var ~name) assoc :doc ~docstring))
-
-(add-doc *file*
- "The path of the file being evaluated, as a String.
-
- Evaluates to nil when there is no file, eg. in the REPL.")
-
-(add-doc *command-line-args*
- "A sequence of the supplied command line arguments, or nil if
- none were supplied")
-
-(add-doc *warn-on-reflection*
- "When set to true, the compiler will emit warnings when reflection is
- needed to resolve Java method calls or field accesses.
-
- Defaults to false.")
-
-(add-doc *compile-path*
- "Specifies the directory where 'compile' will write out .class
- files. This directory must be in the classpath for 'compile' to
- work.
-
- Defaults to \"classes\"")
-
-(add-doc *compile-files*
- "Set to true when compiling files, false otherwise.")
-
-(add-doc *ns*
- "A clojure.lang.Namespace object representing the current namespace.")
-
-(add-doc *in*
- "A java.io.Reader object representing standard input for read operations.
-
- Defaults to System/in, wrapped in a LineNumberingPushbackReader")
-
-(add-doc *out*
- "A java.io.Writer object representing standard output for print operations.
-
- Defaults to System/out")
-
-(add-doc *err*
- "A java.io.Writer object representing standard error for print operations.
-
- Defaults to System/err, wrapped in a PrintWriter")
-
-(add-doc *flush-on-newline*
- "When set to true, output will be flushed whenever a newline is printed.
-
- Defaults to true.")
-
-(add-doc *print-meta*
- "If set to logical true, when printing an object, its metadata will also
- be printed in a form that can be read back by the reader.
-
- Defaults to false.")
-
-(add-doc *print-dup*
- "When set to logical true, objects will be printed in a way that preserves
- their type when read in later.
-
- Defaults to false.")
-
-(add-doc *print-readably*
- "When set to logical false, strings and characters will be printed with
- non-alphanumeric characters converted to the appropriate escape sequences.
-
- Defaults to true")
-
-(add-doc *read-eval*
- "When set to logical false, the EvalReader (#=(...)) is disabled in the
- read/load in the thread-local binding.
- Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\"))
-
- Defaults to true")
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; helper files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(alter-meta! (find-ns 'clojure.core) assoc :doc "Fundamental library of the Clojure language")
-(load "core_proxy")
-(load "core_print")
-(load "genclass")
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; futures (needs proxy);;;;;;;;;;;;;;;;;;
-(defn future-call
- "Takes a function of no args and yields a future object that will
- invoke the function in another thread, and will cache the result and
- return it on all subsequent calls to deref/@. If the computation has
- not yet finished, calls to deref/@ will block."
- [#^Callable f]
- (let [fut (.submit clojure.lang.Agent/soloExecutor f)]
- (proxy [clojure.lang.IDeref java.util.concurrent.Future] []
- (deref [] (.get fut))
- (get ([] (.get fut))
- ([timeout unit] (.get fut timeout unit)))
- (isCancelled [] (.isCancelled fut))
- (isDone [] (.isDone fut))
- (cancel [interrupt?] (.cancel fut interrupt?)))))
-
-(defmacro future
- "Takes a body of expressions and yields a future object that will
- invoke the body in another thread, and will cache the result and
- return it on all subsequent calls to deref/@. If the computation has
- not yet finished, calls to deref/@ will block."
- [& body] `(future-call (fn [] ~@body)))
-
-(defn pmap
- "Like map, except f is applied in parallel. Semi-lazy in that the
- parallel computation stays ahead of the consumption, but doesn't
- realize the entire result unless required. Only useful for
- computationally intensive functions where the time of f dominates
- the coordination overhead."
- ([f coll]
- (let [n (+ 2 (.. Runtime getRuntime availableProcessors))
- rets (map #(future (f %)) coll)
- step (fn step [[x & xs :as vs] fs]
- (lazy-seq
- (if-let [s (seq fs)]
- (cons (deref x) (step xs (rest s)))
- (map deref vs))))]
- (step rets (drop n rets))))
- ([f coll & colls]
- (let [step (fn step [cs]
- (lazy-seq
- (let [ss (map seq cs)]
- (when (every? identity ss)
- (cons (map first ss) (step (map rest ss)))))))]
- (pmap #(apply f %) (step (cons coll colls))))))
-
-(defn pcalls
- "Executes the no-arg fns in parallel, returning a lazy sequence of
- their values"
- [& fns] (pmap #(%) fns))
-
-(defmacro pvalues
- "Returns a lazy sequence of the values of the exprs, which are
- evaluated in parallel"
- [& exprs]
- `(pcalls ~@(map #(list `fn [] %) exprs)))
-
-(defmacro letfn
- "Takes a vector of function specs and a body, and generates a set of
- bindings of functions to their names. All of the names are available
- in all of the definitions of the functions, as well as the body.
-
- fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"
- [fnspecs & body]
- `(letfn* ~(vec (interleave (map first fnspecs)
- (map #(cons `fn %) fnspecs)))
- ~@body))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; clojure version number ;;;;;;;;;;;;;;;;;;;;;;
-
-(let [version-stream (.getResourceAsStream (clojure.lang.RT/baseLoader)
- "clojure/version.properties")
- properties (doto (new java.util.Properties) (.load version-stream))
- prop (fn [k] (.getProperty properties (str "clojure.version." k)))
- clojure-version {:major (Integer/valueOf (prop "major"))
- :minor (Integer/valueOf (prop "minor"))
- :incremental (Integer/valueOf (prop "incremental"))
- :qualifier (prop "qualifier")}]
- (def *clojure-version*
- (if (not (= (prop "interim") "false"))
- (clojure.lang.RT/assoc clojure-version :interim true)
- clojure-version)))
-
-(add-doc *clojure-version*
- "The version info for Clojure core, as a map containing :major :minor
- :incremental and :qualifier keys. Feature releases may increment
- :minor and/or :major, bugfix releases will increment :incremental.
- Possible values of :qualifier include \"GA\", \"SNAPSHOT\", \"RC-x\" \"BETA-x\"")
-
-(defn
- clojure-version
- "Returns clojure version as a printable string."
- []
- (str (:major *clojure-version*)
- "."
- (:minor *clojure-version*)
- (when-let [i (:incremental *clojure-version*)]
- (str "." i))
- (when-let [q (:qualifier *clojure-version*)]
- (str "-" q))
- (when (:interim *clojure-version*)
- "-SNAPSHOT")))
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(in-ns 'clojure.core)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; printing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(import '(java.io Writer))
-
-(def
- #^{:doc "*print-length* controls how many items of each collection the
- printer will print. If it is bound to logical false, there is no
- limit. Otherwise, it must be bound to an integer indicating the maximum
- number of items of each collection to print. If a collection contains
- more items, the printer will print items up to the limit followed by
- '...' to represent the remaining items. The root binding is nil
- indicating no limit."}
- *print-length* nil)
-
-(def
- #^{:doc "*print-level* controls how many levels deep the printer will
- print nested objects. If it is bound to logical false, there is no
- limit. Otherwise, it must be bound to an integer indicating the maximum
- level to print. Each argument to print is at level 0; if an argument is a
- collection, its items are at level 1; and so on. If an object is a
- collection and is at a level greater than or equal to the value bound to
- *print-level*, the printer prints '#' to represent it. The root binding
- is nil indicating no limit."}
-*print-level* nil)
-
-(defn- print-sequential [#^String begin, print-one, #^String sep, #^String end, sequence, #^Writer w]
- (binding [*print-level* (and (not *print-dup*) *print-level* (dec *print-level*))]
- (if (and *print-level* (neg? *print-level*))
- (.write w "#")
- (do
- (.write w begin)
- (when-let [xs (seq sequence)]
- (if (and (not *print-dup*) *print-length*)
- (loop [[x & xs] xs
- print-length *print-length*]
- (if (zero? print-length)
- (.write w "...")
- (do
- (print-one x w)
- (when xs
- (.write w sep)
- (recur xs (dec print-length))))))
- (loop [[x & xs] xs]
- (print-one x w)
- (when xs
- (.write w sep)
- (recur xs)))))
- (.write w end)))))
-
-(defn- print-meta [o, #^Writer w]
- (when-let [m (meta o)]
- (when (and (pos? (count m))
- (or *print-dup*
- (and *print-meta* *print-readably*)))
- (.write w "#^")
- (if (and (= (count m) 1) (:tag m))
- (pr-on (:tag m) w)
- (pr-on m w))
- (.write w " "))))
-
-(defmethod print-method :default [o, #^Writer w]
- (print-method (vary-meta o #(dissoc % :type)) w))
-
-(defmethod print-method nil [o, #^Writer w]
- (.write w "nil"))
-
-(defmethod print-dup nil [o w] (print-method o w))
-
-(defn print-ctor [o print-args #^Writer w]
- (.write w "#=(")
- (.write w (.getName #^Class (class o)))
- (.write w ". ")
- (print-args o w)
- (.write w ")"))
-
-(defmethod print-method Object [o, #^Writer w]
- (.write w "#<")
- (.write w (.getSimpleName (class o)))
- (.write w " ")
- (.write w (str o))
- (.write w ">"))
-
-(defmethod print-method clojure.lang.Keyword [o, #^Writer w]
- (.write w (str o)))
-
-(defmethod print-dup clojure.lang.Keyword [o w] (print-method o w))
-
-(defmethod print-method Number [o, #^Writer w]
- (.write w (str o)))
-
-(defmethod print-dup Number [o, #^Writer w]
- (print-ctor o
- (fn [o w]
- (print-dup (str o) w))
- w))
-
-(defmethod print-dup clojure.lang.Fn [o, #^Writer w]
- (print-ctor o (fn [o w]) w))
-
-(prefer-method print-dup clojure.lang.IPersistentCollection clojure.lang.Fn)
-(prefer-method print-dup java.util.Map clojure.lang.Fn)
-(prefer-method print-dup java.util.Collection clojure.lang.Fn)
-
-(defmethod print-method Boolean [o, #^Writer w]
- (.write w (str o)))
-
-(defmethod print-dup Boolean [o w] (print-method o w))
-
-(defn print-simple [o, #^Writer w]
- (print-meta o w)
- (.write w (str o)))
-
-(defmethod print-method clojure.lang.Symbol [o, #^Writer w]
- (print-simple o w))
-
-(defmethod print-dup clojure.lang.Symbol [o w] (print-method o w))
-
-(defmethod print-method clojure.lang.Var [o, #^Writer w]
- (print-simple o w))
-
-(defmethod print-dup clojure.lang.Var [#^clojure.lang.Var o, #^Writer w]
- (.write w (str "#=(var " (.name (.ns o)) "/" (.sym o) ")")))
-
-(defmethod print-method clojure.lang.ISeq [o, #^Writer w]
- (print-meta o w)
- (print-sequential "(" pr-on " " ")" o w))
-
-(defmethod print-dup clojure.lang.ISeq [o w] (print-method o w))
-(defmethod print-dup clojure.lang.IPersistentList [o w] (print-method o w))
-(prefer-method print-method clojure.lang.IPersistentList clojure.lang.ISeq)
-(prefer-method print-dup clojure.lang.IPersistentList clojure.lang.ISeq)
-(prefer-method print-method clojure.lang.ISeq clojure.lang.IPersistentCollection)
-(prefer-method print-dup clojure.lang.ISeq clojure.lang.IPersistentCollection)
-(prefer-method print-method clojure.lang.ISeq java.util.Collection)
-(prefer-method print-dup clojure.lang.ISeq java.util.Collection)
-
-(defmethod print-method clojure.lang.IPersistentList [o, #^Writer w]
- (print-meta o w)
- (print-sequential "(" print-method " " ")" o w))
-
-
-(defmethod print-dup java.util.Collection [o, #^Writer w]
- (print-ctor o #(print-sequential "[" print-dup " " "]" %1 %2) w))
-
-(defmethod print-dup clojure.lang.IPersistentCollection [o, #^Writer w]
- (print-meta o w)
- (.write w "#=(")
- (.write w (.getName #^Class (class o)))
- (.write w "/create ")
- (print-sequential "[" print-dup " " "]" o w)
- (.write w ")"))
-
-(prefer-method print-dup clojure.lang.IPersistentCollection java.util.Collection)
-
-(def #^{:tag String
- :doc "Returns escape string for char or nil if none"}
- char-escape-string
- {\newline "\\n"
- \tab "\\t"
- \return "\\r"
- \" "\\\""
- \\ "\\\\"
- \formfeed "\\f"
- \backspace "\\b"})
-
-(defmethod print-method String [#^String s, #^Writer w]
- (if (or *print-dup* *print-readably*)
- (do (.append w \")
- (dotimes [n (count s)]
- (let [c (.charAt s n)
- e (char-escape-string c)]
- (if e (.write w e) (.append w c))))
- (.append w \"))
- (.write w s))
- nil)
-
-(defmethod print-dup String [s w] (print-method s w))
-
-(defmethod print-method clojure.lang.IPersistentVector [v, #^Writer w]
- (print-meta v w)
- (print-sequential "[" pr-on " " "]" v w))
-
-(defn- print-map [m print-one w]
- (print-sequential
- "{"
- (fn [e #^Writer w]
- (do (print-one (key e) w) (.append w \space) (print-one (val e) w)))
- ", "
- "}"
- (seq m) w))
-
-(defmethod print-method clojure.lang.IPersistentMap [m, #^Writer w]
- (print-meta m w)
- (print-map m pr-on w))
-
-(defmethod print-dup java.util.Map [m, #^Writer w]
- (print-ctor m #(print-map (seq %1) print-dup %2) w))
-
-(defmethod print-dup clojure.lang.IPersistentMap [m, #^Writer w]
- (print-meta m w)
- (.write w "#=(")
- (.write w (.getName (class m)))
- (.write w "/create ")
- (print-map m print-dup w)
- (.write w ")"))
-
-(prefer-method print-dup clojure.lang.IPersistentCollection java.util.Map)
-
-(defmethod print-method clojure.lang.IPersistentSet [s, #^Writer w]
- (print-meta s w)
- (print-sequential "#{" pr-on " " "}" (seq s) w))
-
-(def #^{:tag String
- :doc "Returns name string for char or nil if none"}
- char-name-string
- {\newline "newline"
- \tab "tab"
- \space "space"
- \backspace "backspace"
- \formfeed "formfeed"
- \return "return"})
-
-(defmethod print-method java.lang.Character [#^Character c, #^Writer w]
- (if (or *print-dup* *print-readably*)
- (do (.append w \\)
- (let [n (char-name-string c)]
- (if n (.write w n) (.append w c))))
- (.append w c))
- nil)
-
-(defmethod print-dup java.lang.Character [c w] (print-method c w))
-(defmethod print-dup java.lang.Integer [o w] (print-method o w))
-(defmethod print-dup java.lang.Double [o w] (print-method o w))
-(defmethod print-dup clojure.lang.Ratio [o w] (print-method o w))
-(defmethod print-dup java.math.BigDecimal [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentHashMap [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentHashSet [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentVector [o w] (print-method o w))
-(defmethod print-dup clojure.lang.LazilyPersistentVector [o w] (print-method o w))
-
-(def primitives-classnames
- {Float/TYPE "Float/TYPE"
- Integer/TYPE "Integer/TYPE"
- Long/TYPE "Long/TYPE"
- Boolean/TYPE "Boolean/TYPE"
- Character/TYPE "Character/TYPE"
- Double/TYPE "Double/TYPE"
- Byte/TYPE "Byte/TYPE"
- Short/TYPE "Short/TYPE"})
-
-(defmethod print-method Class [#^Class c, #^Writer w]
- (.write w (.getName c)))
-
-(defmethod print-dup Class [#^Class c, #^Writer w]
- (cond
- (.isPrimitive c) (do
- (.write w "#=(identity ")
- (.write w #^String (primitives-classnames c))
- (.write w ")"))
- (.isArray c) (do
- (.write w "#=(java.lang.Class/forName \"")
- (.write w (.getName c))
- (.write w "\")"))
- :else (do
- (.write w "#=")
- (.write w (.getName c)))))
-
-(defmethod print-method java.math.BigDecimal [b, #^Writer w]
- (.write w (str b))
- (.write w "M"))
-
-(defmethod print-method java.util.regex.Pattern [p #^Writer w]
- (.write w "#\"")
- (loop [[#^Character c & r :as s] (seq (.pattern #^java.util.regex.Pattern p))
- qmode false]
- (when s
- (cond
- (= c \\) (let [[#^Character c2 & r2] r]
- (.append w \\)
- (.append w c2)
- (if qmode
- (recur r2 (not= c2 \E))
- (recur r2 (= c2 \Q))))
- (= c \") (do
- (if qmode
- (.write w "\\E\\\"\\Q")
- (.write w "\\\""))
- (recur r qmode))
- :else (do
- (.append w c)
- (recur r qmode)))))
- (.append w \"))
-
-(defmethod print-dup java.util.regex.Pattern [p #^Writer w] (print-method p w))
-
-(defmethod print-dup clojure.lang.Namespace [#^clojure.lang.Namespace n #^Writer w]
- (.write w "#=(find-ns ")
- (print-dup (.name n) w)
- (.write w ")"))
-
-(defmethod print-method clojure.lang.IDeref [o #^Writer w]
- (print-sequential (format "#<%s@%x: "
- (.getSimpleName (class o))
- (System/identityHashCode o))
- pr-on, "", ">", (list @o), w))
-
-(def #^{:private true} print-initialized true)
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(in-ns 'clojure.core)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;; proxy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(import
- '(clojure.asm ClassWriter ClassVisitor Opcodes Type)
- '(java.lang.reflect Modifier Constructor)
- '(clojure.asm.commons Method GeneratorAdapter)
- '(clojure.lang IProxy Reflector DynamicClassLoader IPersistentMap PersistentHashMap RT))
-
-(defn method-sig [#^java.lang.reflect.Method meth]
- [(. meth (getName)) (seq (. meth (getParameterTypes))) (. meth getReturnType)])
-
-(defn- most-specific [rtypes]
- (or (some (fn [t] (when (every? #(isa? t %) rtypes) t)) rtypes)
- (throw (Exception. "Incompatible return types"))))
-
-(defn- group-by-sig [coll]
- "takes a collection of [msig meth] and returns a seq of maps from return-types to meths."
- (vals (reduce (fn [m [msig meth]]
- (let [rtype (peek msig)
- argsig (pop msig)]
- (assoc m argsig (assoc (m argsig {}) rtype meth))))
- {} coll)))
-
-(defn proxy-name
- {:tag String}
- [#^Class super interfaces]
- (apply str "clojure.proxy."
- (.getName super)
- (interleave (repeat "$")
- (sort (map #(.getSimpleName #^Class %) interfaces)))))
-
-(defn- generate-proxy [#^Class super interfaces]
- (let [cv (new ClassWriter (. ClassWriter COMPUTE_MAXS))
- cname (.replace (proxy-name super interfaces) \. \/) ;(str "clojure/lang/" (gensym "Proxy__"))
- ctype (. Type (getObjectType cname))
- iname (fn [#^Class c] (.. Type (getType c) (getInternalName)))
- fmap "__clojureFnMap"
- totype (fn [#^Class c] (. Type (getType c)))
- to-types (fn [cs] (if (pos? (count cs))
- (into-array (map totype cs))
- (make-array Type 0)))
- super-type #^Type (totype super)
- imap-type #^Type (totype IPersistentMap)
- ifn-type (totype clojure.lang.IFn)
- obj-type (totype Object)
- sym-type (totype clojure.lang.Symbol)
- rt-type (totype clojure.lang.RT)
- ex-type (totype java.lang.UnsupportedOperationException)
- gen-bridge
- (fn [#^java.lang.reflect.Method meth #^java.lang.reflect.Method dest]
- (let [pclasses (. meth (getParameterTypes))
- ptypes (to-types pclasses)
- rtype #^Type (totype (. meth (getReturnType)))
- m (new Method (. meth (getName)) rtype ptypes)
- dtype (totype (.getDeclaringClass dest))
- dm (new Method (. dest (getName)) (totype (. dest (getReturnType))) (to-types (. dest (getParameterTypes))))
- gen (new GeneratorAdapter (bit-or (. Opcodes ACC_PUBLIC) (. Opcodes ACC_BRIDGE)) m nil nil cv)]
- (. gen (visitCode))
- (. gen (loadThis))
- (dotimes [i (count ptypes)]
- (. gen (loadArg i)))
- (if (-> dest .getDeclaringClass .isInterface)
- (. gen (invokeInterface dtype dm))
- (. gen (invokeVirtual dtype dm)))
- (. gen (returnValue))
- (. gen (endMethod))))
- gen-method
- (fn [#^java.lang.reflect.Method meth else-gen]
- (let [pclasses (. meth (getParameterTypes))
- ptypes (to-types pclasses)
- rtype #^Type (totype (. meth (getReturnType)))
- m (new Method (. meth (getName)) rtype ptypes)
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)
- else-label (. gen (newLabel))
- end-label (. gen (newLabel))
- decl-type (. Type (getType (. meth (getDeclaringClass))))]
- (. gen (visitCode))
- (if (> (count pclasses) 18)
- (else-gen gen m)
- (do
- (. gen (loadThis))
- (. gen (getField ctype fmap imap-type))
-
- (. gen (push (. meth (getName))))
- ;lookup fn in map
- (. gen (invokeStatic rt-type (. Method (getMethod "Object get(Object, Object)"))))
- (. gen (dup))
- (. gen (ifNull else-label))
- ;if found
- (.checkCast gen ifn-type)
- (. gen (loadThis))
- ;box args
- (dotimes [i (count ptypes)]
- (. gen (loadArg i))
- (. clojure.lang.Compiler$HostExpr (emitBoxReturn nil gen (nth pclasses i))))
- ;call fn
- (. gen (invokeInterface ifn-type (new Method "invoke" obj-type
- (into-array (cons obj-type
- (replicate (count ptypes) obj-type))))))
- ;unbox return
- (. gen (unbox rtype))
- (when (= (. rtype (getSort)) (. Type VOID))
- (. gen (pop)))
- (. gen (goTo end-label))
-
- ;else call supplied alternative generator
- (. gen (mark else-label))
- (. gen (pop))
-
- (else-gen gen m)
-
- (. gen (mark end-label))))
- (. gen (returnValue))
- (. gen (endMethod))))]
-
- ;start class definition
- (. cv (visit (. Opcodes V1_5) (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_SUPER))
- cname nil (iname super)
- (into-array (map iname (cons IProxy interfaces)))))
- ;add field for fn mappings
- (. cv (visitField (+ (. Opcodes ACC_PRIVATE) (. Opcodes ACC_VOLATILE))
- fmap (. imap-type (getDescriptor)) nil nil))
- ;add ctors matching/calling super's
- (doseq [#^Constructor ctor (. super (getDeclaredConstructors))]
- (when-not (. Modifier (isPrivate (. ctor (getModifiers))))
- (let [ptypes (to-types (. ctor (getParameterTypes)))
- m (new Method "<init>" (. Type VOID_TYPE) ptypes)
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)]
- (. gen (visitCode))
- ;call super ctor
- (. gen (loadThis))
- (. gen (dup))
- (. gen (loadArgs))
- (. gen (invokeConstructor super-type m))
-
- (. gen (returnValue))
- (. gen (endMethod)))))
- ;add IProxy methods
- (let [m (. Method (getMethod "void __initClojureFnMappings(clojure.lang.IPersistentMap)"))
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)]
- (. gen (visitCode))
- (. gen (loadThis))
- (. gen (loadArgs))
- (. gen (putField ctype fmap imap-type))
-
- (. gen (returnValue))
- (. gen (endMethod)))
- (let [m (. Method (getMethod "void __updateClojureFnMappings(clojure.lang.IPersistentMap)"))
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)]
- (. gen (visitCode))
- (. gen (loadThis))
- (. gen (dup))
- (. gen (getField ctype fmap imap-type))
- (.checkCast gen (totype clojure.lang.IPersistentCollection))
- (. gen (loadArgs))
- (. gen (invokeInterface (totype clojure.lang.IPersistentCollection)
- (. Method (getMethod "clojure.lang.IPersistentCollection cons(Object)"))))
- (. gen (checkCast imap-type))
- (. gen (putField ctype fmap imap-type))
-
- (. gen (returnValue))
- (. gen (endMethod)))
- (let [m (. Method (getMethod "clojure.lang.IPersistentMap __getClojureFnMappings()"))
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)]
- (. gen (visitCode))
- (. gen (loadThis))
- (. gen (getField ctype fmap imap-type))
- (. gen (returnValue))
- (. gen (endMethod)))
-
- ;calc set of supers' non-private instance methods
- (let [[mm considered]
- (loop [mm {} considered #{} c super]
- (if c
- (let [[mm considered]
- (loop [mm mm
- considered considered
- meths (concat
- (seq (. c (getDeclaredMethods)))
- (seq (. c (getMethods))))]
- (if (seq meths)
- (let [#^java.lang.reflect.Method meth (first meths)
- mods (. meth (getModifiers))
- mk (method-sig meth)]
- (if (or (considered mk)
- (not (or (Modifier/isPublic mods) (Modifier/isProtected mods)))
- ;(. Modifier (isPrivate mods))
- (. Modifier (isStatic mods))
- (. Modifier (isFinal mods))
- (= "finalize" (.getName meth)))
- (recur mm (conj considered mk) (next meths))
- (recur (assoc mm mk meth) (conj considered mk) (next meths))))
- [mm considered]))]
- (recur mm considered (. c (getSuperclass))))
- [mm considered]))
- ifaces-meths (into {}
- (for [#^Class iface interfaces meth (. iface (getMethods))
- :let [msig (method-sig meth)] :when (not (considered msig))]
- {msig meth}))
- mgroups (group-by-sig (concat mm ifaces-meths))
- rtypes (map #(most-specific (keys %)) mgroups)
- mb (map #(vector (%1 %2) (vals (dissoc %1 %2))) mgroups rtypes)
- bridge? (reduce into #{} (map second mb))
- ifaces-meths (remove bridge? (vals ifaces-meths))
- mm (remove bridge? (vals mm))]
- ;add methods matching supers', if no mapping -> call super
- (doseq [[#^java.lang.reflect.Method dest bridges] mb
- #^java.lang.reflect.Method meth bridges]
- (gen-bridge meth dest))
- (doseq [#^java.lang.reflect.Method meth mm]
- (gen-method meth
- (fn [#^GeneratorAdapter gen #^Method m]
- (. gen (loadThis))
- ;push args
- (. gen (loadArgs))
- ;call super
- (. gen (visitMethodInsn (. Opcodes INVOKESPECIAL)
- (. super-type (getInternalName))
- (. m (getName))
- (. m (getDescriptor)))))))
-
- ;add methods matching interfaces', if no mapping -> throw
- (doseq [#^java.lang.reflect.Method meth ifaces-meths]
- (gen-method meth
- (fn [#^GeneratorAdapter gen #^Method m]
- (. gen (throwException ex-type (. m (getName))))))))
-
- ;finish class def
- (. cv (visitEnd))
- [cname (. cv toByteArray)]))
-
-(defn- get-super-and-interfaces [bases]
- (if (. #^Class (first bases) (isInterface))
- [Object bases]
- [(first bases) (next bases)]))
-
-(defn get-proxy-class
- "Takes an optional single class followed by zero or more
- interfaces. If not supplied class defaults to Object. Creates an
- returns an instance of a proxy class derived from the supplied
- classes. The resulting value is cached and used for any subsequent
- requests for the same class set. Returns a Class object."
- [& bases]
- (let [[super interfaces] (get-super-and-interfaces bases)
- pname (proxy-name super interfaces)]
- (or (RT/loadClassForName pname)
- (let [[cname bytecode] (generate-proxy super interfaces)]
- (. (RT/getRootClassLoader) (defineClass pname bytecode))))))
-
-(defn construct-proxy
- "Takes a proxy class and any arguments for its superclass ctor and
- creates and returns an instance of the proxy."
- [c & ctor-args]
- (. Reflector (invokeConstructor c (to-array ctor-args))))
-
-(defn init-proxy
- "Takes a proxy instance and a map of strings (which must
- correspond to methods of the proxy superclass/superinterfaces) to
- fns (which must take arguments matching the corresponding method,
- plus an additional (explicit) first arg corresponding to this, and
- sets the proxy's fn map."
- [#^IProxy proxy mappings]
- (. proxy (__initClojureFnMappings mappings)))
-
-(defn update-proxy
- "Takes a proxy instance and a map of strings (which must
- correspond to methods of the proxy superclass/superinterfaces) to
- fns (which must take arguments matching the corresponding method,
- plus an additional (explicit) first arg corresponding to this, and
- updates (via assoc) the proxy's fn map. nil can be passed instead of
- a fn, in which case the corresponding method will revert to the
- default behavior. Note that this function can be used to update the
- behavior of an existing instance without changing its identity."
- [#^IProxy proxy mappings]
- (. proxy (__updateClojureFnMappings mappings)))
-
-(defn proxy-mappings
- "Takes a proxy instance and returns the proxy's fn map."
- [#^IProxy proxy]
- (. proxy (__getClojureFnMappings)))
-
-(defmacro proxy
- "class-and-interfaces - a vector of class names
-
- args - a (possibly empty) vector of arguments to the superclass
- constructor.
-
- f => (name [params*] body) or
- (name ([params*] body) ([params+] body) ...)
-
- Expands to code which creates a instance of a proxy class that
- implements the named class/interface(s) by calling the supplied
- fns. A single class, if provided, must be first. If not provided it
- defaults to Object.
-
- The interfaces names must be valid interface types. If a method fn
- is not provided for a class method, the superclass methd will be
- called. If a method fn is not provided for an interface method, an
- UnsupportedOperationException will be thrown should it be
- called. Method fns are closures and can capture the environment in
- which proxy is called. Each method fn takes an additional implicit
- first arg, which is bound to 'this. Note that while method fns can
- be provided to override protected methods, they have no other access
- to protected members, nor to super, as these capabilities cannot be
- proxied."
- [class-and-interfaces args & fs]
- (let [bases (map #(or (resolve %) (throw (Exception. (str "Can't resolve: " %))))
- class-and-interfaces)
- [super interfaces] (get-super-and-interfaces bases)
- compile-effect (when *compile-files*
- (let [[cname bytecode] (generate-proxy super interfaces)]
- (clojure.lang.Compiler/writeClassFile cname bytecode)))
- pc-effect (apply get-proxy-class bases)
- pname (proxy-name super interfaces)]
- `(let [;pc# (get-proxy-class ~@class-and-interfaces)
- p# (new ~(symbol pname) ~@args)] ;(construct-proxy pc# ~@args)]
- (init-proxy p#
- ~(loop [fmap {} fs fs]
- (if fs
- (let [[sym & meths] (first fs)
- meths (if (vector? (first meths))
- (list meths)
- meths)
- meths (map (fn [[params & body]]
- (cons (apply vector 'this params) body))
- meths)]
- (if-not (contains? fmap (name sym))
- (recur (assoc fmap (name sym) (cons `fn meths)) (next fs))
- (throw (IllegalArgumentException.
- (str "Method '" (name sym) "' redefined")))))
- fmap)))
- p#)))
-
-(defn proxy-call-with-super [call this meth]
- (let [m (proxy-mappings this)]
- (update-proxy this (assoc m meth nil))
- (let [ret (call)]
- (update-proxy this m)
- ret)))
-
-(defmacro proxy-super
- "Use to call a superclass method in the body of a proxy method.
- Note, expansion captures 'this"
- [meth & args]
- `(proxy-call-with-super (fn [] (. ~'this ~meth ~@args)) ~'this ~(name meth)))
-
-(defn bean
- "Takes a Java object and returns a read-only implementation of the
- map abstraction based upon its JavaBean properties."
- [#^Object x]
- (let [c (. x (getClass))
- pmap (reduce (fn [m #^java.beans.PropertyDescriptor pd]
- (let [name (. pd (getName))
- method (. pd (getReadMethod))]
- (if (and method (zero? (alength (. method (getParameterTypes)))))
- (assoc m (keyword name) (fn [] (clojure.lang.Reflector/prepRet (. method (invoke x nil)))))
- m)))
- {}
- (seq (.. java.beans.Introspector
- (getBeanInfo c)
- (getPropertyDescriptors))))
- v (fn [k] ((pmap k)))
- snapshot (fn []
- (reduce (fn [m e]
- (assoc m (key e) ((val e))))
- {} (seq pmap)))]
- (proxy [clojure.lang.APersistentMap]
- []
- (containsKey [k] (contains? pmap k))
- (entryAt [k] (when (contains? pmap k) (new clojure.lang.MapEntry k (v k))))
- (valAt ([k] (v k))
- ([k default] (if (contains? pmap k) (v k) default)))
- (cons [m] (conj (snapshot) m))
- (count [] (count pmap))
- (assoc [k v] (assoc (snapshot) k v))
- (without [k] (dissoc (snapshot) k))
- (seq [] ((fn thisfn [plseq]
- (lazy-seq
- (when-let [pseq (seq plseq)]
- (cons (new clojure.lang.MapEntry (first pseq) (v (first pseq)))
- (thisfn (rest pseq)))))) (keys pmap))))))
-
-
-
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(in-ns 'clojure.core)
-
-(import '(java.lang.reflect Modifier Constructor)
- '(clojure.asm ClassWriter ClassVisitor Opcodes Type)
- '(clojure.asm.commons Method GeneratorAdapter)
- '(clojure.lang IPersistentMap))
-
-;(defn method-sig [#^java.lang.reflect.Method meth]
-; [(. meth (getName)) (seq (. meth (getParameterTypes)))])
-
-(defn- non-private-methods [#^Class c]
- (loop [mm {}
- considered #{}
- c c]
- (if c
- (let [[mm considered]
- (loop [mm mm
- considered considered
- meths (seq (concat
- (seq (. c (getDeclaredMethods)))
- (seq (. c (getMethods)))))]
- (if meths
- (let [#^java.lang.reflect.Method meth (first meths)
- mods (. meth (getModifiers))
- mk (method-sig meth)]
- (if (or (considered mk)
- (not (or (Modifier/isPublic mods) (Modifier/isProtected mods)))
- ;(. Modifier (isPrivate mods))
- (. Modifier (isStatic mods))
- (. Modifier (isFinal mods))
- (= "finalize" (.getName meth)))
- (recur mm (conj considered mk) (next meths))
- (recur (assoc mm mk meth) (conj considered mk) (next meths))))
- [mm considered]))]
- (recur mm considered (. c (getSuperclass))))
- mm)))
-
-(defn- ctor-sigs [#^Class super]
- (for [#^Constructor ctor (. super (getDeclaredConstructors))
- :when (not (. Modifier (isPrivate (. ctor (getModifiers)))))]
- (apply vector (. ctor (getParameterTypes)))))
-
-(defn- escape-class-name [#^Class c]
- (.. (.getSimpleName c)
- (replace "[]" "<>")))
-
-(defn- overload-name [mname pclasses]
- (if (seq pclasses)
- (apply str mname (interleave (repeat \-)
- (map escape-class-name pclasses)))
- (str mname "-void")))
-
-(defn- #^java.lang.reflect.Field find-field [#^Class c f]
- (let [start-class c]
- (loop [c c]
- (if (= c Object)
- (throw (new Exception (str "field, " f ", not defined in class, " start-class ", or its ancestors")))
- (let [dflds (.getDeclaredFields c)
- rfld (first (filter #(= f (.getName #^java.lang.reflect.Field %)) dflds))]
- (or rfld (recur (.getSuperclass c))))))))
-
-;(distinct (map first(keys (mapcat non-private-methods [Object IPersistentMap]))))
-
-(def #^{:private true} prim->class
- {'int Integer/TYPE
- 'long Long/TYPE
- 'float Float/TYPE
- 'double Double/TYPE
- 'void Void/TYPE
- 'short Short/TYPE
- 'boolean Boolean/TYPE
- 'byte Byte/TYPE
- 'char Character/TYPE})
-
-(defn- #^Class the-class [x]
- (cond
- (class? x) x
- (contains? prim->class x) (prim->class x)
- :else (let [strx (str x)]
- (clojure.lang.RT/classForName
- (if (some #{\.} strx)
- strx
- (str "java.lang." strx))))))
-
-(defn- generate-class [options-map]
- (let [default-options {:prefix "-" :load-impl-ns true :impl-ns (ns-name *ns*)}
- {:keys [name extends implements constructors methods main factory state init exposes
- exposes-methods prefix load-impl-ns impl-ns post-init]}
- (merge default-options options-map)
- name (str name)
- super (if extends (the-class extends) Object)
- interfaces (map the-class implements)
- supers (cons super interfaces)
- ctor-sig-map (or constructors (zipmap (ctor-sigs super) (ctor-sigs super)))
- cv (new ClassWriter (. ClassWriter COMPUTE_MAXS))
- cname (. name (replace "." "/"))
- pkg-name name
- impl-pkg-name (str impl-ns)
- impl-cname (.. impl-pkg-name (replace "." "/") (replace \- \_))
- ctype (. Type (getObjectType cname))
- iname (fn [#^Class c] (.. Type (getType c) (getInternalName)))
- totype (fn [#^Class c] (. Type (getType c)))
- to-types (fn [cs] (if (pos? (count cs))
- (into-array (map totype cs))
- (make-array Type 0)))
- obj-type #^Type (totype Object)
- arg-types (fn [n] (if (pos? n)
- (into-array (replicate n obj-type))
- (make-array Type 0)))
- super-type #^Type (totype super)
- init-name (str init)
- post-init-name (str post-init)
- factory-name (str factory)
- state-name (str state)
- main-name "main"
- var-name (fn [s] (str s "__var"))
- class-type (totype Class)
- rt-type (totype clojure.lang.RT)
- var-type #^Type (totype clojure.lang.Var)
- ifn-type (totype clojure.lang.IFn)
- iseq-type (totype clojure.lang.ISeq)
- ex-type (totype java.lang.UnsupportedOperationException)
- all-sigs (distinct (concat (map #(let[[m p] (key %)] {m [p]}) (mapcat non-private-methods supers))
- (map (fn [[m p]] {(str m) [p]}) methods)))
- sigs-by-name (apply merge-with concat {} all-sigs)
- overloads (into {} (filter (fn [[m s]] (next s)) sigs-by-name))
- var-fields (concat (when init [init-name])
- (when post-init [post-init-name])
- (when main [main-name])
- ;(when exposes-methods (map str (vals exposes-methods)))
- (distinct (concat (keys sigs-by-name)
- (mapcat (fn [[m s]] (map #(overload-name m (map the-class %)) s)) overloads)
- (mapcat (comp (partial map str) vals val) exposes))))
- emit-get-var (fn [#^GeneratorAdapter gen v]
- (let [false-label (. gen newLabel)
- end-label (. gen newLabel)]
- (. gen getStatic ctype (var-name v) var-type)
- (. gen dup)
- (. gen invokeVirtual var-type (. Method (getMethod "boolean isBound()")))
- (. gen ifZCmp (. GeneratorAdapter EQ) false-label)
- (. gen invokeVirtual var-type (. Method (getMethod "Object get()")))
- (. gen goTo end-label)
- (. gen mark false-label)
- (. gen pop)
- (. gen visitInsn (. Opcodes ACONST_NULL))
- (. gen mark end-label)))
- emit-unsupported (fn [#^GeneratorAdapter gen #^Method m]
- (. gen (throwException ex-type (str (. m (getName)) " ("
- impl-pkg-name "/" prefix (.getName m)
- " not defined?)"))))
- emit-forwarding-method
- (fn [mname pclasses rclass as-static else-gen]
- (let [pclasses (map the-class pclasses)
- rclass (the-class rclass)
- ptypes (to-types pclasses)
- rtype #^Type (totype rclass)
- m (new Method mname rtype ptypes)
- is-overload (seq (overloads mname))
- gen (new GeneratorAdapter (+ (. Opcodes ACC_PUBLIC) (if as-static (. Opcodes ACC_STATIC) 0))
- m nil nil cv)
- found-label (. gen (newLabel))
- else-label (. gen (newLabel))
- end-label (. gen (newLabel))]
- (. gen (visitCode))
- (if (> (count pclasses) 18)
- (else-gen gen m)
- (do
- (when is-overload
- (emit-get-var gen (overload-name mname pclasses))
- (. gen (dup))
- (. gen (ifNonNull found-label))
- (. gen (pop)))
- (emit-get-var gen mname)
- (. gen (dup))
- (. gen (ifNull else-label))
- (when is-overload
- (. gen (mark found-label)))
- ;if found
- (.checkCast gen ifn-type)
- (when-not as-static
- (. gen (loadThis)))
- ;box args
- (dotimes [i (count ptypes)]
- (. gen (loadArg i))
- (. clojure.lang.Compiler$HostExpr (emitBoxReturn nil gen (nth pclasses i))))
- ;call fn
- (. gen (invokeInterface ifn-type (new Method "invoke" obj-type
- (to-types (replicate (+ (count ptypes)
- (if as-static 0 1))
- Object)))))
- ;(into-array (cons obj-type
- ; (replicate (count ptypes) obj-type))))))
- ;unbox return
- (. gen (unbox rtype))
- (when (= (. rtype (getSort)) (. Type VOID))
- (. gen (pop)))
- (. gen (goTo end-label))
-
- ;else call supplied alternative generator
- (. gen (mark else-label))
- (. gen (pop))
-
- (else-gen gen m)
-
- (. gen (mark end-label))))
- (. gen (returnValue))
- (. gen (endMethod))))
- ]
- ;start class definition
- (. cv (visit (. Opcodes V1_5) (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_SUPER))
- cname nil (iname super)
- (when-let [ifc (seq interfaces)]
- (into-array (map iname ifc)))))
-
- ;static fields for vars
- (doseq [v var-fields]
- (. cv (visitField (+ (. Opcodes ACC_PRIVATE) (. Opcodes ACC_FINAL) (. Opcodes ACC_STATIC))
- (var-name v)
- (. var-type getDescriptor)
- nil nil)))
-
- ;instance field for state
- (when state
- (. cv (visitField (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_FINAL))
- state-name
- (. obj-type getDescriptor)
- nil nil)))
-
- ;static init to set up var fields and load init
- (let [gen (new GeneratorAdapter (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_STATIC))
- (. Method getMethod "void <clinit> ()")
- nil nil cv)]
- (. gen (visitCode))
- (doseq [v var-fields]
- (. gen push impl-pkg-name)
- (. gen push (str prefix v))
- (. gen (invokeStatic var-type (. Method (getMethod "clojure.lang.Var internPrivate(String,String)"))))
- (. gen putStatic ctype (var-name v) var-type))
-
- (when load-impl-ns
- (. gen push "clojure.core")
- (. gen push "load")
- (. gen (invokeStatic rt-type (. Method (getMethod "clojure.lang.Var var(String,String)"))))
- (. gen push (str "/" impl-cname))
- (. gen (invokeInterface ifn-type (new Method "invoke" obj-type (to-types [Object]))))
-; (. gen push (str (.replace impl-pkg-name \- \_) "__init"))
-; (. gen (invokeStatic class-type (. Method (getMethod "Class forName(String)"))))
- (. gen pop))
-
- (. gen (returnValue))
- (. gen (endMethod)))
-
- ;ctors
- (doseq [[pclasses super-pclasses] ctor-sig-map]
- (let [pclasses (map the-class pclasses)
- super-pclasses (map the-class super-pclasses)
- ptypes (to-types pclasses)
- super-ptypes (to-types super-pclasses)
- m (new Method "<init>" (. Type VOID_TYPE) ptypes)
- super-m (new Method "<init>" (. Type VOID_TYPE) super-ptypes)
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)
- no-init-label (. gen newLabel)
- end-label (. gen newLabel)
- no-post-init-label (. gen newLabel)
- end-post-init-label (. gen newLabel)
- nth-method (. Method (getMethod "Object nth(Object,int)"))
- local (. gen newLocal obj-type)]
- (. gen (visitCode))
-
- (if init
- (do
- (emit-get-var gen init-name)
- (. gen dup)
- (. gen ifNull no-init-label)
- (.checkCast gen ifn-type)
- ;box init args
- (dotimes [i (count pclasses)]
- (. gen (loadArg i))
- (. clojure.lang.Compiler$HostExpr (emitBoxReturn nil gen (nth pclasses i))))
- ;call init fn
- (. gen (invokeInterface ifn-type (new Method "invoke" obj-type
- (arg-types (count ptypes)))))
- ;expecting [[super-ctor-args] state] returned
- (. gen dup)
- (. gen push 0)
- (. gen (invokeStatic rt-type nth-method))
- (. gen storeLocal local)
-
- (. gen (loadThis))
- (. gen dupX1)
- (dotimes [i (count super-pclasses)]
- (. gen loadLocal local)
- (. gen push i)
- (. gen (invokeStatic rt-type nth-method))
- (. clojure.lang.Compiler$HostExpr (emitUnboxArg nil gen (nth super-pclasses i))))
- (. gen (invokeConstructor super-type super-m))
-
- (if state
- (do
- (. gen push 1)
- (. gen (invokeStatic rt-type nth-method))
- (. gen (putField ctype state-name obj-type)))
- (. gen pop))
-
- (. gen goTo end-label)
- ;no init found
- (. gen mark no-init-label)
- (. gen (throwException ex-type (str impl-pkg-name "/" prefix init-name " not defined")))
- (. gen mark end-label))
- (if (= pclasses super-pclasses)
- (do
- (. gen (loadThis))
- (. gen (loadArgs))
- (. gen (invokeConstructor super-type super-m)))
- (throw (new Exception ":init not specified, but ctor and super ctor args differ"))))
-
- (when post-init
- (emit-get-var gen post-init-name)
- (. gen dup)
- (. gen ifNull no-post-init-label)
- (.checkCast gen ifn-type)
- (. gen (loadThis))
- ;box init args
- (dotimes [i (count pclasses)]
- (. gen (loadArg i))
- (. clojure.lang.Compiler$HostExpr (emitBoxReturn nil gen (nth pclasses i))))
- ;call init fn
- (. gen (invokeInterface ifn-type (new Method "invoke" obj-type
- (arg-types (inc (count ptypes))))))
- (. gen pop)
- (. gen goTo end-post-init-label)
- ;no init found
- (. gen mark no-post-init-label)
- (. gen (throwException ex-type (str impl-pkg-name "/" prefix post-init-name " not defined")))
- (. gen mark end-post-init-label))
-
- (. gen (returnValue))
- (. gen (endMethod))
- ;factory
- (when factory
- (let [fm (new Method factory-name ctype ptypes)
- gen (new GeneratorAdapter (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_STATIC))
- fm nil nil cv)]
- (. gen (visitCode))
- (. gen newInstance ctype)
- (. gen dup)
- (. gen (loadArgs))
- (. gen (invokeConstructor ctype m))
- (. gen (returnValue))
- (. gen (endMethod))))))
-
- ;add methods matching supers', if no fn -> call super
- (let [mm (non-private-methods super)]
- (doseq [#^java.lang.reflect.Method meth (vals mm)]
- (emit-forwarding-method (.getName meth) (.getParameterTypes meth) (.getReturnType meth) false
- (fn [#^GeneratorAdapter gen #^Method m]
- (. gen (loadThis))
- ;push args
- (. gen (loadArgs))
- ;call super
- (. gen (visitMethodInsn (. Opcodes INVOKESPECIAL)
- (. super-type (getInternalName))
- (. m (getName))
- (. m (getDescriptor)))))))
- ;add methods matching interfaces', if no fn -> throw
- (reduce (fn [mm #^java.lang.reflect.Method meth]
- (if (contains? mm (method-sig meth))
- mm
- (do
- (emit-forwarding-method (.getName meth) (.getParameterTypes meth) (.getReturnType meth) false
- emit-unsupported)
- (assoc mm (method-sig meth) meth))))
- mm (mapcat #(.getMethods #^Class %) interfaces))
- ;extra methods
- (doseq [[mname pclasses rclass :as msig] methods]
- (emit-forwarding-method (str mname) pclasses rclass (:static ^msig)
- emit-unsupported))
- ;expose specified overridden superclass methods
- (doseq [[local-mname #^java.lang.reflect.Method m] (reduce (fn [ms [[name _ _] m]]
- (if (contains? exposes-methods (symbol name))
- (conj ms [((symbol name) exposes-methods) m])
- ms)) [] (seq mm))]
- (let [ptypes (to-types (.getParameterTypes m))
- rtype (totype (.getReturnType m))
- exposer-m (new Method (str local-mname) rtype ptypes)
- target-m (new Method (.getName m) rtype ptypes)
- gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) exposer-m nil nil cv)]
- (. gen (loadThis))
- (. gen (loadArgs))
- (. gen (visitMethodInsn (. Opcodes INVOKESPECIAL)
- (. super-type (getInternalName))
- (. target-m (getName))
- (. target-m (getDescriptor))))
- (. gen (returnValue))
- (. gen (endMethod)))))
- ;main
- (when main
- (let [m (. Method getMethod "void main (String[])")
- gen (new GeneratorAdapter (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_STATIC))
- m nil nil cv)
- no-main-label (. gen newLabel)
- end-label (. gen newLabel)]
- (. gen (visitCode))
-
- (emit-get-var gen main-name)
- (. gen dup)
- (. gen ifNull no-main-label)
- (.checkCast gen ifn-type)
- (. gen loadArgs)
- (. gen (invokeStatic rt-type (. Method (getMethod "clojure.lang.ISeq seq(Object)"))))
- (. gen (invokeInterface ifn-type (new Method "applyTo" obj-type
- (into-array [iseq-type]))))
- (. gen pop)
- (. gen goTo end-label)
- ;no main found
- (. gen mark no-main-label)
- (. gen (throwException ex-type (str impl-pkg-name "/" prefix main-name " not defined")))
- (. gen mark end-label)
- (. gen (returnValue))
- (. gen (endMethod))))
- ;field exposers
- (doseq [[f {getter :get setter :set}] exposes]
- (let [fld (find-field super (str f))
- ftype (totype (.getType fld))
- static? (Modifier/isStatic (.getModifiers fld))
- acc (+ Opcodes/ACC_PUBLIC (if static? Opcodes/ACC_STATIC 0))]
- (when getter
- (let [m (new Method (str getter) ftype (to-types []))
- gen (new GeneratorAdapter acc m nil nil cv)]
- (. gen (visitCode))
- (if static?
- (. gen getStatic ctype (str f) ftype)
- (do
- (. gen loadThis)
- (. gen getField ctype (str f) ftype)))
- (. gen (returnValue))
- (. gen (endMethod))))
- (when setter
- (let [m (new Method (str setter) Type/VOID_TYPE (into-array [ftype]))
- gen (new GeneratorAdapter acc m nil nil cv)]
- (. gen (visitCode))
- (if static?
- (do
- (. gen loadArgs)
- (. gen putStatic ctype (str f) ftype))
- (do
- (. gen loadThis)
- (. gen loadArgs)
- (. gen putField ctype (str f) ftype)))
- (. gen (returnValue))
- (. gen (endMethod))))))
- ;finish class def
- (. cv (visitEnd))
- [cname (. cv (toByteArray))]))
-
-(defmacro gen-class
- "When compiling, generates compiled bytecode for a class with the
- given package-qualified :name (which, as all names in these
- parameters, can be a string or symbol), and writes the .class file
- to the *compile-path* directory. When not compiling, does
- nothing. The gen-class construct contains no implementation, as the
- implementation will be dynamically sought by the generated class in
- functions in an implementing Clojure namespace. Given a generated
- class org.mydomain.MyClass with a method named mymethod, gen-class
- will generate an implementation that looks for a function named by
- (str prefix mymethod) (default prefix: \"-\") in a
- Clojure namespace specified by :impl-ns
- (defaults to the current namespace). All inherited methods,
- generated methods, and init and main functions (see :methods, :init,
- and :main below) will be found similarly prefixed. By default, the
- static initializer for the generated class will attempt to load the
- Clojure support code for the class as a resource from the classpath,
- e.g. in the example case, ``org/mydomain/MyClass__init.class``. This
- behavior can be controlled by :load-impl-ns
-
- Note that methods with a maximum of 18 parameters are supported.
-
- In all subsequent sections taking types, the primitive types can be
- referred to by their Java names (int, float etc), and classes in the
- java.lang package can be used without a package qualifier. All other
- classes must be fully qualified.
-
- Options should be a set of key/value pairs, all except for :name are optional:
-
- :name aname
-
- The package-qualified name of the class to be generated
-
- :extends aclass
-
- Specifies the superclass, the non-private methods of which will be
- overridden by the class. If not provided, defaults to Object.
-
- :implements [interface ...]
-
- One or more interfaces, the methods of which will be implemented by the class.
-
- :init name
-
- If supplied, names a function that will be called with the arguments
- to the constructor. Must return [ [superclass-constructor-args] state]
- If not supplied, the constructor args are passed directly to
- the superclass constructor and the state will be nil
-
- :constructors {[param-types] [super-param-types], ...}
-
- By default, constructors are created for the generated class which
- match the signature(s) of the constructors for the superclass. This
- parameter may be used to explicitly specify constructors, each entry
- providing a mapping from a constructor signature to a superclass
- constructor signature. When you supply this, you must supply an :init
- specifier.
-
- :post-init name
-
- If supplied, names a function that will be called with the object as
- the first argument, followed by the arguments to the constructor.
- It will be called every time an object of this class is created,
- immediately after all the inherited constructors have completed.
- It's return value is ignored.
-
- :methods [ [name [param-types] return-type], ...]
-
- The generated class automatically defines all of the non-private
- methods of its superclasses/interfaces. This parameter can be used
- to specify the signatures of additional methods of the generated
- class. Static methods can be specified with #^{:static true} in the
- signature's metadata. Do not repeat superclass/interface signatures
- here.
-
- :main boolean
-
- If supplied and true, a static public main function will be generated. It will
- pass each string of the String[] argument as a separate argument to
- a function called (str prefix main).
-
- :factory name
-
- If supplied, a (set of) public static factory function(s) will be
- created with the given name, and the same signature(s) as the
- constructor(s).
-
- :state name
-
- If supplied, a public final instance field with the given name will be
- created. You must supply an :init function in order to provide a
- value for the state. Note that, though final, the state can be a ref
- or agent, supporting the creation of Java objects with transactional
- or asynchronous mutation semantics.
-
- :exposes {protected-field-name {:get name :set name}, ...}
-
- Since the implementations of the methods of the generated class
- occur in Clojure functions, they have no access to the inherited
- protected fields of the superclass. This parameter can be used to
- generate public getter/setter methods exposing the protected field(s)
- for use in the implementation.
-
- :exposes-methods {super-method-name exposed-name, ...}
-
- It is sometimes necessary to call the superclass' implementation of an
- overridden method. Those methods may be exposed and referred in
- the new method implementation by a local name.
-
- :prefix string
-
- Default: \"-\" Methods called e.g. Foo will be looked up in vars called
- prefixFoo in the implementing ns.
-
- :impl-ns name
-
- Default: the name of the current ns. Implementations of methods will be looked up in this namespace.
-
- :load-impl-ns boolean
-
- Default: true. Causes the static initializer for the generated class
- to reference the load code for the implementing namespace. Should be
- true when implementing-ns is the default, false if you intend to
- load the code via some other method."
-
- [& options]
- (when *compile-files*
- (let [options-map (apply hash-map options)
- [cname bytecode] (generate-class options-map)]
- (clojure.lang.Compiler/writeClassFile cname bytecode))))
-
-;;;;;;;;;;;;;;;;;;;; gen-interface ;;;;;;;;;;;;;;;;;;;;;;
-;; based on original contribution by Chris Houser
-
-(defn- #^Type asm-type
- "Returns an asm Type object for c, which may be a primitive class
- (such as Integer/TYPE), any other class (such as Double), or a
- fully-qualified class name given as a string or symbol
- (such as 'java.lang.String)"
- [c]
- (if (or (instance? Class c) (prim->class c))
- (Type/getType (the-class c))
- (let [strx (str c)]
- (Type/getObjectType
- (.replace (if (some #{\.} strx)
- strx
- (str "java.lang." strx))
- "." "/")))))
-
-(defn- generate-interface
- [{:keys [name extends methods]}]
- (let [iname (.replace (str name) "." "/")
- cv (ClassWriter. ClassWriter/COMPUTE_MAXS)]
- (. cv visit Opcodes/V1_5 (+ Opcodes/ACC_PUBLIC
- Opcodes/ACC_ABSTRACT
- Opcodes/ACC_INTERFACE)
- iname nil "java/lang/Object"
- (when (seq extends)
- (into-array (map #(.getInternalName (asm-type %)) extends))))
- (doseq [[mname pclasses rclass] methods]
- (. cv visitMethod (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT)
- (str mname)
- (Type/getMethodDescriptor (asm-type rclass)
- (if pclasses
- (into-array Type (map asm-type pclasses))
- (make-array Type 0)))
- nil nil))
- (. cv visitEnd)
- [iname (. cv toByteArray)]))
-
-(defmacro gen-interface
- "When compiling, generates compiled bytecode for an interface with
- the given package-qualified :name (which, as all names in these
- parameters, can be a string or symbol), and writes the .class file
- to the *compile-path* directory. When not compiling, does nothing.
-
- In all subsequent sections taking types, the primitive types can be
- referred to by their Java names (int, float etc), and classes in the
- java.lang package can be used without a package qualifier. All other
- classes must be fully qualified.
-
- Options should be a set of key/value pairs, all except for :name are
- optional:
-
- :name aname
-
- The package-qualified name of the class to be generated
-
- :extends [interface ...]
-
- One or more interfaces, which will be extended by this interface.
-
- :methods [ [name [param-types] return-type], ...]
-
- This parameter is used to specify the signatures of the methods of
- the generated interface. Do not repeat superinterface signatures
- here."
-
- [& options]
- (when *compile-files*
- (let [options-map (apply hash-map options)
- [cname bytecode] (generate-interface options-map)]
- (clojure.lang.Compiler/writeClassFile cname bytecode))))
-
-(comment
-
-(defn gen-and-load-class
- "Generates and immediately loads the bytecode for the specified
- class. Note that a class generated this way can be loaded only once
- - the JVM supports only one class with a given name per
- classloader. Subsequent to generation you can import it into any
- desired namespaces just like any other class. See gen-class for a
- description of the options."
-
- [& options]
- (let [options-map (apply hash-map options)
- [cname bytecode] (generate-class options-map)]
- (.. (clojure.lang.RT/getRootClassLoader) (defineClass cname bytecode))))
-
-)
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(ns clojure.inspector
- (:import
- (java.awt BorderLayout)
- (java.awt.event ActionEvent ActionListener)
- (javax.swing.tree TreeModel)
- (javax.swing.table TableModel AbstractTableModel)
- (javax.swing JPanel JTree JTable JScrollPane JFrame JToolBar JButton SwingUtilities)))
-
-(defn atom? [x]
- (not (coll? x)))
-
-(defn collection-tag [x]
- (cond
- (instance? java.util.Map$Entry x) :entry
- (instance? java.util.Map x) :map
- (sequential? x) :seq
- :else :atom))
-
-(defmulti is-leaf collection-tag)
-(defmulti get-child (fn [parent index] (collection-tag parent)))
-(defmulti get-child-count collection-tag)
-
-(defmethod is-leaf :default [node]
- (atom? node))
-(defmethod get-child :default [parent index]
- (nth parent index))
-(defmethod get-child-count :default [parent]
- (count parent))
-
-(defmethod is-leaf :entry [e]
- (is-leaf (val e)))
-(defmethod get-child :entry [e index]
- (get-child (val e) index))
-(defmethod get-child-count :entry [e]
- (count (val e)))
-
-(defmethod is-leaf :map [m]
- false)
-(defmethod get-child :map [m index]
- (nth (seq m) index))
-
-(defn tree-model [data]
- (proxy [TreeModel] []
- (getRoot [] data)
- (addTreeModelListener [treeModelListener])
- (getChild [parent index]
- (get-child parent index))
- (getChildCount [parent]
- (get-child-count parent))
- (isLeaf [node]
- (is-leaf node))
- (valueForPathChanged [path newValue])
- (getIndexOfChild [parent child]
- -1)
- (removeTreeModelListener [treeModelListener])))
-
-
-(defn old-table-model [data]
- (let [row1 (first data)
- colcnt (count row1)
- cnt (count data)
- vals (if (map? row1) vals identity)]
- (proxy [TableModel] []
- (addTableModelListener [tableModelListener])
- (getColumnClass [columnIndex] Object)
- (getColumnCount [] colcnt)
- (getColumnName [columnIndex]
- (if (map? row1)
- (name (nth (keys row1) columnIndex))
- (str columnIndex)))
- (getRowCount [] cnt)
- (getValueAt [rowIndex columnIndex]
- (nth (vals (nth data rowIndex)) columnIndex))
- (isCellEditable [rowIndex columnIndex] false)
- (removeTableModelListener [tableModelListener]))))
-
-(defn inspect-tree
- "creates a graphical (Swing) inspector on the supplied hierarchical data"
- [data]
- (doto (JFrame. "Clojure Inspector")
- (.add (JScrollPane. (JTree. (tree-model data))))
- (.setSize 400 600)
- (.setVisible true)))
-
-(defn inspect-table
- "creates a graphical (Swing) inspector on the supplied regular
- data, which must be a sequential data structure of data structures
- of equal length"
- [data]
- (doto (JFrame. "Clojure Inspector")
- (.add (JScrollPane. (JTable. (old-table-model data))))
- (.setSize 400 600)
- (.setVisible true)))
-
-
-(defmulti list-provider class)
-
-(defmethod list-provider :default [x]
- {:nrows 1 :get-value (fn [i] x) :get-label (fn [i] (.getName (class x)))})
-
-(defmethod list-provider java.util.List [c]
- (let [v (if (vector? c) c (vec c))]
- {:nrows (count v)
- :get-value (fn [i] (v i))
- :get-label (fn [i] i)}))
-
-(defmethod list-provider java.util.Map [c]
- (let [v (vec (sort (map (fn [[k v]] (vector k v)) c)))]
- {:nrows (count v)
- :get-value (fn [i] ((v i) 1))
- :get-label (fn [i] ((v i) 0))}))
-
-(defn list-model [provider]
- (let [{:keys [nrows get-value get-label]} provider]
- (proxy [AbstractTableModel] []
- (getColumnCount [] 2)
- (getRowCount [] nrows)
- (getValueAt [rowIndex columnIndex]
- (cond
- (= 0 columnIndex) (get-label rowIndex)
- (= 1 columnIndex) (print-str (get-value rowIndex)))))))
-
-(defmulti table-model class)
-
-(defmethod table-model :default [x]
- (proxy [AbstractTableModel] []
- (getColumnCount [] 2)
- (getRowCount [] 1)
- (getValueAt [rowIndex columnIndex]
- (if (zero? columnIndex)
- (class x)
- x))))
-
-;(defn make-inspector [x]
-; (agent {:frame frame :data x :parent nil :index 0}))
-
-
-(defn inspect
- "creates a graphical (Swing) inspector on the supplied object"
- [x]
- (doto (JFrame. "Clojure Inspector")
- (.add
- (doto (JPanel. (BorderLayout.))
- (.add (doto (JToolBar.)
- (.add (JButton. "Back"))
- (.addSeparator)
- (.add (JButton. "List"))
- (.add (JButton. "Table"))
- (.add (JButton. "Bean"))
- (.add (JButton. "Line"))
- (.add (JButton. "Bar"))
- (.addSeparator)
- (.add (JButton. "Prev"))
- (.add (JButton. "Next")))
- BorderLayout/NORTH)
- (.add
- (JScrollPane.
- (doto (JTable. (list-model (list-provider x)))
- (.setAutoResizeMode JTable/AUTO_RESIZE_LAST_COLUMN)))
- BorderLayout/CENTER)))
- (.setSize 400 400)
- (.setVisible true)))
-
-
-(comment
-
-(load-file "src/inspector.clj")
-(refer 'inspector)
-(inspect-tree {:a 1 :b 2 :c [1 2 3 {:d 4 :e 5 :f [6 7 8]}]})
-(inspect-table [[1 2 3][4 5 6][7 8 9][10 11 12]])
-
-)
-;; Copyright (c) Rich Hickey All rights reserved. The use and
-;; distribution terms for this software are covered by the Eclipse Public
-;; License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found
-;; in the file epl-v10.html at the root of this distribution. By using this
-;; software in any fashion, you are agreeing to be bound by the terms of
-;; this license. You must not remove this notice, or any other, from this
-;; software.
-
-;; Originally contributed by Stephen C. Gilardi
-
-(ns clojure.main
- (:import (clojure.lang Compiler Compiler$CompilerException
- LineNumberingPushbackReader RT)))
-
-(declare main)
-
-(defmacro with-bindings
- "Executes body in the context of thread-local bindings for several vars
- that often need to be set!: *ns* *warn-on-reflection* *print-meta*
- *print-length* *print-level* *compile-path* *command-line-args* *1
- *2 *3 *e"
- [& body]
- `(binding [*ns* *ns*
- *warn-on-reflection* *warn-on-reflection*
- *print-meta* *print-meta*
- *print-length* *print-length*
- *print-level* *print-level*
- *compile-path* (System/getProperty "clojure.compile.path" "classes")
- *command-line-args* *command-line-args*
- *1 nil
- *2 nil
- *3 nil
- *e nil]
- ~@body))
-
-(defn repl-prompt
- "Default :prompt hook for repl"
- []
- (printf "%s=> " (ns-name *ns*)))
-
-(defn skip-if-eol
- "If the next character on stream s is a newline, skips it, otherwise
- leaves the stream untouched. Returns :line-start, :stream-end, or :body
- to indicate the relative location of the next character on s. The stream
- must either be an instance of LineNumberingPushbackReader or duplicate
- its behavior of both supporting .unread and collapsing all of CR, LF, and
- CRLF to a single \\newline."
- [s]
- (let [c (.read s)]
- (cond
- (= c (int \newline)) :line-start
- (= c -1) :stream-end
- :else (do (.unread s c) :body))))
-
-(defn skip-whitespace
- "Skips whitespace characters on stream s. Returns :line-start, :stream-end,
- or :body to indicate the relative location of the next character on s.
- Interprets comma as whitespace and semicolon as comment to end of line.
- Does not interpret #! as comment to end of line because only one
- character of lookahead is available. The stream must either be an
- instance of LineNumberingPushbackReader or duplicate its behavior of both
- supporting .unread and collapsing all of CR, LF, and CRLF to a single
- \\newline."
- [s]
- (loop [c (.read s)]
- (cond
- (= c (int \newline)) :line-start
- (= c -1) :stream-end
- (= c (int \;)) (do (.readLine s) :line-start)
- (or (Character/isWhitespace c) (= c (int \,))) (recur (.read s))
- :else (do (.unread s c) :body))))
-
-(defn repl-read
- "Default :read hook for repl. Reads from *in* which must either be an
- instance of LineNumberingPushbackReader or duplicate its behavior of both
- supporting .unread and collapsing all of CR, LF, and CRLF into a single
- \\newline. repl-read:
- - skips whitespace, then
- - returns request-prompt on start of line, or
- - returns request-exit on end of stream, or
- - reads an object from the input stream, then
- - skips the next input character if it's end of line, then
- - returns the object."
- [request-prompt request-exit]
- (or ({:line-start request-prompt :stream-end request-exit}
- (skip-whitespace *in*))
- (let [input (read)]
- (skip-if-eol *in*)
- input)))
-
-(defn- root-cause
- "Returns the initial cause of an exception or error by peeling off all of
- its wrappers"
- [throwable]
- (loop [cause throwable]
- (if-let [cause (.getCause cause)]
- (recur cause)
- cause)))
-
-(defn repl-exception
- "Returns CompilerExceptions in tact, but only the root cause of other
- throwables"
- [throwable]
- (if (instance? Compiler$CompilerException throwable)
- throwable
- (root-cause throwable)))
-
-(defn repl-caught
- "Default :caught hook for repl"
- [e]
- (.println *err* (repl-exception e)))
-
-(defn repl
- "Generic, reusable, read-eval-print loop. By default, reads from *in*,
- writes to *out*, and prints exception summaries to *err*. If you use the
- default :read hook, *in* must either be an instance of
- LineNumberingPushbackReader or duplicate its behavior of both supporting
- .unread and collapsing CR, LF, and CRLF into a single \\newline. Options
- are sequential keyword-value pairs. Available options and their defaults:
-
- - :init, function of no arguments, initialization hook called with
- bindings for set!-able vars in place.
- default: #()
-
- - :need-prompt, function of no arguments, called before each
- read-eval-print except the first, the user will be prompted if it
- returns true.
- default: (if (instance? LineNumberingPushbackReader *in*)
- #(.atLineStart *in*)
- #(identity true))
-
- - :prompt, function of no arguments, prompts for more input.
- default: repl-prompt
-
- - :flush, function of no arguments, flushes output
- default: flush
-
- - :read, function of two arguments, reads from *in*:
- - returns its first argument to request a fresh prompt
- - depending on need-prompt, this may cause the repl to prompt
- before reading again
- - returns its second argument to request an exit from the repl
- - else returns the next object read from the input stream
- default: repl-read
-
- - :eval, funtion of one argument, returns the evaluation of its
- argument
- default: eval
-
- - :print, function of one argument, prints its argument to the output
- default: prn
-
- - :caught, function of one argument, a throwable, called when
- read, eval, or print throws an exception or error
- default: repl-caught"
- [& options]
- (let [{:keys [init need-prompt prompt flush read eval print caught]
- :or {init #()
- need-prompt (if (instance? LineNumberingPushbackReader *in*)
- #(.atLineStart *in*)
- #(identity true))
- prompt repl-prompt
- flush flush
- read repl-read
- eval eval
- print prn
- caught repl-caught}}
- (apply hash-map options)
- request-prompt (Object.)
- request-exit (Object.)
- read-eval-print
- (fn []
- (try
- (let [input (read request-prompt request-exit)]
- (or (#{request-prompt request-exit} input)
- (let [value (eval input)]
- (print value)
- (set! *3 *2)
- (set! *2 *1)
- (set! *1 value))))
- (catch Throwable e
- (caught e)
- (set! *e e))))]
- (with-bindings
- (try
- (init)
- (catch Throwable e
- (caught e)
- (set! *e e)))
- (prompt)
- (flush)
- (loop []
- (when-not (= (read-eval-print) request-exit)
- (when (need-prompt)
- (prompt)
- (flush))
- (recur))))))
-
-(defn load-script
- "Loads Clojure source from a file or resource given its path. Paths
- beginning with @ or @/ are considered relative to classpath."
- [path]
- (if (.startsWith path "@")
- (RT/loadResourceScript
- (.substring path (if (.startsWith path "@/") 2 1)))
- (Compiler/loadFile path)))
-
-(defn- init-opt
- "Load a script"
- [path]
- (load-script path))
-
-(defn- eval-opt
- "Evals expressions in str, prints each non-nil result using prn"
- [str]
- (let [eof (Object.)]
- (with-in-str str
- (loop [input (read *in* false eof)]
- (when-not (= input eof)
- (let [value (eval input)]
- (when-not (nil? value)
- (prn value))
- (recur (read *in* false eof))))))))
-
-(defn- init-dispatch
- "Returns the handler associated with an init opt"
- [opt]
- ({"-i" init-opt
- "--init" init-opt
- "-e" eval-opt
- "--eval" eval-opt} opt))
-
-(defn- initialize
- "Common initialize routine for repl, script, and null opts"
- [args inits]
- (in-ns 'user)
- (set! *command-line-args* args)
- (doseq [[opt arg] inits]
- ((init-dispatch opt) arg)))
-
-(defn- repl-opt
- "Start a repl with args and inits. Print greeting if no eval options were
- present"
- [[_ & args] inits]
- (when-not (some #(= eval-opt (init-dispatch (first %))) inits)
- (println "Clojure" (clojure-version)))
- (repl :init #(initialize args inits))
- (prn)
- (System/exit 0))
-
-(defn- script-opt
- "Run a script from a file, resource, or standard in with args and inits"
- [[path & args] inits]
- (with-bindings
- (initialize args inits)
- (if (= path "-")
- (load-reader *in*)
- (load-script path))))
-
-(defn- null-opt
- "No repl or script opt present, just bind args and run inits"
- [args inits]
- (with-bindings
- (initialize args inits)))
-
-(defn- help-opt
- "Print help text for main"
- [_ _]
- (println (:doc (meta (var main)))))
-
-(defn- main-dispatch
- "Returns the handler associated with a main option"
- [opt]
- (or
- ({"-r" repl-opt
- "--repl" repl-opt
- nil null-opt
- "-h" help-opt
- "--help" help-opt
- "-?" help-opt} opt)
- script-opt))
-
-(defn- legacy-repl
- "Called by the clojure.lang.Repl.main stub to run a repl with args
- specified the old way"
- [args]
- (let [[inits [sep & args]] (split-with (complement #{"--"}) args)]
- (repl-opt (concat ["-r"] args) (map vector (repeat "-i") inits))))
-
-(defn- legacy-script
- "Called by the clojure.lang.Script.main stub to run a script with args
- specified the old way"
- [args]
- (let [[inits [sep & args]] (split-with (complement #{"--"}) args)]
- (null-opt args (map vector (repeat "-i") inits))))
-
-(defn main
- "Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*]
-
- With no options or args, runs an interactive Read-Eval-Print Loop
-
- init options:
- -i, --init path Load a file or resource
- -e, --eval string Evaluate expressions in string; print non-nil values
-
- main options:
- -r, --repl Run a repl
- path Run a script from from a file or resource
- - Run a script from standard input
- -h, -?, --help Print this help message and exit
-
- operation:
-
- - Establishes thread-local bindings for commonly set!-able vars
- - Enters the user namespace
- - Binds *command-line-args* to a seq of strings containing command line
- args that appear after any main option
- - Runs all init options in order
- - Runs a repl or script if requested
-
- The init options may be repeated and mixed freely, but must appear before
- any main option. The appearance of any eval option before running a repl
- suppresses the usual repl greeting message: \"Clojure ~(clojure-version)\".
-
- Paths may be absolute or relative in the filesystem or relative to
- classpath. Classpath-relative paths have prefix of @ or @/"
- [& args]
- (try
- (if args
- (loop [[opt arg & more :as args] args inits []]
- (if (init-dispatch opt)
- (recur more (conj inits [opt arg]))
- ((main-dispatch opt) args inits)))
- (repl-opt nil nil))
- (finally
- (flush))))
-
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(ns clojure.parallel)
-(alias 'parallel 'clojure.parallel)
-
-(comment "
-The parallel library wraps the ForkJoin library scheduled for inclusion in JDK 7:
-
-http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
-
-You'll need jsr166y.jar in your classpath in order to use this
-library. The basic idea is that Clojure collections, and most
-efficiently vectors, can be turned into parallel arrays for use by
-this library with the function par, although most of the functions
-take collections and will call par if needed, so normally you will
-only need to call par explicitly in order to attach bound/filter/map
-ops. Parallel arrays support the attachment of bounds, filters and
-mapping functions prior to realization/calculation, which happens as
-the result of any of several operations on the
-array (pvec/psort/pfilter-nils/pfilter-dupes). Rather than perform
-composite operations in steps, as would normally be done with
-sequences, maps and filters are instead attached and thus composed by
-providing ops to par. Note that there is an order sensitivity to the
-attachments - bounds precede filters precede mappings. All operations
-then happen in parallel, using multiple threads and a sophisticated
-work-stealing system supported by fork-join, either when the array is
-realized, or to perform aggregate operations like preduce/pmin/pmax
-etc. A parallel array can be realized into a Clojure vector using
-pvec.
-")
-
-(import '(jsr166y.forkjoin ParallelArray ParallelArrayWithBounds ParallelArrayWithFilter
- ParallelArrayWithMapping
- Ops$Op Ops$BinaryOp Ops$Reducer Ops$Predicate Ops$BinaryPredicate
- Ops$IntAndObjectPredicate Ops$IntAndObjectToObject))
-
-(defn- op [f]
- (proxy [Ops$Op] []
- (op [x] (f x))))
-
-(defn- binary-op [f]
- (proxy [Ops$BinaryOp] []
- (op [x y] (f x y))))
-
-(defn- int-and-object-to-object [f]
- (proxy [Ops$IntAndObjectToObject] []
- (op [i x] (f x i))))
-
-(defn- reducer [f]
- (proxy [Ops$Reducer] []
- (op [x y] (f x y))))
-
-(defn- predicate [f]
- (proxy [Ops$Predicate] []
- (op [x] (boolean (f x)))))
-
-(defn- binary-predicate [f]
- (proxy [Ops$BinaryPredicate] []
- (op [x y] (boolean (f x y)))))
-
-(defn- int-and-object-predicate [f]
- (proxy [Ops$IntAndObjectPredicate] []
- (op [i x] (boolean (f x i)))))
-
-(defn par
- "Creates a parallel array from coll. ops, if supplied, perform
- on-the-fly filtering or transformations during parallel realization
- or calculation. ops form a chain, and bounds must precede filters,
- must precede maps. ops must be a set of keyword value pairs of the
- following forms:
-
- :bound [start end]
-
- Only elements from start (inclusive) to end (exclusive) will be
- processed when the array is realized.
-
- :filter pred
-
- Filter preds remove elements from processing when the array is realized. pred
- must be a function of one argument whose return will be processed
- via boolean.
-
- :filter-index pred2
-
- pred2 must be a function of two arguments, which will be an element
- of the collection and the corresponding index, whose return will be
- processed via boolean.
-
- :filter-with [pred2 coll2]
-
- pred2 must be a function of two arguments, which will be
- corresponding elements of the 2 collections.
-
- :map f
-
- Map fns will be used to transform elements when the array is
- realized. f must be a function of one argument.
-
- :map-index f2
-
- f2 must be a function of two arguments, which will be an element of
- the collection and the corresponding index.
-
- :map-with [f2 coll2]
-
- f2 must be a function of two arguments, which will be corresponding
- elements of the 2 collections."
-
- ([coll]
- (if (instance? ParallelArrayWithMapping coll)
- coll
- (. ParallelArray createUsingHandoff
- (to-array coll)
- (. ParallelArray defaultExecutor))))
- ([coll & ops]
- (reduce (fn [pa [op args]]
- (cond
- (= op :bound) (. pa withBounds (args 0) (args 1))
- (= op :filter) (. pa withFilter (predicate args))
- (= op :filter-with) (. pa withFilter (binary-predicate (args 0)) (par (args 1)))
- (= op :filter-index) (. pa withIndexedFilter (int-and-object-predicate args))
- (= op :map) (. pa withMapping (parallel/op args))
- (= op :map-with) (. pa withMapping (binary-op (args 0)) (par (args 1)))
- (= op :map-index) (. pa withIndexedMapping (int-and-object-to-object args))
- :else (throw (Exception. (str "Unsupported par op: " op)))))
- (par coll)
- (partition 2 ops))))
-
-;;;;;;;;;;;;;;;;;;;;; aggregate operations ;;;;;;;;;;;;;;;;;;;;;;
-(defn pany
- "Returns some (random) element of the coll if it satisfies the bound/filter/map"
- [coll]
- (. (par coll) any))
-
-(defn pmax
- "Returns the maximum element, presuming Comparable elements, unless
- a Comparator comp is supplied"
- ([coll] (. (par coll) max))
- ([coll comp] (. (par coll) max comp)))
-
-(defn pmin
- "Returns the minimum element, presuming Comparable elements, unless
- a Comparator comp is supplied"
- ([coll] (. (par coll) min))
- ([coll comp] (. (par coll) min comp)))
-
-(defn- summary-map [s]
- {:min (.min s) :max (.max s) :size (.size s) :min-index (.indexOfMin s) :max-index (.indexOfMax s)})
-
-(defn psummary
- "Returns a map of summary statistics (min. max, size, min-index, max-index,
- presuming Comparable elements, unless a Comparator comp is supplied"
- ([coll] (summary-map (. (par coll) summary)))
- ([coll comp] (summary-map (. (par coll) summary comp))))
-
-(defn preduce
- "Returns the reduction of the realized elements of coll
- using function f. Note f will not necessarily be called
- consecutively, and so must be commutative. Also note that
- (f base an-element) might be performed many times, i.e. base is not
- an initial value as with sequential reduce."
- [f base coll]
- (. (par coll) (reduce (reducer f) base)))
-
-;;;;;;;;;;;;;;;;;;;;; collection-producing operations ;;;;;;;;;;;;;;;;;;;;;;
-
-(defn- pa-to-vec [pa]
- (vec (. pa getArray)))
-
-(defn- pall
- "Realizes a copy of the coll as a parallel array, with any bounds/filters/maps applied"
- [coll]
- (if (instance? ParallelArrayWithMapping coll)
- (. coll all)
- (par coll)))
-
-(defn pvec
- "Returns the realized contents of the parallel array pa as a Clojure vector"
- [pa] (pa-to-vec (pall pa)))
-
-(defn pdistinct
- "Returns a parallel array of the distinct elements of coll"
- [coll]
- (pa-to-vec (. (pall coll) allUniqueElements)))
-
-;this doesn't work, passes null to reducer?
-(defn- pcumulate [coll f init]
- (.. (pall coll) (precumulate (reducer f) init)))
-
-(defn psort
- "Returns a new vector consisting of the realized items in coll, sorted,
- presuming Comparable elements, unless a Comparator comp is supplied"
- ([coll] (pa-to-vec (. (pall coll) sort)))
- ([coll comp] (pa-to-vec (. (pall coll) sort comp))))
-
-(defn pfilter-nils
- "Returns a vector containing the non-nil (realized) elements of coll"
- [coll]
- (pa-to-vec (. (pall coll) removeNulls)))
-
-(defn pfilter-dupes
- "Returns a vector containing the (realized) elements of coll,
- without any consecutive duplicates"
- [coll]
- (pa-to-vec (. (pall coll) removeConsecutiveDuplicates)))
-
-
-(comment
-(load-file "src/parallel.clj")
-(refer 'parallel)
-(pdistinct [1 2 3 2 1])
-;(pcumulate [1 2 3 2 1] + 0) ;broken, not exposed
-(def a (make-array Object 1000000))
-(dotimes i (count a)
- (aset a i (rand-int i)))
-(time (reduce + 0 a))
-(time (preduce + 0 a))
-(time (count (distinct a)))
-(time (count (pdistinct a)))
-
-(preduce + 0 [1 2 3 2 1])
-(preduce + 0 (psort a))
-(pvec (par [11 2 3 2] :filter-index (fn [x i] (> i x))))
-(pvec (par [11 2 3 2] :filter-with [(fn [x y] (> y x)) [110 2 33 2]]))
-
-(psummary ;or pvec/pmax etc
- (par [11 2 3 2]
- :filter-with [(fn [x y] (> y x))
- [110 2 33 2]]
- :map #(* % 2)))
-
-(preduce + 0
- (par [11 2 3 2]
- :filter-with [< [110 2 33 2]]))
-
-(time (reduce + 0 (map #(* % %) (range 1000000))))
-(time (preduce + 0 (par (range 1000000) :map-index *)))
-(def v (range 1000000))
-(time (preduce + 0 (par v :map-index *)))
-(time (preduce + 0 (par v :map #(* % %))))
-(time (reduce + 0 (map #(* % %) v)))
-); Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(ns clojure.set)
-
-(defn- bubble-max-key [k coll]
- "Move a maximal element of coll according to fn k (which returns a number)
- to the front of coll."
- (let [max (apply max-key k coll)]
- (cons max (remove #(identical? max %) coll))))
-
-(defn union
- "Return a set that is the union of the input sets"
- ([] #{})
- ([s1] s1)
- ([s1 s2]
- (if (< (count s1) (count s2))
- (reduce conj s2 s1)
- (reduce conj s1 s2)))
- ([s1 s2 & sets]
- (let [bubbled-sets (bubble-max-key count (conj sets s2 s1))]
- (reduce into (first bubbled-sets) (rest bubbled-sets)))))
-
-(defn intersection
- "Return a set that is the intersection of the input sets"
- ([s1] s1)
- ([s1 s2]
- (if (< (count s2) (count s1))
- (recur s2 s1)
- (reduce (fn [result item]
- (if (contains? s2 item)
- result
- (disj result item)))
- s1 s1)))
- ([s1 s2 & sets]
- (let [bubbled-sets (bubble-max-key #(- (count %)) (conj sets s2 s1))]
- (reduce intersection (first bubbled-sets) (rest bubbled-sets)))))
-
-(defn difference
- "Return a set that is the first set without elements of the remaining sets"
- ([s1] s1)
- ([s1 s2]
- (if (< (count s1) (count s2))
- (reduce (fn [result item]
- (if (contains? s2 item)
- (disj result item)
- result))
- s1 s1)
- (reduce disj s1 s2)))
- ([s1 s2 & sets]
- (reduce difference s1 (conj sets s2))))
-
-
-(defn select
- "Returns a set of the elements for which pred is true"
- [pred xset]
- (reduce (fn [s k] (if (pred k) s (disj s k)))
- xset xset))
-
-(defn project
- "Returns a rel of the elements of xrel with only the keys in ks"
- [xrel ks]
- (set (map #(select-keys % ks) xrel)))
-
-(defn rename-keys
- "Returns the map with the keys in kmap renamed to the vals in kmap"
- [map kmap]
- (reduce
- (fn [m [old new]]
- (if (not= old new)
- (-> m (assoc new (m old)) (dissoc old))
- m))
- map kmap))
-
-(defn rename
- "Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap"
- [xrel kmap]
- (set (map #(rename-keys % kmap) xrel)))
-
-(defn index
- "Returns a map of the distinct values of ks in the xrel mapped to a
- set of the maps in xrel with the corresponding values of ks."
- [xrel ks]
- (reduce
- (fn [m x]
- (let [ik (select-keys x ks)]
- (assoc m ik (conj (get m ik #{}) x))))
- {} xrel))
-
-(defn map-invert
- "Returns the map with the vals mapped to the keys."
- [m] (reduce (fn [m [k v]] (assoc m v k)) {} m))
-
-(defn join
- "When passed 2 rels, returns the rel corresponding to the natural
- join. When passed an additional keymap, joins on the corresponding
- keys."
- ([xrel yrel] ;natural join
- (if (and (seq xrel) (seq yrel))
- (let [ks (intersection (set (keys (first xrel))) (set (keys (first yrel))))
- [r s] (if (<= (count xrel) (count yrel))
- [xrel yrel]
- [yrel xrel])
- idx (index r ks)]
- (reduce (fn [ret x]
- (let [found (idx (select-keys x ks))]
- (if found
- (reduce #(conj %1 (merge %2 x)) ret found)
- ret)))
- #{} s))
- #{}))
- ([xrel yrel km] ;arbitrary key mapping
- (let [[r s k] (if (<= (count xrel) (count yrel))
- [xrel yrel (map-invert km)]
- [yrel xrel km])
- idx (index r (vals k))]
- (reduce (fn [ret x]
- (let [found (idx (rename-keys (select-keys x (keys k)) k))]
- (if found
- (reduce #(conj %1 (merge %2 x)) ret found)
- ret)))
- #{} s))))
-
-(comment
-(refer 'set)
-(def xs #{{:a 11 :b 1 :c 1 :d 4}
- {:a 2 :b 12 :c 2 :d 6}
- {:a 3 :b 3 :c 3 :d 8 :f 42}})
-
-(def ys #{{:a 11 :b 11 :c 11 :e 5}
- {:a 12 :b 11 :c 12 :e 3}
- {:a 3 :b 3 :c 3 :e 7 }})
-
-(join xs ys)
-(join xs (rename ys {:b :yb :c :yc}) {:a :a})
-
-(union #{:a :b :c} #{:c :d :e })
-(difference #{:a :b :c} #{:c :d :e})
-(intersection #{:a :b :c} #{:c :d :e})
-
-(index ys [:b])
-)
-
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(ns clojure.xml
- (:import (org.xml.sax ContentHandler Attributes SAXException)
- (javax.xml.parsers SAXParser SAXParserFactory)))
-
-(def *stack*)
-(def *current*)
-(def *state*) ; :element :chars :between
-(def *sb*)
-
-(defstruct element :tag :attrs :content)
-
-(def tag (accessor element :tag))
-(def attrs (accessor element :attrs))
-(def content (accessor element :content))
-
-(def content-handler
- (let [push-content (fn [e c]
- (assoc e :content (conj (or (:content e) []) c)))
- push-chars (fn []
- (when (and (= *state* :chars)
- (some (complement #(. Character (isWhitespace %))) (str *sb*)))
- (set! *current* (push-content *current* (str *sb*)))))]
- (new clojure.lang.XMLHandler
- (proxy [ContentHandler] []
- (startElement [uri local-name q-name #^Attributes atts]
- (let [attrs (fn [ret i]
- (if (neg? i)
- ret
- (recur (assoc ret
- (. clojure.lang.Keyword (intern (symbol (. atts (getQName i)))))
- (. atts (getValue i)))
- (dec i))))
- e (struct element
- (. clojure.lang.Keyword (intern (symbol q-name)))
- (when (pos? (. atts (getLength)))
- (attrs {} (dec (. atts (getLength))))))]
- (push-chars)
- (set! *stack* (conj *stack* *current*))
- (set! *current* e)
- (set! *state* :element))
- nil)
- (endElement [uri local-name q-name]
- (push-chars)
- (set! *current* (push-content (peek *stack*) *current*))
- (set! *stack* (pop *stack*))
- (set! *state* :between)
- nil)
- (characters [ch start length]
- (when-not (= *state* :chars)
- (set! *sb* (new StringBuilder)))
- (let [#^StringBuilder sb *sb*]
- (. sb (append ch start length))
- (set! *state* :chars))
- nil)
- (setDocumentLocator [locator])
- (startDocument [])
- (endDocument [])
- (startPrefixMapping [prefix uri])
- (endPrefixMapping [prefix])
- (ignorableWhitespace [ch start length])
- (processingInstruction [target data])
- (skippedEntity [name])
- ))))
-
-(defn startparse-sax [s ch]
- (.. SAXParserFactory (newInstance) (newSAXParser) (parse s ch)))
-
-(defn parse
- "Parses and loads the source s, which can be a File, InputStream or
- String naming a URI. Returns a tree of the xml/element struct-map,
- which has the keys :tag, :attrs, and :content. and accessor fns tag,
- attrs, and content. Other parsers can be supplied by passing
- startparse, a fn taking a source and a ContentHandler and returning
- a parser"
- ([s] (parse s startparse-sax))
- ([s startparse]
- (binding [*stack* nil
- *current* (struct element)
- *state* :between
- *sb* nil]
- (startparse s content-handler)
- ((:content *current*) 0))))
-
-(defn emit-element [e]
- (if (instance? String e)
- (println e)
- (do
- (print (str "<" (name (:tag e))))
- (when (:attrs e)
- (doseq [attr (:attrs e)]
- (print (str " " (name (key attr)) "='" (val attr)"'"))))
- (if (:content e)
- (do
- (println ">")
- (doseq [c (:content e)]
- (emit-element c))
- (println (str "</" (name (:tag e)) ">")))
- (println "/>")))))
-
-(defn emit [x]
- (println "<?xml version='1.0' encoding='UTF-8'?>")
- (emit-element x))
-
-;(export '(tag attrs content parse element emit emit-element))
-
-;(load-file "/Users/rich/dev/clojure/src/xml.clj")
-;(def x (xml/parse "http://arstechnica.com/journals.rssx"))
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-;functional hierarchical zipper, with navigation, editing and enumeration
-;see Huet
-
-(ns clojure.zip
- (:refer-clojure :exclude (replace remove next)))
-
-(defn zipper
- "Creates a new zipper structure.
-
- branch? is a fn that, given a node, returns true if can have
- children, even if it currently doesn't.
-
- children is a fn that, given a branch node, returns a seq of its
- children.
-
- make-node is a fn that, given an existing node and a seq of
- children, returns a new branch node with the supplied children.
- root is the root node."
- [branch? children make-node root]
- #^{:zip/branch? branch? :zip/children children :zip/make-node make-node}
- [root nil])
-
-(defn seq-zip
- "Returns a zipper for nested sequences, given a root sequence"
- [root]
- (zipper seq? identity (fn [node children] children) root))
-
-(defn vector-zip
- "Returns a zipper for nested vectors, given a root vector"
- [root]
- (zipper vector? seq (fn [node children] (apply vector children)) root))
-
-(defn xml-zip
- "Returns a zipper for xml elements (as from xml/parse),
- given a root element"
- [root]
- (zipper (complement string?)
- (comp seq :content)
- (fn [node children]
- (assoc node :content (and children (apply vector children))))
- root))
-
-(defn node
- "Returns the node at loc"
- [loc] (loc 0))
-
-(defn branch?
- "Returns true if the node at loc is a branch"
- [loc]
- ((:zip/branch? ^loc) (node loc)))
-
-(defn children
- "Returns a seq of the children of node at loc, which must be a branch"
- [loc]
- ((:zip/children ^loc) (node loc)))
-
-(defn make-node
- "Returns a new branch node, given an existing node and new
- children. The loc is only used to supply the constructor."
- [loc node children]
- ((:zip/make-node ^loc) node children))
-
-(defn path
- "Returns a seq of nodes leading to this loc"
- [loc]
- (:pnodes (loc 1)))
-
-(defn lefts
- "Returns a seq of the left siblings of this loc"
- [loc]
- (seq (:l (loc 1))))
-
-(defn rights
- "Returns a seq of the right siblings of this loc"
- [loc]
- (:r (loc 1)))
-
-
-(defn down
- "Returns the loc of the leftmost child of the node at this loc, or
- nil if no children"
- [loc]
- (let [[node path] loc
- [c & cnext :as cs] (children loc)]
- (when cs
- (with-meta [c {:l []
- :pnodes (if path (conj (:pnodes path) node) [node])
- :ppath path
- :r cnext}] ^loc))))
-
-(defn up
- "Returns the loc of the parent of the node at this loc, or nil if at
- the top"
- [loc]
- (let [[node {l :l, ppath :ppath, pnodes :pnodes r :r, changed? :changed?, :as path}] loc]
- (when pnodes
- (let [pnode (peek pnodes)]
- (with-meta (if changed?
- [(make-node loc pnode (concat l (cons node r)))
- (and ppath (assoc ppath :changed? true))]
- [pnode ppath])
- ^loc)))))
-
-(defn root
- "zips all the way up and returns the root node, reflecting any
- changes."
- [loc]
- (if (= :end (loc 1))
- (node loc)
- (let [p (up loc)]
- (if p
- (recur p)
- (node loc)))))
-
-(defn right
- "Returns the loc of the right sibling of the node at this loc, or nil"
- [loc]
- (let [[node {l :l [r & rnext :as rs] :r :as path}] loc]
- (when (and path rs)
- (with-meta [r (assoc path :l (conj l node) :r rnext)] ^loc))))
-
-(defn rightmost
- "Returns the loc of the rightmost sibling of the node at this loc, or self"
- [loc]
- (let [[node {l :l r :r :as path}] loc]
- (if (and path r)
- (with-meta [(last r) (assoc path :l (apply conj l node (butlast r)) :r nil)] ^loc)
- loc)))
-
-(defn left
- "Returns the loc of the left sibling of the node at this loc, or nil"
- [loc]
- (let [[node {l :l r :r :as path}] loc]
- (when (and path (seq l))
- (with-meta [(peek l) (assoc path :l (pop l) :r (cons node r))] ^loc))))
-
-(defn leftmost
- "Returns the loc of the leftmost sibling of the node at this loc, or self"
- [loc]
- (let [[node {l :l r :r :as path}] loc]
- (if (and path (seq l))
- (with-meta [(first l) (assoc path :l [] :r (concat (rest l) [node] r))] ^loc)
- loc)))
-
-(defn insert-left
- "Inserts the item as the left sibling of the node at this loc,
- without moving"
- [loc item]
- (let [[node {l :l :as path}] loc]
- (if (nil? path)
- (throw (new Exception "Insert at top"))
- (with-meta [node (assoc path :l (conj l item) :changed? true)] ^loc))))
-
-(defn insert-right
- "Inserts the item as the right sibling of the node at this loc,
- without moving"
- [loc item]
- (let [[node {r :r :as path}] loc]
- (if (nil? path)
- (throw (new Exception "Insert at top"))
- (with-meta [node (assoc path :r (cons item r) :changed? true)] ^loc))))
-
-(defn replace
- "Replaces the node at this loc, without moving"
- [loc node]
- (let [[_ path] loc]
- (with-meta [node (assoc path :changed? true)] ^loc)))
-
-(defn edit
- "Replaces the node at this loc with the value of (f node args)"
- [loc f & args]
- (replace loc (apply f (node loc) args)))
-
-(defn insert-child
- "Inserts the item as the leftmost child of the node at this loc,
- without moving"
- [loc item]
- (replace loc (make-node loc (node loc) (cons item (children loc)))))
-
-(defn append-child
- "Inserts the item as the rightmost child of the node at this loc,
- without moving"
- [loc item]
- (replace loc (make-node loc (node loc) (concat (children loc) [item]))))
-
-(defn next
- "Moves to the next loc in the hierarchy, depth-first. When reaching
- the end, returns a distinguished loc detectable via end?. If already
- at the end, stays there."
- [loc]
- (if (= :end (loc 1))
- loc
- (or
- (and (branch? loc) (down loc))
- (right loc)
- (loop [p loc]
- (if (up p)
- (or (right (up p)) (recur (up p)))
- [(node p) :end])))))
-
-(defn prev
- "Moves to the previous loc in the hierarchy, depth-first. If already
- at the root, returns nil."
- [loc]
- (if-let [lloc (left loc)]
- (loop [loc lloc]
- (if-let [child (and (branch? loc) (down loc))]
- (recur (rightmost child))
- loc))
- (up loc)))
-
-(defn end?
- "Returns true if loc represents the end of a depth-first walk"
- [loc]
- (= :end (loc 1)))
-
-(defn remove
- "Removes the node at loc, returning the loc that would have preceded
- it in a depth-first walk."
- [loc]
- (let [[node {l :l, ppath :ppath, pnodes :pnodes, rs :r, :as path}] loc]
- (if (nil? path)
- (throw (new Exception "Remove at top"))
- (if (pos? (count l))
- (loop [loc (with-meta [(peek l) (assoc path :l (pop l) :changed? true)] ^loc)]
- (if-let [child (and (branch? loc) (down loc))]
- (recur (rightmost child))
- loc))
- (with-meta [(make-node loc (peek pnodes) rs)
- (and ppath (assoc ppath :changed? true))]
- ^loc)))))
-
-(comment
-
-(load-file "/Users/rich/dev/clojure/src/zip.clj")
-(refer 'zip)
-(def data '[[a * b] + [c * d]])
-(def dz (vector-zip data))
-
-(right (down (right (right (down dz)))))
-(lefts (right (down (right (right (down dz))))))
-(rights (right (down (right (right (down dz))))))
-(up (up (right (down (right (right (down dz)))))))
-(path (right (down (right (right (down dz))))))
-
-(-> dz down right right down right)
-(-> dz down right right down right (replace '/) root)
-(-> dz next next (edit str) next next next (replace '/) root)
-(-> dz next next next next next next next next next remove root)
-(-> dz next next next next next next next next next remove (insert-right 'e) root)
-(-> dz next next next next next next next next next remove up (append-child 'e) root)
-
-(end? (-> dz next next next next next next next next next remove next))
-
-(-> dz next remove next remove root)
-
-(loop [loc dz]
- (if (end? loc)
- (root loc)
- (recur (next (if (= '* (node loc))
- (replace loc '/)
- loc)))))
-
-(loop [loc dz]
- (if (end? loc)
- (root loc)
- (recur (next (if (= '* (node loc))
- (remove loc)
- loc)))))
-)
diff --git a/etc/todo/scanners/coderay_lua_lexar.patch b/etc/todo/scanners/coderay_lua_lexar.patch
deleted file mode 100644
index 0c59559..0000000
--- a/etc/todo/scanners/coderay_lua_lexar.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-by Chris Peterson
-http://www.redmine.org/issues/show/1471
-http://www.redmine.org/attachments/642/coderay_lua_lexar.patch
-Index: vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners/lua.rb
-===================================================================
---- vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners/lua.rb (revision 0)
-+++ vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners/lua.rb (revision 0)
-@@ -0,0 +1,185 @@
-+module CodeRay
-+module Scanners
-+
-+ class Lua < Scanner
-+
-+ register_for :lua
-+
-+ include Streamable
-+
-+ RESERVED_WORDS = [
-+ 'if', 'elseif', 'else', 'then',
-+ 'end', 'do', 'while', 'true',
-+ 'false', 'in', 'for', 'and', 'or',
-+ 'function', 'local', 'not', 'repeat',
-+ 'return', 'until', 'break',
-+ ]
-+
-+ PREDEFINED_TYPES = [
-+ 'nil', 'boolean', 'number', 'string', 'table',
-+ ]
-+
-+ BUILTIN_LIBS = [
-+ 'package', 'table', 'math', 'string', 'io', 'os', 'debug',
-+ ]
-+
-+ BUILTIN_METHODS = [
-+ 'loadlib', 'path', 'cpath',
-+ 'loaded','preloaded','seeall',
-+ 'coroutine', 'create','resume','yield',
-+ 'status','running','wrap',
-+ 'insert','remove','maxn','sort',
-+ 'concat','abs','mod','floor','ceil',
-+ 'min','max','sqrt','math.pow','math.log',
-+ 'exp','log10','deg','math.pi','math.rad',
-+ 'sin','cos','tan','asin','acos',
-+ 'atan','atan2','frexp','ldexp','random',
-+ 'randomseed', 'len','sub','rep','upper',
-+ 'lower','byte','char','dump','format',
-+ 'find','gmatch','gsub','match','open',
-+ 'input','output','close','read','lines',
-+ 'write','flush','stdout','stdin','stderr',
-+ 'popen','type','tmpfile','execute','exit',
-+ 'getenv','setlocale','remove','rename','tmpname',
-+ 'clock','time','date','difftime','debug',
-+ 'getinfo','getlocal','getupvalue','traceback',
-+ 'setlocal','setupvalue','sethook','gethook',
-+ ]
-+
-+ BUILTIN_FUNCTIONS = [
-+ 'print', 'pairs','ipairs', 'error', 'load',
-+ 'require', 'getfenv', 'setfenv', 'dofile',
-+ 'loadfile', 'loadstring', 'pcall', 'xpcall',
-+ 'assert', 'type', 'tostring', 'tonumber',
-+ 'select', 'unpack', 'next', 'collectgarbage',
-+ 'module',
-+ ]
-+
-+ IDENT_KIND = WordList.new(:ident).
-+ add(RESERVED_WORDS, :reserved).
-+ add(PREDEFINED_TYPES, :pre_type).
-+ add(BUILTIN_LIBS, :predefined).
-+ add(BUILTIN_METHODS, :pre_type).
-+ add(BUILTIN_FUNCTIONS, :preprocessor)
-+
-+ ESCAPE = / [rbfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
-+ UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-+
-+ def scan_tokens tokens, options
-+
-+ state = :initial
-+
-+ until eos?
-+
-+ kind = nil
-+ match = nil
-+
-+ case state
-+
-+ when :initial
-+
-+ if scan(/ \s+ | \\\n /x)
-+ kind = :space
-+
-+ elsif scan(%r! --[^\n\\]* (?: \\. [^\n\\]* )* | --\[\[ (?: .*? \]\] | .* ) !mx)
-+ kind = :comment
-+
-+ elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
-+ kind = :operator
-+
-+ elsif match = scan(/ [#A-Za-z_][A-Za-z_0-9]* /x)
-+ kind = IDENT_KIND[match]
-+ if kind == :pre_type and check(/[^\.\:\(\']/)
-+ kind = :ident
-+ end
-+
-+ elsif match = scan(/L?"/)
-+ tokens << [:open, :string]
-+ if match[0] == ?L
-+ tokens << ['L', :modifier]
-+ match = '"'
-+ end
-+ state = :string
-+ kind = :string
-+
-+ elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
-+ kind = :char
-+
-+ elsif scan(/0[xX][0-9A-Fa-f]+/)
-+ kind = :hex
-+
-+ elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
-+ kind = :octal
-+
-+ elsif scan(/(?:\d+)(?![.eEfF])/)
-+ kind = :integer
-+
-+ elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
-+ kind = :float
-+
-+ else
-+ getch
-+ kind = :error
-+
-+ end
-+
-+ when :string
-+ if scan(/[^\\\n"]+/)
-+ kind = :content
-+ elsif scan(/"/)
-+ tokens << ['"', :string]
-+ tokens << [:close, :string]
-+ state = :initial
-+ next
-+ elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
-+ kind = :char
-+ elsif scan(/ \\ | $ /x)
-+ tokens << [:close, :string]
-+ kind = :error
-+ state = :initial
-+ else
-+ raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
-+ end
-+
-+ when :include_expected
-+ if scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/)
-+ kind = :include
-+ state = :initial
-+
-+ elsif match = scan(/\s+/)
-+ kind = :space
-+ state = :initial if match.index ?\n
-+
-+ else
-+ getch
-+ kind = :error
-+
-+ end
-+
-+ else
-+ raise_inspect 'Unknown state', tokens
-+
-+ end
-+
-+ match ||= matched
-+ if $DEBUG and not kind
-+ raise_inspect 'Error token %p in line %d' %
-+ [[match, kind], line], tokens
-+ end
-+ raise_inspect 'Empty token', tokens unless match
-+
-+ tokens << [match, kind]
-+
-+ end
-+
-+ if state == :string
-+ tokens << [:close, :string]
-+ end
-+
-+ tokens
-+ end
-+
-+ end
-+
-+end
-+end
diff --git a/etc/todo/scanners/csharp.rb b/etc/todo/scanners/csharp.rb
deleted file mode 100644
index ad1806c..0000000
--- a/etc/todo/scanners/csharp.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-module CodeRay
- module Scanners
- class CSharp < Scanner
-
- register_for :csharp
-
- RESERVED_WORDS = %w(abstract as base break case catch checked class
- const continue default delegate do else enum event explicit extern
- finally fixed for foreach goto if implicit in interface internal is
- lock namespace new operator out override params private protected
- public readonly ref return sealed sizeof stackalloc static struct
- switch this throw try typeof unchecked unsafe using virtual volatile
- void while
- add dynamic from get global group into join let orderby partial
- remove select set value var where yield)
-
- PREDEFINED_TYPES = %w(bool byte char double float int long short
- decimal uint ulong ushort object sbyte string)
-
- PREDEFINED_CONSTANTS = %w(true false null)
-
- IDENT_KIND = WordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- ESCAPE = / [rbfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
- state = :initial
-
- until eos?
- kind = nil
- match = nil
-
- case state
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
- kind = :comment
-
- elsif match = scan(/ \# \s* if \s* 0 /x)
- match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos?
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- if kind == :ident and check(/:(?!:)/)
- match << scan(/:/)
- kind = :label
- end
-
- elsif match = scan(/"/)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif match = scan(/@"/)
- tokens << [:open, :string]
- state = :stringat
- kind = :delimiter
-
- elsif scan(/#\s*(\w*)/)
- kind = :preprocessor
-
- elsif scan(/ ' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
- kind = :char
-
- elsif scan(/0[xX][0-9A-Fa-f]+/)
- kind = :hex
-
- elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :octal
-
- elsif scan(/(?:\d+)(?![.eEfFdDmML])/)
- kind = :integer
-
- elsif scan(/\d[fFdDmM]?|\d*\.\d+(?:[eE][+-]?\d+)?[fFdDmM]?|\d+[eE][+-]?\d+[fFdDmM]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n"]+/)
- kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- when :stringat
- if scan(/[^"]+/)
- kind = :content
- elsif scan(/""/)
- kind = :char
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
- end
- end
-end
diff --git a/etc/todo/scanners/css.rb b/etc/todo/scanners/css.rb
deleted file mode 100644
index f1072f1..0000000
--- a/etc/todo/scanners/css.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-module CodeRay
-module Scanners
-
- class Css < Scanner
-
- register_for :css
-
- module RE
- NonASCII = /[\x80-\xFF]/
- Hex = /[0-9a-fA-F]/
- Unicode = /\\#{Hex}{1,6}(?:\r\n|\s)?/ # differs from standard because it allows uppercase hex too
- Escape = /#{Unicode}|\\[^\r\n\f0-9a-fA-F]/
- NMChar = /[_a-zA-Z0-9-]|#{NonASCII}|#{Escape}/
- NMStart = /[_a-zA-Z]|#{NonASCII}|#{Escape}/
- NL = /\r\n|\r|\n|\f/
- String1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"/
- String2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'/
- String = /#{String1}|#{String2}/
- Invalid1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*/
- Invalid2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*/
- Invalid = /#{Invalid1}|#{Invalid2}/
- W = /\s+/
- S = W
-
- HexColor = /#(?:#{Hex}{6}|#{Hex}{3})/
- Color = /#{HexColor}/
-
- Num = /-?(?:[0-9]+|[0-9]*\.[0-9]+)/
- Name = /#{NMChar}+/
- Ident = /-?#{NMStart}#{NMChar}*/
- AtKeyword = /@#{Ident}/
- Percentage = /#{Num}%/
-
- reldimensions = %w[em ex px]
- absdimensions = %w[in cm mm pt pc]
- Unit = /#{(reldimensions + absdimensions).join('|')}/
-
- Dimension = /#{Num}#{Unit}/
-
- Comment = %r! /\* (?: .*? \*/ | .* ) !mx
- URL = /url\((?:[^)\n\r\f]|\\\))*\)/
-
-
- Id = /##{Name}/
- Class = /\.#{Name}/
-
- end
-
- def scan_tokens tokens, options
- states = [:initial]
- i = 0
- until eos?
-
- kind = nil
- match = nil
-
- if states.last == :comment
- if scan /(?:[^\n\r\f*]|\*(?!\/))+/
- kind = :comment
-
- elsif scan /\*\//
- kind = :comment
- states.pop
-
- elsif scan RE::S
- kind = :space
- end
-
- elsif scan RE::S
- kind = :space
-
- elsif scan /\/\*/
- kind = :comment
- states.push :comment
-
- elsif scan RE::String
- kind = :string
-
- elsif scan RE::AtKeyword
- kind = :reserved
-
- elsif scan RE::Invalid
- kind = :error
-
- elsif scan RE::URL
- kind = :string
-
- elsif scan RE::Dimension
- kind = :float
-
- elsif scan RE::Percentage
- kind = :float
-
- elsif scan RE::Num
- kind = :float
-
- elsif scan /\{/
- kind = :operator
- states.push :block
-
- elsif scan /\}/
- if states.last == :block
- kind = :operator
- states.pop
- else
- kind = :error
- end
-
- elsif
- case states.last
- when :initial
-
- if scan RE::Class
- kind = :class
-
- elsif scan RE::Id
- kind = :constant
-
- elsif scan RE::Ident
- kind = :label
-
- elsif scan RE::Name
- kind = :identifier
-
- end
-
- when :block
- if scan RE::Color
- kind = :color
-
- elsif scan RE::Ident
- kind = :definition
-
- elsif scan RE::Name
- kind = :symbol
-
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- else
- getch
- kind = :error
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- tokens
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/javascript.rb b/etc/todo/scanners/javascript.rb
deleted file mode 100644
index da67084..0000000
--- a/etc/todo/scanners/javascript.rb
+++ /dev/null
@@ -1,199 +0,0 @@
-module CodeRay
-module Scanners
-
- # Basic Javascript scanner
- class Javascript < Scanner
-
- include Streamable
-
- register_for :javascript
-
- helper :patterns
-
- DEFAULT_OPTIONS = {
- }
-
- private
- def scan_tokens tokens, options
- first_bake = saved_tokens = nil
- last_token_dot = false
- last_state = nil
- state = :initial
- depth = nil
- inline_block_stack = []
-
- patterns = Patterns # avoid constant lookup
-
- until eos?
- match = nil
- kind = nil
-
- if state.instance_of? patterns::StringState
-# {{{
- match = scan_until(state.pattern) || scan_until(/\z/)
- tokens << [match, :content] unless match.empty?
- break if eos?
-
- case match = getch
-
- when state.delim
- if state.paren
- state.paren_depth -= 1
- if state.paren_depth > 0
- tokens << [match, :nesting_delimiter]
- next
- end
- end
- tokens << [match, :delimiter]
- tokens << [:close, state.type]
- state = state.next_state
-
- when '\\'
- if state.interpreted
- if esc = scan(/ #{patterns::ESCAPE} /ox)
- tokens << [match + esc, :char]
- else
- tokens << [match, :error]
- end
- else
- case m = getch
- when state.delim, '\\'
- tokens << [match + m, :char]
- when nil
- tokens << [match, :error]
- else
- tokens << [match + m, :content]
- end
- end
-
- when '#'
- case peek(1)[0]
- when ?{
- inline_block_stack << [state, depth]
- state = :initial
- depth = 1
- tokens << [:open, :inline]
- tokens << [match + getch, :delimiter]
- when ?$, ?@
- tokens << [match, :escape]
- last_state = state # scan one token as normal code, then return here
- state = :initial
- else
- raise_inspect 'else-case # reached; #%p not handled' % peek(1), tokens
- end
-
- when state.paren
- state.paren_depth += 1
- tokens << [match, :nesting_delimiter]
-
- else
- raise_inspect 'else-case " reached; %p not handled, state = %p' % [match, state], tokens
-
- end
- next
-# }}}
- else
-# {{{
- if match = scan(/ [ \t\f]+ | \\? \n | \# .* /x)
- case m = match[0]
- when ?\s, ?\t, ?\f
- match << scan(/\s*/) unless eos?
- kind = :space
- when ?\n, ?\\
- kind = :space
- match << scan(/\s*/) unless eos?
- when ?#, ?=, ?_
- kind = :comment
- else
- raise_inspect 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens
- end
- tokens << [match, kind]
- next
-
- elsif state == :initial
-
- # IDENTS #
- if match = scan(/#{patterns::METHOD_NAME}/o)
- kind = last_token_dot ? :ident :
- patterns::IDENT_KIND[match]
-
- # OPERATORS #
- elsif (not last_token_dot and match = scan(/ ==?=? | \.\.?\.? | [\(\)\[\]\{\}] | :: | , /x)) or
- (last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}/o))
- last_token_dot = :set if match == '.' or match == '::'
- kind = :operator
- unless inline_block_stack.empty?
- case match
- when '{'
- depth += 1
- when '}'
- depth -= 1
- if depth == 0 # closing brace of inline block reached
- state, depth = inline_block_stack.pop
- tokens << [match, :delimiter]
- kind = :inline
- match = :close
- end
- end
- end
-
- elsif match = scan(/ ['"] /mx)
- tokens << [:open, :string]
- kind = :delimiter
- state = patterns::StringState.new :string, match == '"', match # important for streaming
-
- elsif match = scan(/#{patterns::NUMERIC}/o)
- kind = if self[1] then :float else :integer end
-
- elsif match = scan(/ \+\+ | -- | << | >> /x)
- kind = :operator
-
- elsif match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)
- kind = :operator
-
- elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
- kind = :operator
-
- else
- kind = :error
- match = getch
-
- end
-
- end
-# }}}
-
- last_token_dot = last_token_dot == :set
-
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens, state
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- if last_state
- state = last_state
- last_state = nil
- end
- end
- end
-
- inline_block_stack << [state] if state.is_a? patterns::StringState
- until inline_block_stack.empty?
- this_block = inline_block_stack.pop
- tokens << [:close, :inline] if this_block.size > 1
- state = this_block.first
- tokens << [:close, state.type]
- end
-
- tokens
- end
-
- end
-
-end
-end
-
-# vim:fdm=marker
diff --git a/etc/todo/scanners/lisp.rb b/etc/todo/scanners/lisp.rb
deleted file mode 100644
index 73ce0da..0000000
--- a/etc/todo/scanners/lisp.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-# By Nathan Weizenbaum (http://nex3.leeweiz.net)
-# MIT License (http://www.opensource.org/licenses/mit-license.php)
-#
-# CodeRay scanner for Lisp.
-# The keywords are mostly geared towards Emacs Lisp,
-# but it should work fine for Common Lisp
-# and reasonably well for Scheme.
-
-require 'rubygems'
-require 'coderay'
-
-module CodeRay::Scanners
- class Lisp < Scanner
- register_for :lisp
-
- NON_SYMBOL_CHARS = '();\s\[\]'
- SYMBOL_RE = /[^#{NON_SYMBOL_CHARS}]+/
- EXPONENT_RE = /(e[\-+]?[0-9]+)?/
-
- GEN_DEFINES = %w{
- defun defun* defsubst defmacro defadvice define-skeleton define-minor-mode
- define-global-minor-mode define-globalized-minor-mode define-derived-mode
- define-generic-mode define-compiler-macro define-modify-macro defsetf
- define-setf-expander define-method-combination defgeneric defmethod
- }
- TYPE_DEFINES = %w{
- defgroup deftheme deftype defstruct defclass define-condition
- define-widget defface defpackage
- }
- VAR_DEFINES = %w{
- defvar defconst defconstant defcustom defparameter define-symbol-macro
- }
- KEYWORDS = (GEN_DEFINES + TYPE_DEFINES + VAR_DEFINES + %w{
- lambda autoload progn prog1 prog2 save-excursion save-window-excursion
- save-selected-window save-restriction save-match-data save-current-buffer
- with-current-buffer combine-after-change-calls with-output-to-string
- with-temp-file with-temp-buffer with-temp-message with-syntax-table let
- let* while if read-if catch condition-case unwind-protect
- with-output-to-temp-buffer eval-after-load dolist dotimes when unless
- }).inject({}) { |memo, str| memo[str] = nil; memo }
-
- DEFINES = WordList.new.
- add(GEN_DEFINES, :function).
- add(TYPE_DEFINES, :class).
- add(VAR_DEFINES, :variable)
-
- def scan_tokens(tokens, options)
- defined = false
- until eos?
- kind = nil
- match = nil
-
- if scan(/\s+/m)
- kind = :space
- else
- if scan(/[\(\)\[\]]/)
- kind = :delimiter
- elsif scan(/'+#{SYMBOL_RE}/)
- kind = :symbol
- elsif scan(/\&#{SYMBOL_RE}/)
- kind = :reserved
- elsif scan(/:#{SYMBOL_RE}/)
- kind = :constant
- elsif scan(/\?#{SYMBOL_RE}/)
- kind = :char
- elsif match = scan(/"(\\"|[^"])+"/m)
- tokens << [:open, :string] << ['"', :delimiter] <<
- [match[1...-1], :content] << ['"', :delimiter] << [:close, :string]
- next
- elsif scan(/[\-+]?[0-9]*\.[0-9]+#{EXPONENT_RE}/)
- kind = :float
- elsif scan(/[\-+]?[0-9]+#{EXPONENT_RE}/)
- kind = :integer
- elsif scan(/;.*$/)
- kind = :comment
- elsif scan(SYMBOL_RE)
- kind = :plain
-
- if defined
- kind = defined
- else
- sym = matched
- if KEYWORDS.include? sym
- kind = :reserved
- defined = DEFINES[sym]
- end
- end
- end
- end
-
- match ||= matched
- raise_inspect 'Empty token', tokens unless match
-
- defined = [:reserved, :comment, :space].include?(kind) && defined
-
- tokens << [match, kind]
- end
-
- tokens
- end
- end
-end \ No newline at end of file
diff --git a/etc/todo/scanners/paste-333 (DIFF).rb b/etc/todo/scanners/paste-333 (DIFF).rb
deleted file mode 100644
index e6e1dff..0000000
--- a/etc/todo/scanners/paste-333 (DIFF).rb
+++ /dev/null
@@ -1,88 +0,0 @@
-## diff.rb
-
-module CodeRay module Scanners
-
- class Diff < Scanner
-
- register_for :diff
-
- def scan_tokens tokens, options
-
- until eos?
-
- kind = :space
- match = nil
-
- # remove newlines
- if scan(/\n/)
- kind = :space
- elsif scan(/^[+-]{3} .*$/)
- kind = :diffhead
- elsif scan(/^[+].*$/)
- kind = :add
- elsif scan(/^[-].*$/)
- kind = :delete
- elsif scan(/^[^ ].*$/)
- kind = :diffhead
- elsif scan(/^ .*$/)
- kind = :space
- else
- getch
- end
-
- match ||= matched
- raise [match, kind], tokens if kind == :error
-
- tokens << [match, kind]
-
- end
-
- tokens
- end
-
- end
-
-end end
-
-## styles (cycnus) [plain]
-
-.add { color:green; background:#dfd; }
-.delete { color:red; background:#fdd; }
-.diffhead { color:#999; background: #e7e7ff; }
-
-## tokens (encoder/html/classes.rb)
-
- ClassOfKind = {
- :add => "add",
- :delete => "delete",
- :diffhead => "diffhead",
-
-## example diff [diff]
-Index: /Users/jgoebel/rails/pastie/app/controllers/pastes_controller.rb
-===================================================================
---- /Users/jgoebel/rails/pastie/app/controllers/pastes_controller.rb (revision 1431)
-+++ /Users/jgoebel/rails/pastie/app/controllers/pastes_controller.rb (revision 1437)
-@@ -1,6 +1,10 @@
-+require 'login_system'
- require 'coderay'
-
- class PastesController < ApplicationController
-+ include LoginSystem
-+
-+ before_filter :attempt_cookie_login
-
- # caches_action :recent
-
-@@ -10,11 +14,7 @@
-
- def show
- @paste = Paste.find(params[:id])
-- if params[:key] and params[:key]==User.new(@paste.nick).magic_mojo
-- session[:login]=@paste.nick
-- return redirect_to(:action => 'show', :id => @paste.id)
-- end
--
-+ attempt_key_login if not logged_in?
- unless @paste.asset or not @paste.body.blank?
- render :action => "edit"
- end \ No newline at end of file
diff --git a/etc/todo/scanners/paste-693 (IO).rb b/etc/todo/scanners/paste-693 (IO).rb
deleted file mode 100644
index ee13933..0000000
--- a/etc/todo/scanners/paste-693 (IO).rb
+++ /dev/null
@@ -1,134 +0,0 @@
-module CodeRay module Scanners
-
- #A simple scanner for a simple language: Io
-
- class Io < Scanner
-
- register_for :io
-
- RESERVED_WORDS = [ 'clone','init', 'method', 'list', 'vector', 'block', 'if','ifTrue','ifFalse','ifTrueIfFalse','then', 'for','loop',
- 'reverseForeach','foreach','map','continue','break','while','do','return',
- 'self','sender','target','proto','parent','protos']
-
- PREDEFINED_TYPES = []
-
- PREDEFINED_CONSTANTS = ['Object', 'Lobby',
- 'TRUE','true','FALSE','false','NULL','null','Null','Nil','nil','YES','NO']
-
- IDENT_KIND = WordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- ESCAPE = / [rbfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = :error
- match = nil
-
- if state == :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
- kind = :comment
-
-
- elsif scan(/ [-+*\/\$\@=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- if kind == :ident and check(/:(?!:)/)
- match << scan(/:/)
- kind = :label
- end
-
- elsif match = scan(/L?"/)
- tokens << [:open, :string]
- if match[0] == ?L
- tokens << ['L', :modifier]
- match = '"'
- end
- state = :string
- kind = :delimiter
-
- elsif scan(/#\s*(\w*)/)
- kind = :preprocessor # FIXME multiline preprocs
- state = :include_expected if self[1] == 'include'
-
- elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
- kind = :char
-
- elsif scan(/0[xX][0-9A-Fa-f]+/)
- kind = :hex
-
- elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :octal
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- end
-
- elsif state == :string
- if scan(/[^\\"]+/)
- kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- kind = :error
- state = :initial
- else
- raise "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- elsif state == :include_expected
- if scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/)
- kind = :include
- state = :initial
-
- elsif match = scan(/\s+/)
- kind = :space
- state = :initial if match.index ?\n
-
- else
- getch
-
- end
-
- else
- raise 'else-case reached', tokens
-
- end
-
- match ||= matched
- raise [match, kind], tokens if kind == :error
-
- tokens << [match, kind]
-
- end
-
- tokens
- end
-
- end
-
-end end \ No newline at end of file
diff --git a/etc/todo/scanners/php-constants.txt b/etc/todo/scanners/php-constants.txt
deleted file mode 100644
index c15da2d..0000000
--- a/etc/todo/scanners/php-constants.txt
+++ /dev/null
@@ -1,248 +0,0 @@
-PHP_VERSION
-PHP_MAJOR_VERSION
-PHP_MINOR_VERSION
-PHP_RELEASE_VERSION
-PHP_VERSION_ID
-PHP_EXTRA_VERSION
-PHP_ZTS
-PHP_DEBUG
-PHP_MAXPATHLEN
-PHP_OS
-PHP_SAPI
-PHP_EOL
-PHP_INT_MAX
-PHP_INT_SIZE
-DEFAULT_INCLUDE_PATH
-PEAR_INSTALL_DIR
-PEAR_EXTENSION_DIR
-PHP_EXTENSION_DIR
-PHP_PREFIX
-PHP_BINDIR
-PHP_LIBDIR
-PHP_DATADIR
-PHP_SYSCONFDIR
-PHP_LOCALSTATEDIR
-PHP_CONFIG_FILE_PATH
-PHP_CONFIG_FILE_SCAN_DIR
-PHP_SHLIB_SUFFIX
-PHP_OUTPUT_HANDLER_START
-PHP_OUTPUT_HANDLER_CONT
-PHP_OUTPUT_HANDLER_END
-E_ERROR
-E_WARNING
-E_PARSE
-E_NOTICE
-E_CORE_ERROR
-E_CORE_WARNING
-E_COMPILE_ERROR
-E_COMPILE_WARNING
-E_USER_ERROR
-E_USER_WARNING
-E_USER_NOTICE
-E_DEPRECATED
-E_USER_DEPRECATED
-E_ALL
-E_STRICT
-__COMPILER_HALT_OFFSET__
-TRUE
-FALSE
-NULL
-EXTR_OVERWRITE
-EXTR_SKIP
-EXTR_PREFIX_SAME
-EXTR_PREFIX_ALL
-EXTR_PREFIX_INVALID
-EXTR_PREFIX_IF_EXISTS
-EXTR_IF_EXISTS
-SORT_ASC
-SORT_DESC
-SORT_REGULAR
-SORT_NUMERIC
-SORT_STRING
-CASE_LOWER
-CASE_UPPER
-COUNT_NORMAL
-COUNT_RECURSIVE
-ASSERT_ACTIVE
-ASSERT_CALLBACK
-ASSERT_BAIL
-ASSERT_WARNING
-ASSERT_QUIET_EVAL
-CONNECTION_ABORTED
-CONNECTION_NORMAL
-CONNECTION_TIMEOUT
-INI_USER
-INI_PERDIR
-INI_SYSTEM
-INI_ALL
-M_E
-M_LOG2E
-M_LOG10E
-M_LN2
-M_LN10
-M_PI
-M_PI_2
-M_PI_4
-M_1_PI
-M_2_PI
-M_2_SQRTPI
-M_SQRT2
-M_SQRT1_2
-CRYPT_SALT_LENGTH
-CRYPT_STD_DES
-CRYPT_EXT_DES
-CRYPT_MD5
-CRYPT_BLOWFISH
-DIRECTORY_SEPARATOR
-SEEK_SET
-SEEK_CUR
-SEEK_END
-LOCK_SH
-LOCK_EX
-LOCK_UN
-LOCK_NB
-HTML_SPECIALCHARS
-HTML_ENTITIES
-ENT_COMPAT
-ENT_QUOTES
-ENT_NOQUOTES
-INFO_GENERAL
-INFO_CREDITS
-INFO_CONFIGURATION
-INFO_MODULES
-INFO_ENVIRONMENT
-INFO_VARIABLES
-INFO_LICENSE
-INFO_ALL
-CREDITS_GROUP
-CREDITS_GENERAL
-CREDITS_SAPI
-CREDITS_MODULES
-CREDITS_DOCS
-CREDITS_FULLPAGE
-CREDITS_QA
-CREDITS_ALL
-STR_PAD_LEFT
-STR_PAD_RIGHT
-STR_PAD_BOTH
-PATHINFO_DIRNAME
-PATHINFO_BASENAME
-PATHINFO_EXTENSION
-PATH_SEPARATOR
-CHAR_MAX
-LC_CTYPE
-LC_NUMERIC
-LC_TIME
-LC_COLLATE
-LC_MONETARY
-LC_ALL
-LC_MESSAGES
-ABDAY_1
-ABDAY_2
-ABDAY_3
-ABDAY_4
-ABDAY_5
-ABDAY_6
-ABDAY_7
-DAY_1
-DAY_2
-DAY_3
-DAY_4
-DAY_5
-DAY_6
-DAY_7
-ABMON_1
-ABMON_2
-ABMON_3
-ABMON_4
-ABMON_5
-ABMON_6
-ABMON_7
-ABMON_8
-ABMON_9
-ABMON_10
-ABMON_11
-ABMON_12
-MON_1
-MON_2
-MON_3
-MON_4
-MON_5
-MON_6
-MON_7
-MON_8
-MON_9
-MON_10
-MON_11
-MON_12
-AM_STR
-PM_STR
-D_T_FMT
-D_FMT
-T_FMT
-T_FMT_AMPM
-ERA
-ERA_YEAR
-ERA_D_T_FMT
-ERA_D_FMT
-ERA_T_FMT
-ALT_DIGITS
-INT_CURR_SYMBOL
-CURRENCY_SYMBOL
-CRNCYSTR
-MON_DECIMAL_POINT
-MON_THOUSANDS_SEP
-MON_GROUPING
-POSITIVE_SIGN
-NEGATIVE_SIGN
-INT_FRAC_DIGITS
-FRAC_DIGITS
-P_CS_PRECEDES
-P_SEP_BY_SPACE
-N_CS_PRECEDES
-N_SEP_BY_SPACE
-P_SIGN_POSN
-N_SIGN_POSN
-DECIMAL_POINT
-RADIXCHAR
-THOUSANDS_SEP
-THOUSEP
-GROUPING
-YESEXPR
-NOEXPR
-YESSTR
-NOSTR
-CODESET
-LOG_EMERG
-LOG_ALERT
-LOG_CRIT
-LOG_ERR
-LOG_WARNING
-LOG_NOTICE
-LOG_INFO
-LOG_DEBUG
-LOG_KERN
-LOG_USER
-LOG_MAIL
-LOG_DAEMON
-LOG_AUTH
-LOG_SYSLOG
-LOG_LPR
-LOG_NEWS
-LOG_UUCP
-LOG_CRON
-LOG_AUTHPRIV
-LOG_LOCAL0
-LOG_LOCAL1
-LOG_LOCAL2
-LOG_LOCAL3
-LOG_LOCAL4
-LOG_LOCAL5
-LOG_LOCAL6
-LOG_LOCAL7
-LOG_PID
-LOG_CONS
-LOG_ODELAY
-LOG_NDELAY
-LOG_NOWAIT
-LOG_PERROR
diff --git a/etc/todo/scanners/php.rb b/etc/todo/scanners/php.rb
deleted file mode 100644
index 239fbf8..0000000
--- a/etc/todo/scanners/php.rb
+++ /dev/null
@@ -1,282 +0,0 @@
-class Regexp
- def |(other)
- Regexp.union(self, other)
- end
- def +(other)
- /#{self}#{other}/
- end
-end
-module CodeRay
-module Scanners
-
- load :html
-
- class PHP < Scanner
-
- register_for :php
-
- def setup
- @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
- end
-
- def reset_instance
- super
- @html_scanner.reset
- end
-
- module Words
- ControlKeywords = %w!
- if else elseif while do for switch case default declare foreach as
- endif endwhile endfor endforeach endswitch enddeclare return break
- continue exit die try catch throw
- !
- OtherKeywords = %w!
- function class extends implements instanceof parent self var const
- private public protected static abstract final global new echo include
- require include_once require_once eval print use unset isset empty
- interface list array clone null true false
- !
-
- SpecialConstants = %w! __LINE__ __FILE__ __CLASS__
- __METHOD__ __FUNCTION__
- !
- IdentKinds = WordList.new(:ident).
- add(ControlKeywords, :reserved).
- add(OtherKeywords, :pre_type).
- add(SpecialConstants, :pre_constant)
- end
- module RE
- def self.build_alternatives(array)
- Regexp.new(array.map { |s| Regexp.escape(s) }.join('|') , Regexp::IGNORECASE)
- end
-
- PHPStart = /
- <script language="php"> |
- <script language='php'> |
- <\?php |
- <\?(?!xml) |
- <%
- /xi
-
- PHPEnd = %r!
- </script> |
- \?> |
- %>
- !xi
-
- IChar = /[a-z0-9_\x80-\xFF]/i
- IStart = /[a-z_\x80-\xFF]/i
- Identifier = /#{IStart}#{IChar}*/
- Variable = /\$#{Identifier}/
-
- Typecasts = build_alternatives %w!
- float double real int integer bool boolean string array object null
- !.map{|s| "(#{s})"}
- OneLineComment1 = %r!//.*?(?=#{PHPEnd}|$)!
- OneLineComment2 = %r!#.*?(?=#{PHPEnd}|$)!
- OneLineComment = OneLineComment1 | OneLineComment2
-
- HereDoc = /<<</ + Identifier
-
- binops = %w!
- + - * / << >> & | ^ . %
- !
-
- ComparisionOperator = build_alternatives %w$
- === !== == != <= >=
- $
- IncDecOperator = build_alternatives %w! ++ -- !
-
- BinaryOperator = build_alternatives binops
- AssignOperator = build_alternatives binops.map {|s| "${s}=" }
- LogicalOperator = build_alternatives %w! and or xor not !
- ObjectOperator = build_alternatives %w! -> :: !
- OtherOperator = build_alternatives %w$ => = ? : [ ] ( ) ; , ~ ! @ > <$
-
- Operator = ComparisionOperator | IncDecOperator | LogicalOperator |
- ObjectOperator | AssignOperator | BinaryOperator | OtherOperator
-
-
- S = /\s+/
-
- Integer = /-?0x[0-9a-fA-F]/ | /-?\d+/
- Float = /-?(?:\d+\.\d*|\d*\.\d+)(?:e[+-]\d+)?/
-
- end
-
-
-
- def scan_tokens tokens, options
- states = [:php, :html]
- heredocdelim = nil
-
- until eos?
- match = nil
- kind = nil
- case states.last
- when :html
- if scan RE::PHPStart
- kind = :delimiter
- states.pop
- else
- match = scan_until(/(?=#{RE::PHPStart})/o) || scan_until(/\z/)
- @html_scanner.tokenize match if not match.empty?
- kind = :space
- match = ''
- end
-
- when :php
- if scan RE::PHPEnd
- kind = :delimiter
- states.push :html
-
- elsif scan RE::S
- kind = :space
-
- elsif scan /\/\*/
- kind = :comment
- states.push :mlcomment
-
- elsif scan RE::OneLineComment
- kind = :comment
-
- elsif match = scan(RE::Identifier)
- kind = Words::IdentKinds[match]
- if kind == :ident and check(/:(?!:)/) and tokens[-2][0] == 'case'
-# match << scan(/:/)
- kind = :label
- elsif kind == :ident and match =~ /^[A-Z]/
- kind = :constant
- end
-
- elsif scan RE::Integer
- kind = :integer
-
- elsif scan RE::Float
- kind = :float
-
- elsif scan /'/
- kind = :delimiter
- states.push :sqstring
-
- elsif scan /"/
- kind = :delimiter
- states.push :dqstring
-
- elsif match = scan(RE::HereDoc)
- heredocdelim = match[RE::Identifier]
- kind = :delimiter
- states.push = :heredocstring
-
- elsif scan RE::Variable
- kind = :local_variable
-
- elsif scan /\{/
- kind = :operator
- states.push :php
-
- elsif scan /\}/
- if states.length == 1
- kind = :error
- else
- kind = :operator
- states.pop
- end
-
- elsif scan RE::Operator
- kind = :operator
-
- else
- getch
- kind = :error
-
- end
-
- when :mlcomment
- if scan /(?:[^\n\r\f*]|\*(?!\/))+/
- kind = :comment
-
- elsif scan /\*\//
- kind = :comment
- states.pop
-
- elsif scan /[\r\n\f]+/
- kind = :space
- end
-
- when :sqstring
- if scan /[^\r\n\f'\\]+/
- kind = :string
- elsif match = scan(/\\\\|\\'/)
- kind = :char
- elsif scan /\\/
- kind = :string
- elsif scan /[\r\n\f ]+/
- kind = :space
- elsif scan /'/
- kind = :delimiter
- states.pop
- end
-
- when :dqstring
-#todo: $foo[bar] kind of stuff
- if scan /[^\r\n\f"${\\]+/
- kind = :string
- elsif scan /\\x[a-fA-F]{2}/
- kind = :char
- elsif scan /\\\d{3}/
- kind = :char
- elsif scan /\\["\\abcfnrtyv]/
- kind = :char
- elsif scan /\\/
- kind = :string
- elsif scan /[\r\n\f]+/
- kind = :space
- elsif match = scan(RE::Variable)
- kind = :local_variable
- if check(/\[#{RE::Identifier}\]/)
- match << scan(/\[#{RE::Identifier}\]/)
- elsif check(/\[/)
- match << scan(/\[#{RE::Identifier}?/)
- kind = :error
- elsif check(/->#{RE::Identifier}/)
- match << scan(/->#{RE::Identifier}/)
- end
- elsif scan /\{/
- if check(/\$/)
- kind = :operator
- states.push :php
- else
- kind = :string
- end
- match = '{'
- elsif scan /\$\{#{RE::Identifier}\}/
- kind = :local_variable
- elsif scan /\$/
- kind = :string
- elsif scan /"/
- kind = :delimiter
- states.pop
- end
- else
- raise "Unknown state!"
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
- tokens
-
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/php_builtin_functions.txt b/etc/todo/scanners/php_builtin_functions.txt
deleted file mode 100644
index ba8897a..0000000
--- a/etc/todo/scanners/php_builtin_functions.txt
+++ /dev/null
@@ -1,5075 +0,0 @@
-abs
-acos
-acosh
-addcslashes
-addslashes
-aggregate
-aggregate_info
-aggregate_methods
-aggregate_methods_by_list
-aggregate_methods_by_regexp
-aggregate_properties
-aggregate_properties_by_list
-aggregate_properties_by_regexp
-aggregation_info
-apache_child_terminate
-apache_get_modules
-apache_get_version
-apache_getenv
-apache_lookup_uri
-apache_note
-apache_request_headers
-apache_reset_timeout
-apache_response_headers
-apache_setenv
-apc_add
-apc_cache_info
-apc_clear_cache
-apc_compile_file
-apc_define_constants
-apc_delete
-apc_fetch
-apc_load_constants
-apc_sma_info
-apc_store
-apd_breakpoint
-apd_callstack
-apd_clunk
-apd_continue
-apd_croak
-apd_dump_function_table
-apd_dump_persistent_resources
-apd_dump_regular_resources
-apd_echo
-apd_get_active_symbols
-apd_set_pprof_trace
-apd_set_session
-apd_set_session_trace
-apd_set_session_trace_socket
-array
-array_change_key_case
-array_chunk
-array_combine
-array_count_values
-array_diff
-array_diff_assoc
-array_diff_key
-array_diff_uassoc
-array_diff_ukey
-array_fill
-array_fill_keys
-array_filter
-array_flip
-array_intersect
-array_intersect_assoc
-array_intersect_key
-array_intersect_uassoc
-array_intersect_ukey
-array_key_exists
-array_keys
-array_map
-array_merge
-array_merge_recursive
-array_multisort
-array_pad
-array_pop
-array_product
-array_push
-array_rand
-array_reduce
-array_reverse
-array_search
-array_shift
-array_slice
-array_splice
-array_sum
-array_udiff
-array_udiff_assoc
-array_udiff_uassoc
-array_uintersect
-array_uintersect_assoc
-array_uintersect_uassoc
-array_unique
-array_unshift
-array_values
-array_walk
-array_walk_recursive
-arsort
-ascii2ebcdic
-asin
-asinh
-asort
-assert
-assert_options
-atan
-atan2
-atanh
-base_convert
-base64_decode
-base64_encode
-basename
-bbcode_add_element
-bbcode_add_smiley
-bbcode_create
-bbcode_destroy
-bbcode_parse
-bbcode_set_arg_parser
-bbcode_set_flags
-bcadd
-bccomp
-bcdiv
-bcmod
-bcmul
-bcompiler_load
-bcompiler_load_exe
-bcompiler_parse_class
-bcompiler_read
-bcompiler_write_class
-bcompiler_write_constant
-bcompiler_write_exe_footer
-bcompiler_write_file
-bcompiler_write_footer
-bcompiler_write_function
-bcompiler_write_functions_from_file
-bcompiler_write_header
-bcompiler_write_included_filename
-bcpow
-bcpowmod
-bcscale
-bcsqrt
-bcsub
-bin2hex
-bind_textdomain_codeset
-bindec
-bindtextdomain
-bzclose
-bzcompress
-bzdecompress
-bzerrno
-bzerror
-bzerrstr
-bzflush
-bzopen
-bzread
-bzwrite
-cal_days_in_month
-cal_from_jd
-cal_info
-cal_to_jd
-calcul_hmac
-calculhmac
-call_user_func
-call_user_func_array
-call_user_method
-call_user_method_array
-ceil
-chdir
-checkdate
-checkdnsrr
-chgrp
-chmod
-chop
-chown
-chr
-chroot
-chunk_split
-class_exists
-class_implements
-class_parents
-classkit_import
-classkit_method_add
-classkit_method_copy
-classkit_method_redefine
-classkit_method_remove
-classkit_method_rename
-clearstatcache
-closedir
-closelog
-com_addref
-com_create_guid
-com_event_sink
-com_get
-com_get_active_object
-com_invoke
-com_isenum
-com_load
-com_load_typelib
-com_message_pump
-com_print_typeinfo
-com_propget
-com_propput
-com_propset
-com_release
-com_set
-compact
-connection_aborted
-connection_status
-connection_timeout
-constant
-convert_cyr_string
-convert_uudecode
-convert_uuencode
-copy
-cos
-cosh
-count
-count_chars
-counter_bump
-counter_bump_value
-counter_create
-counter_get
-counter_get_meta
-counter_get_named
-counter_get_value
-counter_reset
-counter_reset_value
-crack_check
-crack_closedict
-crack_getlastmessage
-crack_opendict
-crc32
-create_function
-crypt
-ctype_alnum
-ctype_alpha
-ctype_cntrl
-ctype_digit
-ctype_graph
-ctype_lower
-ctype_print
-ctype_punct
-ctype_space
-ctype_upper
-ctype_xdigit
-curl_close
-curl_copy_handle
-curl_errno
-curl_error
-curl_exec
-curl_getinfo
-curl_init
-curl_multi_add_handle
-curl_multi_close
-curl_multi_exec
-curl_multi_getcontent
-curl_multi_info_read
-curl_multi_init
-curl_multi_remove_handle
-curl_multi_select
-curl_setopt
-curl_setopt_array
-curl_version
-current
-cyrus_authenticate
-cyrus_bind
-cyrus_close
-cyrus_connect
-cyrus_query
-cyrus_unbind
-date
-date_add
-date_create
-date_create_from_format
-date_date_set
-date_default_timezone_get
-date_default_timezone_set
-date_diff
-date_format
-date_get_last_errors
-date_interval_create_from_date_string
-date_interval_format
-date_isodate_set
-date_modify
-date_offset_get
-date_parse
-date_parse_from_format
-date_sub
-date_sun_info
-date_sunrise
-date_sunset
-date_time_set
-date_timestamp_get
-date_timestamp_set
-date_timezone_get
-date_timezone_set
-db2_autocommit
-db2_bind_param
-db2_client_info
-db2_close
-db2_column_privileges
-db2_columns
-db2_commit
-db2_conn_error
-db2_conn_errormsg
-db2_connect
-db2_cursor_type
-db2_escape_string
-db2_exec
-db2_execute
-db2_fetch_array
-db2_fetch_assoc
-db2_fetch_both
-db2_fetch_object
-db2_fetch_row
-db2_field_display_size
-db2_field_name
-db2_field_num
-db2_field_precision
-db2_field_scale
-db2_field_type
-db2_field_width
-db2_foreign_keys
-db2_free_result
-db2_free_stmt
-db2_get_option
-db2_last_insert_id
-db2_lob_read
-db2_next_result
-db2_num_fields
-db2_num_rows
-db2_pclose
-db2_pconnect
-db2_prepare
-db2_primary_keys
-db2_procedure_columns
-db2_procedures
-db2_result
-db2_rollback
-db2_server_info
-db2_set_option
-db2_special_columns
-db2_statistics
-db2_stmt_error
-db2_stmt_errormsg
-db2_table_privileges
-db2_tables
-dba_close
-dba_delete
-dba_exists
-dba_fetch
-dba_firstkey
-dba_handlers
-dba_insert
-dba_key_split
-dba_list
-dba_nextkey
-dba_open
-dba_optimize
-dba_popen
-dba_replace
-dba_sync
-dbase_add_record
-dbase_close
-dbase_create
-dbase_delete_record
-dbase_get_header_info
-dbase_get_record
-dbase_get_record_with_names
-dbase_numfields
-dbase_numrecords
-dbase_open
-dbase_pack
-dbase_replace_record
-dbplus_add
-dbplus_aql
-dbplus_chdir
-dbplus_close
-dbplus_curr
-dbplus_errcode
-dbplus_errno
-dbplus_find
-dbplus_first
-dbplus_flush
-dbplus_freealllocks
-dbplus_freelock
-dbplus_freerlocks
-dbplus_getlock
-dbplus_getunique
-dbplus_info
-dbplus_last
-dbplus_lockrel
-dbplus_next
-dbplus_open
-dbplus_prev
-dbplus_rchperm
-dbplus_rcreate
-dbplus_rcrtexact
-dbplus_rcrtlike
-dbplus_resolve
-dbplus_restorepos
-dbplus_rkeys
-dbplus_ropen
-dbplus_rquery
-dbplus_rrename
-dbplus_rsecindex
-dbplus_runlink
-dbplus_rzap
-dbplus_savepos
-dbplus_setindex
-dbplus_setindexbynumber
-dbplus_sql
-dbplus_tcl
-dbplus_tremove
-dbplus_undo
-dbplus_undoprepare
-dbplus_unlockrel
-dbplus_unselect
-dbplus_update
-dbplus_xlockrel
-dbplus_xunlockrel
-dbx_close
-dbx_compare
-dbx_connect
-dbx_error
-dbx_escape_string
-dbx_fetch_row
-dbx_query
-dbx_sort
-dcgettext
-dcngettext
-deaggregate
-debug_backtrace
-debug_print_backtrace
-debug_zval_dump
-decbin
-dechex
-decoct
-define
-define_syslog_variables
-defined
-deg2rad
-delete
-dgettext
-die
-dio_close
-dio_fcntl
-dio_open
-dio_read
-dio_seek
-dio_stat
-dio_tcsetattr
-dio_truncate
-dio_write
-dirname
-disk_free_space
-disk_total_space
-diskfreespace
-dl
-dngettext
-dns_check_record
-dns_get_mx
-dns_get_record
-dom_import_simplexml
-domattribute_name
-domattribute_set_value
-domattribute_specified
-domattribute_value
-domdocument_add_root
-domdocument_create_attribute
-domdocument_create_cdata_section
-domdocument_create_comment
-domdocument_create_element
-domdocument_create_element_ns
-domdocument_create_entity_reference
-domdocument_create_processing_instruction
-domdocument_create_text_node
-domdocument_doctype
-domdocument_document_element
-domdocument_dump_file
-domdocument_dump_mem
-domdocument_get_element_by_id
-domdocument_get_elements_by_tagname
-domdocument_html_dump_mem
-domdocument_xinclude
-domdocumenttype_entities
-domdocumenttype_internal_subset
-domdocumenttype_name
-domdocumenttype_notations
-domdocumenttype_public_id
-domdocumenttype_system_id
-domelement_get_attribute
-domelement_get_attribute_node
-domelement_get_elements_by_tagname
-domelement_has_attribute
-domelement_remove_attribute
-domelement_set_attribute
-domelement_set_attribute_node
-domelement_tagname
-domnode_add_namespace
-domnode_append_child
-domnode_append_sibling
-domnode_attributes
-domnode_child_nodes
-domnode_clone_node
-domnode_dump_node
-domnode_first_child
-domnode_get_content
-domnode_has_attributes
-domnode_has_child_nodes
-domnode_insert_before
-domnode_is_blank_node
-domnode_last_child
-domnode_next_sibling
-domnode_node_name
-domnode_node_type
-domnode_node_value
-domnode_owner_document
-domnode_parent_node
-domnode_prefix
-domnode_previous_sibling
-domnode_remove_child
-domnode_replace_child
-domnode_replace_node
-domnode_set_content
-domnode_set_name
-domnode_set_namespace
-domnode_unlink_node
-domprocessinginstruction_data
-domprocessinginstruction_target
-domxml_new_doc
-domxml_open_file
-domxml_open_mem
-domxml_version
-domxml_xmltree
-domxml_xslt_stylesheet
-domxml_xslt_stylesheet_doc
-domxml_xslt_stylesheet_file
-domxml_xslt_version
-domxsltstylesheet_process
-domxsltstylesheet_result_dump_file
-domxsltstylesheet_result_dump_mem
-dotnet_load
-doubleval
-each
-easter_date
-easter_days
-ebcdic2ascii
-echo
-empty
-enchant_broker_describe
-enchant_broker_dict_exists
-enchant_broker_free
-enchant_broker_free_dict
-enchant_broker_get_error
-enchant_broker_init
-enchant_broker_list_dicts
-enchant_broker_request_dict
-enchant_broker_request_pwl_dict
-enchant_broker_set_ordering
-enchant_dict_add_to_personal
-enchant_dict_add_to_session
-enchant_dict_check
-enchant_dict_describe
-enchant_dict_get_error
-enchant_dict_is_in_session
-enchant_dict_quick_check
-enchant_dict_store_replacement
-enchant_dict_suggest
-end
-ereg
-ereg_replace
-eregi
-eregi_replace
-error_get_last
-error_log
-error_reporting
-escapeshellarg
-escapeshellcmd
-eval
-exec
-exif_imagetype
-exif_read_data
-exif_tagname
-exif_thumbnail
-exit
-exp
-expect_expectl
-expect_popen
-explode
-expm1
-extension_loaded
-extract
-ezmlm_hash
-fam_cancel_monitor
-fam_close
-fam_monitor_collection
-fam_monitor_directory
-fam_monitor_file
-fam_next_event
-fam_open
-fam_pending
-fam_resume_monitor
-fam_suspend_monitor
-fbsql_affected_rows
-fbsql_autocommit
-fbsql_blob_size
-fbsql_change_user
-fbsql_clob_size
-fbsql_close
-fbsql_commit
-fbsql_connect
-fbsql_create_blob
-fbsql_create_clob
-fbsql_create_db
-fbsql_data_seek
-fbsql_database
-fbsql_database_password
-fbsql_db_query
-fbsql_db_status
-fbsql_drop_db
-fbsql_errno
-fbsql_error
-fbsql_fetch_array
-fbsql_fetch_assoc
-fbsql_fetch_field
-fbsql_fetch_lengths
-fbsql_fetch_object
-fbsql_fetch_row
-fbsql_field_flags
-fbsql_field_len
-fbsql_field_name
-fbsql_field_seek
-fbsql_field_table
-fbsql_field_type
-fbsql_free_result
-fbsql_get_autostart_info
-fbsql_hostname
-fbsql_insert_id
-fbsql_list_dbs
-fbsql_list_fields
-fbsql_list_tables
-fbsql_next_result
-fbsql_num_fields
-fbsql_num_rows
-fbsql_password
-fbsql_pconnect
-fbsql_query
-fbsql_read_blob
-fbsql_read_clob
-fbsql_result
-fbsql_rollback
-fbsql_rows_fetched
-fbsql_select_db
-fbsql_set_characterset
-fbsql_set_lob_mode
-fbsql_set_password
-fbsql_set_transaction
-fbsql_start_db
-fbsql_stop_db
-fbsql_table_name
-fbsql_tablename
-fbsql_username
-fbsql_warnings
-fclose
-fdf_add_doc_javascript
-fdf_add_template
-fdf_close
-fdf_create
-fdf_enum_values
-fdf_errno
-fdf_error
-fdf_get_ap
-fdf_get_attachment
-fdf_get_encoding
-fdf_get_file
-fdf_get_flags
-fdf_get_opt
-fdf_get_status
-fdf_get_value
-fdf_get_version
-fdf_header
-fdf_next_field_name
-fdf_open
-fdf_open_string
-fdf_remove_item
-fdf_save
-fdf_save_string
-fdf_set_ap
-fdf_set_encoding
-fdf_set_file
-fdf_set_flags
-fdf_set_javascript_action
-fdf_set_on_import_javascript
-fdf_set_opt
-fdf_set_status
-fdf_set_submit_form_action
-fdf_set_target_frame
-fdf_set_value
-fdf_set_version
-feof
-fflush
-fgetc
-fgetcsv
-fgets
-fgetss
-file
-file_exists
-file_get_contents
-file_put_contents
-fileatime
-filectime
-filegroup
-fileinode
-filemtime
-fileowner
-fileperms
-filepro
-filepro_fieldcount
-filepro_fieldname
-filepro_fieldtype
-filepro_fieldwidth
-filepro_retrieve
-filepro_rowcount
-filesize
-filetype
-filter_has_var
-filter_id
-filter_input
-filter_input_array
-filter_list
-filter_var
-filter_var_array
-finfo_buffer
-finfo_close
-finfo_file
-finfo_open
-finfo_set_flags
-floatval
-flock
-floor
-flush
-fmod
-fnmatch
-fopen
-fpassthru
-fprintf
-fputcsv
-fputs
-fread
-frenchtojd
-fribidi_log2vis
-fscanf
-fseek
-fsockopen
-fstat
-ftell
-ftok
-ftp_alloc
-ftp_cdup
-ftp_chdir
-ftp_chmod
-ftp_close
-ftp_connect
-ftp_delete
-ftp_exec
-ftp_fget
-ftp_fput
-ftp_get
-ftp_get_option
-ftp_login
-ftp_mdtm
-ftp_mkdir
-ftp_nb_continue
-ftp_nb_fget
-ftp_nb_fput
-ftp_nb_get
-ftp_nb_put
-ftp_nlist
-ftp_pasv
-ftp_put
-ftp_pwd
-ftp_quit
-ftp_raw
-ftp_rawlist
-ftp_rename
-ftp_rmdir
-ftp_set_option
-ftp_site
-ftp_size
-ftp_ssl_connect
-ftp_systype
-ftruncate
-func_get_arg
-func_get_args
-func_num_args
-function_exists
-fwrite
-gc_collect_cycles
-gc_disable
-gc_enable
-gc_enabled
-gd_info
-geoip_continent_code_by_name
-geoip_country_code_by_name
-geoip_country_code3_by_name
-geoip_country_name_by_name
-geoip_database_info
-geoip_db_avail
-geoip_db_filename
-geoip_db_get_all_info
-geoip_id_by_name
-geoip_isp_by_name
-geoip_org_by_name
-geoip_record_by_name
-geoip_region_by_name
-geoip_region_name_by_code
-geoip_time_zone_by_country_and_region
-get_browser
-get_called_class
-get_cfg_var
-get_class
-get_class_methods
-get_class_vars
-get_current_user
-get_declared_classes
-get_declared_interfaces
-get_defined_constants
-get_defined_functions
-get_defined_vars
-get_extension_funcs
-get_headers
-get_html_translation_table
-get_include_path
-get_included_files
-get_loaded_extensions
-get_magic_quotes_gpc
-get_magic_quotes_runtime
-get_meta_tags
-get_object_vars
-get_parent_class
-get_required_files
-get_resource_type
-getallheaders
-getcwd
-getdate
-getenv
-gethostbyaddr
-gethostbyname
-gethostbynamel
-getimagesize
-getlastmod
-getmxrr
-getmygid
-getmyinode
-getmypid
-getmyuid
-getopt
-getprotobyname
-getprotobynumber
-getrandmax
-getrusage
-getservbyname
-getservbyport
-gettext
-gettimeofday
-gettype
-glob
-gmdate
-gmmktime
-gmp_abs
-gmp_add
-gmp_and
-gmp_clrbit
-gmp_cmp
-gmp_com
-gmp_div
-gmp_div_q
-gmp_div_qr
-gmp_div_r
-gmp_divexact
-gmp_fact
-gmp_gcd
-gmp_gcdext
-gmp_hamdist
-gmp_init
-gmp_intval
-gmp_invert
-gmp_jacobi
-gmp_legendre
-gmp_mod
-gmp_mul
-gmp_neg
-gmp_nextprime
-gmp_or
-gmp_perfect_square
-gmp_popcount
-gmp_pow
-gmp_powm
-gmp_prob_prime
-gmp_random
-gmp_scan0
-gmp_scan1
-gmp_setbit
-gmp_sign
-gmp_sqrt
-gmp_sqrtrem
-gmp_strval
-gmp_sub
-gmp_testbit
-gmp_xor
-gmstrftime
-gnupg_adddecryptkey
-gnupg_addencryptkey
-gnupg_addsignkey
-gnupg_cleardecryptkeys
-gnupg_clearencryptkeys
-gnupg_clearsignkeys
-gnupg_decrypt
-gnupg_decryptverify
-gnupg_encrypt
-gnupg_encryptsign
-gnupg_export
-gnupg_geterror
-gnupg_getprotocol
-gnupg_import
-gnupg_init
-gnupg_keyinfo
-gnupg_setarmor
-gnupg_seterrormode
-gnupg_setsignmode
-gnupg_sign
-gnupg_verify
-gopher_parsedir
-grapheme_extract
-grapheme_stripos
-grapheme_stristr
-grapheme_strlen
-grapheme_strpos
-grapheme_strripos
-grapheme_strrpos
-grapheme_strstr
-grapheme_substr
-gregoriantojd
-gzclose
-gzcompress
-gzdecode
-gzdeflate
-gzencode
-gzeof
-gzfile
-gzgetc
-gzgets
-gzgetss
-gzinflate
-gzopen
-gzpassthru
-gzputs
-gzread
-gzrewind
-gzseek
-gztell
-gzuncompress
-gzwrite
-halt_compiler
-haruannotation_setborderstyle
-haruannotation_sethighlightmode
-haruannotation_seticon
-haruannotation_setopened
-harudestination_setfit
-harudestination_setfitb
-harudestination_setfitbh
-harudestination_setfitbv
-harudestination_setfith
-harudestination_setfitr
-harudestination_setfitv
-harudestination_setxyz
-harudoc_addpage
-harudoc_addpagelabel
-harudoc_construct
-harudoc_createoutline
-harudoc_getcurrentencoder
-harudoc_getcurrentpage
-harudoc_getencoder
-harudoc_getfont
-harudoc_getinfoattr
-harudoc_getpagelayout
-harudoc_getpagemode
-harudoc_getstreamsize
-harudoc_insertpage
-harudoc_loadjpeg
-harudoc_loadpng
-harudoc_loadraw
-harudoc_loadttc
-harudoc_loadttf
-harudoc_loadtype1
-harudoc_output
-harudoc_readfromstream
-harudoc_reseterror
-harudoc_resetstream
-harudoc_save
-harudoc_savetostream
-harudoc_setcompressionmode
-harudoc_setcurrentencoder
-harudoc_setencryptionmode
-harudoc_setinfoattr
-harudoc_setinfodateattr
-harudoc_setopenaction
-harudoc_setpagelayout
-harudoc_setpagemode
-harudoc_setpagesconfiguration
-harudoc_setpassword
-harudoc_setpermission
-harudoc_usecnsencodings
-harudoc_usecnsfonts
-harudoc_usecntencodings
-harudoc_usecntfonts
-harudoc_usejpencodings
-harudoc_usejpfonts
-harudoc_usekrencodings
-harudoc_usekrfonts
-haruencoder_getbytetype
-haruencoder_gettype
-haruencoder_getunicode
-haruencoder_getwritingmode
-harufont_getascent
-harufont_getcapheight
-harufont_getdescent
-harufont_getencodingname
-harufont_getfontname
-harufont_gettextwidth
-harufont_getunicodewidth
-harufont_getxheight
-harufont_measuretext
-haruimage_getbitspercomponent
-haruimage_getcolorspace
-haruimage_getheight
-haruimage_getsize
-haruimage_getwidth
-haruimage_setcolormask
-haruimage_setmaskimage
-haruoutline_setdestination
-haruoutline_setopened
-harupage_arc
-harupage_begintext
-harupage_circle
-harupage_closepath
-harupage_concat
-harupage_createdestination
-harupage_createlinkannotation
-harupage_createtextannotation
-harupage_createurlannotation
-harupage_curveto
-harupage_curveto2
-harupage_curveto3
-harupage_drawimage
-harupage_ellipse
-harupage_endpath
-harupage_endtext
-harupage_eofill
-harupage_eofillstroke
-harupage_fill
-harupage_fillstroke
-harupage_getcharspace
-harupage_getcmykfill
-harupage_getcmykstroke
-harupage_getcurrentfont
-harupage_getcurrentfontsize
-harupage_getcurrentpos
-harupage_getcurrenttextpos
-harupage_getdash
-harupage_getfillingcolorspace
-harupage_getflatness
-harupage_getgmode
-harupage_getgrayfill
-harupage_getgraystroke
-harupage_getheight
-harupage_gethorizontalscaling
-harupage_getlinecap
-harupage_getlinejoin
-harupage_getlinewidth
-harupage_getmiterlimit
-harupage_getrgbfill
-harupage_getrgbstroke
-harupage_getstrokingcolorspace
-harupage_gettextleading
-harupage_gettextmatrix
-harupage_gettextrenderingmode
-harupage_gettextrise
-harupage_gettextwidth
-harupage_gettransmatrix
-harupage_getwidth
-harupage_getwordspace
-harupage_lineto
-harupage_measuretext
-harupage_movetextpos
-harupage_moveto
-harupage_movetonextline
-harupage_rectangle
-harupage_setcharspace
-harupage_setcmykfill
-harupage_setcmykstroke
-harupage_setdash
-harupage_setflatness
-harupage_setfontandsize
-harupage_setgrayfill
-harupage_setgraystroke
-harupage_setheight
-harupage_sethorizontalscaling
-harupage_setlinecap
-harupage_setlinejoin
-harupage_setlinewidth
-harupage_setmiterlimit
-harupage_setrgbfill
-harupage_setrgbstroke
-harupage_setrotate
-harupage_setsize
-harupage_setslideshow
-harupage_settextleading
-harupage_settextmatrix
-harupage_settextrenderingmode
-harupage_settextrise
-harupage_setwidth
-harupage_setwordspace
-harupage_showtext
-harupage_showtextnextline
-harupage_stroke
-harupage_textout
-harupage_textrect
-hash
-hash_algos
-hash_copy
-hash_file
-hash_final
-hash_hmac
-hash_hmac_file
-hash_init
-hash_update
-hash_update_file
-hash_update_stream
-header
-headers_list
-headers_sent
-hebrev
-hebrevc
-hexdec
-highlight_file
-highlight_string
-html_entity_decode
-htmlentities
-htmlspecialchars
-htmlspecialchars_decode
-http_build_cookie
-http_build_query
-http_build_str
-http_build_url
-http_cache_etag
-http_cache_last_modified
-http_chunked_decode
-http_date
-http_deflate
-http_get
-http_get_request_body
-http_get_request_body_stream
-http_get_request_headers
-http_head
-http_inflate
-http_match_etag
-http_match_modified
-http_match_request_header
-http_negotiate_charset
-http_negotiate_content_type
-http_negotiate_language
-http_parse_cookie
-http_parse_headers
-http_parse_message
-http_parse_params
-http_persistent_handles_clean
-http_persistent_handles_count
-http_persistent_handles_ident
-http_post_data
-http_post_fields
-http_put_data
-http_put_file
-http_put_stream
-http_redirect
-http_request
-http_request_body_encode
-http_request_method_exists
-http_request_method_name
-http_request_method_register
-http_request_method_unregister
-http_send_content_disposition
-http_send_content_type
-http_send_data
-http_send_file
-http_send_last_modified
-http_send_status
-http_send_stream
-http_support
-http_throttle
-httpdeflatestream_construct
-httpdeflatestream_factory
-httpdeflatestream_finish
-httpdeflatestream_flush
-httpdeflatestream_update
-httpinflatestream_construct
-httpinflatestream_factory
-httpinflatestream_finish
-httpinflatestream_flush
-httpinflatestream_update
-httpmessage_addheaders
-httpmessage_construct
-httpmessage_detach
-httpmessage_factory
-httpmessage_fromenv
-httpmessage_fromstring
-httpmessage_getbody
-httpmessage_getheader
-httpmessage_getheaders
-httpmessage_gethttpversion
-httpmessage_getparentmessage
-httpmessage_getrequestmethod
-httpmessage_getrequesturl
-httpmessage_getresponsecode
-httpmessage_getresponsestatus
-httpmessage_gettype
-httpmessage_guesscontenttype
-httpmessage_prepend
-httpmessage_reverse
-httpmessage_send
-httpmessage_setbody
-httpmessage_setheaders
-httpmessage_sethttpversion
-httpmessage_setrequestmethod
-httpmessage_setrequesturl
-httpmessage_setresponsecode
-httpmessage_setresponsestatus
-httpmessage_settype
-httpmessage_tomessagetypeobject
-httpmessage_tostring
-httpquerystring_construct
-httpquerystring_get
-httpquerystring_mod
-httpquerystring_set
-httpquerystring_singleton
-httpquerystring_toarray
-httpquerystring_tostring
-httpquerystring_xlate
-httprequest_addcookies
-httprequest_addheaders
-httprequest_addpostfields
-httprequest_addpostfile
-httprequest_addputdata
-httprequest_addquerydata
-httprequest_addrawpostdata
-httprequest_addssloptions
-httprequest_clearhistory
-httprequest_construct
-httprequest_enablecookies
-httprequest_getcontenttype
-httprequest_getcookies
-httprequest_getheaders
-httprequest_gethistory
-httprequest_getmethod
-httprequest_getoptions
-httprequest_getpostfields
-httprequest_getpostfiles
-httprequest_getputdata
-httprequest_getputfile
-httprequest_getquerydata
-httprequest_getrawpostdata
-httprequest_getrawrequestmessage
-httprequest_getrawresponsemessage
-httprequest_getrequestmessage
-httprequest_getresponsebody
-httprequest_getresponsecode
-httprequest_getresponsecookies
-httprequest_getresponsedata
-httprequest_getresponseheader
-httprequest_getresponseinfo
-httprequest_getresponsemessage
-httprequest_getresponsestatus
-httprequest_getssloptions
-httprequest_geturl
-httprequest_resetcookies
-httprequest_send
-httprequest_setcontenttype
-httprequest_setcookies
-httprequest_setheaders
-httprequest_setmethod
-httprequest_setoptions
-httprequest_setpostfields
-httprequest_setpostfiles
-httprequest_setputdata
-httprequest_setputfile
-httprequest_setquerydata
-httprequest_setrawpostdata
-httprequest_setssloptions
-httprequest_seturl
-httprequestpool_attach
-httprequestpool_construct
-httprequestpool_destruct
-httprequestpool_detach
-httprequestpool_getattachedrequests
-httprequestpool_getfinishedrequests
-httprequestpool_reset
-httprequestpool_send
-httprequestpool_socketperform
-httprequestpool_socketselect
-httpresponse_capture
-httpresponse_getbuffersize
-httpresponse_getcache
-httpresponse_getcachecontrol
-httpresponse_getcontentdisposition
-httpresponse_getcontenttype
-httpresponse_getdata
-httpresponse_getetag
-httpresponse_getfile
-httpresponse_getgzip
-httpresponse_getheader
-httpresponse_getlastmodified
-httpresponse_getrequestbody
-httpresponse_getrequestbodystream
-httpresponse_getrequestheaders
-httpresponse_getstream
-httpresponse_getthrottledelay
-httpresponse_guesscontenttype
-httpresponse_redirect
-httpresponse_send
-httpresponse_setbuffersize
-httpresponse_setcache
-httpresponse_setcachecontrol
-httpresponse_setcontentdisposition
-httpresponse_setcontenttype
-httpresponse_setdata
-httpresponse_setetag
-httpresponse_setfile
-httpresponse_setgzip
-httpresponse_setheader
-httpresponse_setlastmodified
-httpresponse_setstream
-httpresponse_setthrottledelay
-httpresponse_status
-hw_array2objrec
-hw_changeobject
-hw_children
-hw_childrenobj
-hw_close
-hw_connect
-hw_connection_info
-hw_cp
-hw_deleteobject
-hw_docbyanchor
-hw_docbyanchorobj
-hw_document_attributes
-hw_document_bodytag
-hw_document_content
-hw_document_setcontent
-hw_document_size
-hw_dummy
-hw_edittext
-hw_error
-hw_errormsg
-hw_free_document
-hw_getanchors
-hw_getanchorsobj
-hw_getandlock
-hw_getchildcoll
-hw_getchildcollobj
-hw_getchilddoccoll
-hw_getchilddoccollobj
-hw_getobject
-hw_getobjectbyquery
-hw_getobjectbyquerycoll
-hw_getobjectbyquerycollobj
-hw_getobjectbyqueryobj
-hw_getparents
-hw_getparentsobj
-hw_getrellink
-hw_getremote
-hw_getremotechildren
-hw_getsrcbydestobj
-hw_gettext
-hw_getusername
-hw_identify
-hw_incollections
-hw_info
-hw_inscoll
-hw_insdoc
-hw_insertanchors
-hw_insertdocument
-hw_insertobject
-hw_mapid
-hw_modifyobject
-hw_mv
-hw_new_document
-hw_objrec2array
-hw_output_document
-hw_pconnect
-hw_pipedocument
-hw_root
-hw_setlinkroot
-hw_stat
-hw_unlock
-hw_who
-hwapi_attribute
-hwapi_attribute_key
-hwapi_attribute_langdepvalue
-hwapi_attribute_value
-hwapi_attribute_values
-hwapi_checkin
-hwapi_checkout
-hwapi_children
-hwapi_content
-hwapi_content_mimetype
-hwapi_content_read
-hwapi_copy
-hwapi_dbstat
-hwapi_dcstat
-hwapi_dstanchors
-hwapi_dstofsrcanchor
-hwapi_error_count
-hwapi_error_reason
-hwapi_find
-hwapi_ftstat
-hwapi_hgcsp
-hwapi_hwstat
-hwapi_identify
-hwapi_info
-hwapi_insert
-hwapi_insertanchor
-hwapi_insertcollection
-hwapi_insertdocument
-hwapi_link
-hwapi_lock
-hwapi_move
-hwapi_new_content
-hwapi_object
-hwapi_object_assign
-hwapi_object_attreditable
-hwapi_object_count
-hwapi_object_insert
-hwapi_object_new
-hwapi_object_remove
-hwapi_object_title
-hwapi_object_value
-hwapi_objectbyanchor
-hwapi_parents
-hwapi_reason_description
-hwapi_reason_type
-hwapi_remove
-hwapi_replace
-hwapi_setcommittedversion
-hwapi_srcanchors
-hwapi_srcsofdst
-hwapi_unlock
-hwapi_user
-hwapi_userlist
-hypot
-ibase_add_user
-ibase_affected_rows
-ibase_backup
-ibase_blob_add
-ibase_blob_cancel
-ibase_blob_close
-ibase_blob_create
-ibase_blob_echo
-ibase_blob_get
-ibase_blob_import
-ibase_blob_info
-ibase_blob_open
-ibase_close
-ibase_commit
-ibase_commit_ret
-ibase_connect
-ibase_db_info
-ibase_delete_user
-ibase_drop_db
-ibase_errcode
-ibase_errmsg
-ibase_execute
-ibase_fetch_assoc
-ibase_fetch_object
-ibase_fetch_row
-ibase_field_info
-ibase_free_event_handler
-ibase_free_query
-ibase_free_result
-ibase_gen_id
-ibase_maintain_db
-ibase_modify_user
-ibase_name_result
-ibase_num_fields
-ibase_num_params
-ibase_param_info
-ibase_pconnect
-ibase_prepare
-ibase_query
-ibase_restore
-ibase_rollback
-ibase_rollback_ret
-ibase_server_info
-ibase_service_attach
-ibase_service_detach
-ibase_set_event_handler
-ibase_timefmt
-ibase_trans
-ibase_wait_event
-iconv
-iconv_get_encoding
-iconv_mime_decode
-iconv_mime_decode_headers
-iconv_mime_encode
-iconv_set_encoding
-iconv_strlen
-iconv_strpos
-iconv_strrpos
-iconv_substr
-id3_get_frame_long_name
-id3_get_frame_short_name
-id3_get_genre_id
-id3_get_genre_list
-id3_get_genre_name
-id3_get_tag
-id3_get_version
-id3_remove_tag
-id3_set_tag
-idate
-idn_strerror
-idn_to_ascii
-idn_to_utf8
-ifx_affected_rows
-ifx_blobinfile_mode
-ifx_byteasvarchar
-ifx_close
-ifx_connect
-ifx_copy_blob
-ifx_create_blob
-ifx_create_char
-ifx_do
-ifx_error
-ifx_errormsg
-ifx_fetch_row
-ifx_fieldproperties
-ifx_fieldtypes
-ifx_free_blob
-ifx_free_char
-ifx_free_result
-ifx_get_blob
-ifx_get_char
-ifx_getsqlca
-ifx_htmltbl_result
-ifx_nullformat
-ifx_num_fields
-ifx_num_rows
-ifx_pconnect
-ifx_prepare
-ifx_query
-ifx_textasvarchar
-ifx_update_blob
-ifx_update_char
-ifxus_close_slob
-ifxus_create_slob
-ifxus_free_slob
-ifxus_open_slob
-ifxus_read_slob
-ifxus_seek_slob
-ifxus_tell_slob
-ifxus_write_slob
-ignore_user_abort
-iis_add_server
-iis_get_dir_security
-iis_get_script_map
-iis_get_server_by_comment
-iis_get_server_by_path
-iis_get_server_rights
-iis_get_service_state
-iis_remove_server
-iis_set_app_settings
-iis_set_dir_security
-iis_set_script_map
-iis_set_server_rights
-iis_start_server
-iis_start_service
-iis_stop_server
-iis_stop_service
-image_type_to_extension
-image_type_to_mime_type
-image2wbmp
-imagealphablending
-imageantialias
-imagearc
-imagechar
-imagecharup
-imagecolorallocate
-imagecolorallocatealpha
-imagecolorat
-imagecolorclosest
-imagecolorclosestalpha
-imagecolorclosesthwb
-imagecolordeallocate
-imagecolorexact
-imagecolorexactalpha
-imagecolormatch
-imagecolorresolve
-imagecolorresolvealpha
-imagecolorset
-imagecolorsforindex
-imagecolorstotal
-imagecolortransparent
-imageconvolution
-imagecopy
-imagecopymerge
-imagecopymergegray
-imagecopyresampled
-imagecopyresized
-imagecreate
-imagecreatefromgd
-imagecreatefromgd2
-imagecreatefromgd2part
-imagecreatefromgif
-imagecreatefromjpeg
-imagecreatefrompng
-imagecreatefromstring
-imagecreatefromwbmp
-imagecreatefromxbm
-imagecreatefromxpm
-imagecreatetruecolor
-imagedashedline
-imagedestroy
-imageellipse
-imagefill
-imagefilledarc
-imagefilledellipse
-imagefilledpolygon
-imagefilledrectangle
-imagefilltoborder
-imagefilter
-imagefontheight
-imagefontwidth
-imageftbbox
-imagefttext
-imagegammacorrect
-imagegd
-imagegd2
-imagegif
-imagegrabscreen
-imagegrabwindow
-imageinterlace
-imageistruecolor
-imagejpeg
-imagelayereffect
-imageline
-imageloadfont
-imagepalettecopy
-imagepng
-imagepolygon
-imagepsbbox
-imagepsencodefont
-imagepsextendfont
-imagepsfreefont
-imagepsloadfont
-imagepsslantfont
-imagepstext
-imagerectangle
-imagerotate
-imagesavealpha
-imagesetbrush
-imagesetpixel
-imagesetstyle
-imagesetthickness
-imagesettile
-imagestring
-imagestringup
-imagesx
-imagesy
-imagetruecolortopalette
-imagettfbbox
-imagettftext
-imagetypes
-imagewbmp
-imagexbm
-imagick_adaptiveblurimage
-imagick_adaptiveresizeimage
-imagick_adaptivesharpenimage
-imagick_adaptivethresholdimage
-imagick_addimage
-imagick_addnoiseimage
-imagick_affinetransformimage
-imagick_annotateimage
-imagick_appendimages
-imagick_averageimages
-imagick_blackthresholdimage
-imagick_blurimage
-imagick_borderimage
-imagick_charcoalimage
-imagick_chopimage
-imagick_clear
-imagick_clipimage
-imagick_clippathimage
-imagick_clone
-imagick_clutimage
-imagick_coalesceimages
-imagick_colorfloodfillimage
-imagick_colorizeimage
-imagick_combineimages
-imagick_commentimage
-imagick_compareimagechannels
-imagick_compareimagelayers
-imagick_compareimages
-imagick_compositeimage
-imagick_construct
-imagick_contrastimage
-imagick_contraststretchimage
-imagick_convolveimage
-imagick_cropimage
-imagick_cropthumbnailimage
-imagick_current
-imagick_cyclecolormapimage
-imagick_deconstructimages
-imagick_despeckleimage
-imagick_destroy
-imagick_displayimage
-imagick_displayimages
-imagick_distortimage
-imagick_drawimage
-imagick_edgeimage
-imagick_embossimage
-imagick_enhanceimage
-imagick_equalizeimage
-imagick_evaluateimage
-imagick_flattenimages
-imagick_flipimage
-imagick_flopimage
-imagick_frameimage
-imagick_fximage
-imagick_gammaimage
-imagick_gaussianblurimage
-imagick_getcompression
-imagick_getcompressionquality
-imagick_getcopyright
-imagick_getfilename
-imagick_getformat
-imagick_gethomeurl
-imagick_getimage
-imagick_getimagebackgroundcolor
-imagick_getimageblob
-imagick_getimageblueprimary
-imagick_getimagebordercolor
-imagick_getimagechanneldepth
-imagick_getimagechanneldistortion
-imagick_getimagechannelextrema
-imagick_getimagechannelmean
-imagick_getimagechannelstatistics
-imagick_getimagecolormapcolor
-imagick_getimagecolors
-imagick_getimagecolorspace
-imagick_getimagecompose
-imagick_getimagedelay
-imagick_getimagedepth
-imagick_getimagedispose
-imagick_getimagedistortion
-imagick_getimageextrema
-imagick_getimagefilename
-imagick_getimageformat
-imagick_getimagegamma
-imagick_getimagegeometry
-imagick_getimagegreenprimary
-imagick_getimageheight
-imagick_getimagehistogram
-imagick_getimageindex
-imagick_getimageinterlacescheme
-imagick_getimageinterpolatemethod
-imagick_getimageiterations
-imagick_getimagelength
-imagick_getimagemagicklicense
-imagick_getimagematte
-imagick_getimagemattecolor
-imagick_getimageorientation
-imagick_getimagepage
-imagick_getimagepixelcolor
-imagick_getimageprofile
-imagick_getimageprofiles
-imagick_getimageproperties
-imagick_getimageproperty
-imagick_getimageredprimary
-imagick_getimageregion
-imagick_getimagerenderingintent
-imagick_getimageresolution
-imagick_getimagesblob
-imagick_getimagescene
-imagick_getimagesignature
-imagick_getimagesize
-imagick_getimagetickspersecond
-imagick_getimagetotalinkdensity
-imagick_getimagetype
-imagick_getimageunits
-imagick_getimagevirtualpixelmethod
-imagick_getimagewhitepoint
-imagick_getimagewidth
-imagick_getinterlacescheme
-imagick_getiteratorindex
-imagick_getnumberimages
-imagick_getoption
-imagick_getpackagename
-imagick_getpage
-imagick_getpixeliterator
-imagick_getpixelregioniterator
-imagick_getquantumdepth
-imagick_getquantumrange
-imagick_getreleasedate
-imagick_getresource
-imagick_getresourcelimit
-imagick_getsamplingfactors
-imagick_getsize
-imagick_getsizeoffset
-imagick_getversion
-imagick_hasnextimage
-imagick_haspreviousimage
-imagick_identifyimage
-imagick_implodeimage
-imagick_labelimage
-imagick_levelimage
-imagick_linearstretchimage
-imagick_magnifyimage
-imagick_mapimage
-imagick_mattefloodfillimage
-imagick_medianfilterimage
-imagick_minifyimage
-imagick_modulateimage
-imagick_montageimage
-imagick_morphimages
-imagick_mosaicimages
-imagick_motionblurimage
-imagick_negateimage
-imagick_newimage
-imagick_newpseudoimage
-imagick_nextimage
-imagick_normalizeimage
-imagick_oilpaintimage
-imagick_optimizeimagelayers
-imagick_orderedposterizeimage
-imagick_paintfloodfillimage
-imagick_paintopaqueimage
-imagick_painttransparentimage
-imagick_pingimage
-imagick_pingimageblob
-imagick_pingimagefile
-imagick_polaroidimage
-imagick_posterizeimage
-imagick_previewimages
-imagick_previousimage
-imagick_profileimage
-imagick_quantizeimage
-imagick_quantizeimages
-imagick_queryfontmetrics
-imagick_queryfonts
-imagick_queryformats
-imagick_radialblurimage
-imagick_raiseimage
-imagick_randomthresholdimage
-imagick_readimage
-imagick_readimageblob
-imagick_readimagefile
-imagick_reducenoiseimage
-imagick_removeimage
-imagick_removeimageprofile
-imagick_render
-imagick_resampleimage
-imagick_resizeimage
-imagick_rollimage
-imagick_rotateimage
-imagick_roundcorners
-imagick_sampleimage
-imagick_scaleimage
-imagick_separateimagechannel
-imagick_sepiatoneimage
-imagick_setbackgroundcolor
-imagick_setcompression
-imagick_setcompressionquality
-imagick_setfilename
-imagick_setfirstiterator
-imagick_setfont
-imagick_setformat
-imagick_setimage
-imagick_setimagebackgroundcolor
-imagick_setimagebias
-imagick_setimageblueprimary
-imagick_setimagebordercolor
-imagick_setimagechanneldepth
-imagick_setimagecolormapcolor
-imagick_setimagecolorspace
-imagick_setimagecompose
-imagick_setimagecompression
-imagick_setimagedelay
-imagick_setimagedepth
-imagick_setimagedispose
-imagick_setimageextent
-imagick_setimagefilename
-imagick_setimageformat
-imagick_setimagegamma
-imagick_setimagegreenprimary
-imagick_setimageindex
-imagick_setimageinterlacescheme
-imagick_setimageinterpolatemethod
-imagick_setimageiterations
-imagick_setimagematte
-imagick_setimagemattecolor
-imagick_setimageopacity
-imagick_setimageorientation
-imagick_setimagepage
-imagick_setimageprofile
-imagick_setimageproperty
-imagick_setimageredprimary
-imagick_setimagerenderingintent
-imagick_setimageresolution
-imagick_setimagescene
-imagick_setimagetickspersecond
-imagick_setimagetype
-imagick_setimageunits
-imagick_setimagevirtualpixelmethod
-imagick_setimagewhitepoint
-imagick_setinterlacescheme
-imagick_setiteratorindex
-imagick_setlastiterator
-imagick_setoption
-imagick_setpage
-imagick_setresolution
-imagick_setresourcelimit
-imagick_setsamplingfactors
-imagick_setsize
-imagick_setsizeoffset
-imagick_settype
-imagick_shadeimage
-imagick_shadowimage
-imagick_sharpenimage
-imagick_shaveimage
-imagick_shearimage
-imagick_sigmoidalcontrastimage
-imagick_sketchimage
-imagick_solarizeimage
-imagick_spliceimage
-imagick_spreadimage
-imagick_steganoimage
-imagick_stereoimage
-imagick_stripimage
-imagick_swirlimage
-imagick_textureimage
-imagick_thresholdimage
-imagick_thumbnailimage
-imagick_tintimage
-imagick_transformimage
-imagick_transposeimage
-imagick_transverseimage
-imagick_trimimage
-imagick_uniqueimagecolors
-imagick_unsharpmaskimage
-imagick_valid
-imagick_vignetteimage
-imagick_waveimage
-imagick_whitethresholdimage
-imagick_writeimage
-imagick_writeimages
-imagickdraw_affine
-imagickdraw_annotation
-imagickdraw_arc
-imagickdraw_bezier
-imagickdraw_circle
-imagickdraw_clear
-imagickdraw_clone
-imagickdraw_color
-imagickdraw_comment
-imagickdraw_composite
-imagickdraw_construct
-imagickdraw_destroy
-imagickdraw_ellipse
-imagickdraw_getclippath
-imagickdraw_getcliprule
-imagickdraw_getclipunits
-imagickdraw_getfillcolor
-imagickdraw_getfillopacity
-imagickdraw_getfillrule
-imagickdraw_getfont
-imagickdraw_getfontfamily
-imagickdraw_getfontsize
-imagickdraw_getfontstyle
-imagickdraw_getfontweight
-imagickdraw_getgravity
-imagickdraw_getstrokeantialias
-imagickdraw_getstrokecolor
-imagickdraw_getstrokedasharray
-imagickdraw_getstrokedashoffset
-imagickdraw_getstrokelinecap
-imagickdraw_getstrokelinejoin
-imagickdraw_getstrokemiterlimit
-imagickdraw_getstrokeopacity
-imagickdraw_getstrokewidth
-imagickdraw_gettextalignment
-imagickdraw_gettextantialias
-imagickdraw_gettextdecoration
-imagickdraw_gettextencoding
-imagickdraw_gettextundercolor
-imagickdraw_getvectorgraphics
-imagickdraw_line
-imagickdraw_matte
-imagickdraw_pathclose
-imagickdraw_pathcurvetoabsolute
-imagickdraw_pathcurvetoquadraticbezierabsolute
-imagickdraw_pathcurvetoquadraticbezierrelative
-imagickdraw_pathcurvetoquadraticbeziersmoothabsolute
-imagickdraw_pathcurvetoquadraticbeziersmoothrelative
-imagickdraw_pathcurvetorelative
-imagickdraw_pathcurvetosmoothabsolute
-imagickdraw_pathcurvetosmoothrelative
-imagickdraw_pathellipticarcabsolute
-imagickdraw_pathellipticarcrelative
-imagickdraw_pathfinish
-imagickdraw_pathlinetoabsolute
-imagickdraw_pathlinetohorizontalabsolute
-imagickdraw_pathlinetohorizontalrelative
-imagickdraw_pathlinetorelative
-imagickdraw_pathlinetoverticalabsolute
-imagickdraw_pathlinetoverticalrelative
-imagickdraw_pathmovetoabsolute
-imagickdraw_pathmovetorelative
-imagickdraw_pathstart
-imagickdraw_point
-imagickdraw_polygon
-imagickdraw_polyline
-imagickdraw_pop
-imagickdraw_popclippath
-imagickdraw_popdefs
-imagickdraw_poppattern
-imagickdraw_push
-imagickdraw_pushclippath
-imagickdraw_pushdefs
-imagickdraw_pushpattern
-imagickdraw_rectangle
-imagickdraw_render
-imagickdraw_rotate
-imagickdraw_roundrectangle
-imagickdraw_scale
-imagickdraw_setclippath
-imagickdraw_setcliprule
-imagickdraw_setclipunits
-imagickdraw_setfillalpha
-imagickdraw_setfillcolor
-imagickdraw_setfillopacity
-imagickdraw_setfillpatternurl
-imagickdraw_setfillrule
-imagickdraw_setfont
-imagickdraw_setfontfamily
-imagickdraw_setfontsize
-imagickdraw_setfontstretch
-imagickdraw_setfontstyle
-imagickdraw_setfontweight
-imagickdraw_setgravity
-imagickdraw_setstrokealpha
-imagickdraw_setstrokeantialias
-imagickdraw_setstrokecolor
-imagickdraw_setstrokedasharray
-imagickdraw_setstrokedashoffset
-imagickdraw_setstrokelinecap
-imagickdraw_setstrokelinejoin
-imagickdraw_setstrokemiterlimit
-imagickdraw_setstrokeopacity
-imagickdraw_setstrokepatternurl
-imagickdraw_setstrokewidth
-imagickdraw_settextalignment
-imagickdraw_settextantialias
-imagickdraw_settextdecoration
-imagickdraw_settextencoding
-imagickdraw_settextundercolor
-imagickdraw_setvectorgraphics
-imagickdraw_setviewbox
-imagickdraw_skewx
-imagickdraw_skewy
-imagickdraw_translate
-imagickpixel_clear
-imagickpixel_construct
-imagickpixel_destroy
-imagickpixel_getcolor
-imagickpixel_getcolorasstring
-imagickpixel_getcolorcount
-imagickpixel_getcolorvalue
-imagickpixel_gethsl
-imagickpixel_issimilar
-imagickpixel_setcolor
-imagickpixel_setcolorvalue
-imagickpixel_sethsl
-imagickpixeliterator_clear
-imagickpixeliterator_construct
-imagickpixeliterator_destroy
-imagickpixeliterator_getcurrentiteratorrow
-imagickpixeliterator_getiteratorrow
-imagickpixeliterator_getnextiteratorrow
-imagickpixeliterator_getpreviousiteratorrow
-imagickpixeliterator_newpixeliterator
-imagickpixeliterator_newpixelregioniterator
-imagickpixeliterator_resetiterator
-imagickpixeliterator_setiteratorfirstrow
-imagickpixeliterator_setiteratorlastrow
-imagickpixeliterator_setiteratorrow
-imagickpixeliterator_synciterator
-imap_8bit
-imap_alerts
-imap_append
-imap_base64
-imap_binary
-imap_body
-imap_bodystruct
-imap_check
-imap_clearflag_full
-imap_close
-imap_createmailbox
-imap_delete
-imap_deletemailbox
-imap_errors
-imap_expunge
-imap_fetch_overview
-imap_fetchbody
-imap_fetchheader
-imap_fetchstructure
-imap_get_quota
-imap_get_quotaroot
-imap_getacl
-imap_getmailboxes
-imap_getsubscribed
-imap_header
-imap_headerinfo
-imap_headers
-imap_last_error
-imap_list
-imap_listmailbox
-imap_listscan
-imap_listsubscribed
-imap_lsub
-imap_mail
-imap_mail_compose
-imap_mail_copy
-imap_mail_move
-imap_mailboxmsginfo
-imap_mime_header_decode
-imap_msgno
-imap_num_msg
-imap_num_recent
-imap_open
-imap_ping
-imap_qprint
-imap_renamemailbox
-imap_reopen
-imap_rfc822_parse_adrlist
-imap_rfc822_parse_headers
-imap_rfc822_write_address
-imap_savebody
-imap_scanmailbox
-imap_search
-imap_set_quota
-imap_setacl
-imap_setflag_full
-imap_sort
-imap_status
-imap_subscribe
-imap_thread
-imap_timeout
-imap_uid
-imap_undelete
-imap_unsubscribe
-imap_utf7_decode
-imap_utf7_encode
-imap_utf8
-implode
-import_request_variables
-in_array
-include
-include_once
-inclued_get_data
-inet_ntop
-inet_pton
-ingres_autocommit
-ingres_autocommit_state
-ingres_charset
-ingres_close
-ingres_commit
-ingres_connect
-ingres_cursor
-ingres_errno
-ingres_error
-ingres_errsqlstate
-ingres_escape_string
-ingres_execute
-ingres_fetch_array
-ingres_fetch_object
-ingres_fetch_proc_return
-ingres_fetch_row
-ingres_field_length
-ingres_field_name
-ingres_field_nullable
-ingres_field_precision
-ingres_field_scale
-ingres_field_type
-ingres_free_result
-ingres_next_error
-ingres_num_fields
-ingres_num_rows
-ingres_pconnect
-ingres_prepare
-ingres_query
-ingres_result_seek
-ingres_rollback
-ingres_set_environment
-ingres_unbuffered_query
-ini_alter
-ini_get
-ini_get_all
-ini_restore
-ini_set
-inotify_add_watch
-inotify_init
-inotify_queue_len
-inotify_read
-inotify_rm_watch
-interface_exists
-intl_error_name
-intl_get_error_code
-intl_get_error_message
-intl_is_failure
-intval
-ip2long
-iptcembed
-iptcparse
-is_a
-is_array
-is_binary
-is_bool
-is_buffer
-is_callable
-is_dir
-is_double
-is_executable
-is_file
-is_finite
-is_float
-is_infinite
-is_int
-is_integer
-is_link
-is_long
-is_nan
-is_null
-is_numeric
-is_object
-is_readable
-is_real
-is_resource
-is_scalar
-is_soap_fault
-is_string
-is_subclass_of
-is_unicode
-is_uploaded_file
-is_writable
-is_writeable
-isset
-iterator_apply
-iterator_count
-iterator_to_array
-java_last_exception_clear
-java_last_exception_get
-jddayofweek
-jdmonthname
-jdtofrench
-jdtogregorian
-jdtojewish
-jdtojulian
-jdtounix
-jewishtojd
-join
-jpeg2wbmp
-json_decode
-json_encode
-json_last_error
-juliantojd
-kadm5_chpass_principal
-kadm5_create_principal
-kadm5_delete_principal
-kadm5_destroy
-kadm5_flush
-kadm5_get_policies
-kadm5_get_principal
-kadm5_get_principals
-kadm5_init_with_password
-kadm5_modify_principal
-key
-krsort
-ksort
-lcfirst
-lcg_value
-lchgrp
-lchown
-ldap_8859_to_t61
-ldap_add
-ldap_bind
-ldap_close
-ldap_compare
-ldap_connect
-ldap_count_entries
-ldap_delete
-ldap_dn2ufn
-ldap_err2str
-ldap_errno
-ldap_error
-ldap_explode_dn
-ldap_first_attribute
-ldap_first_entry
-ldap_first_reference
-ldap_free_result
-ldap_get_attributes
-ldap_get_dn
-ldap_get_entries
-ldap_get_option
-ldap_get_values
-ldap_get_values_len
-ldap_list
-ldap_mod_add
-ldap_mod_del
-ldap_mod_replace
-ldap_modify
-ldap_next_attribute
-ldap_next_entry
-ldap_next_reference
-ldap_parse_reference
-ldap_parse_result
-ldap_read
-ldap_rename
-ldap_sasl_bind
-ldap_search
-ldap_set_option
-ldap_set_rebind_proc
-ldap_sort
-ldap_start_tls
-ldap_t61_to_8859
-ldap_unbind
-levenshtein
-libxml_clear_errors
-libxml_get_errors
-libxml_get_last_error
-libxml_set_streams_context
-libxml_use_internal_errors
-link
-linkinfo
-list
-locale_get_default
-locale_set_default
-localeconv
-localtime
-log
-log10
-log1p
-long2ip
-lstat
-ltrim
-lzf_compress
-lzf_decompress
-lzf_optimized_for
-m_checkstatus
-m_completeauthorizations
-m_connect
-m_connectionerror
-m_deletetrans
-m_destroyconn
-m_destroyengine
-m_getcell
-m_getcellbynum
-m_getcommadelimited
-m_getheader
-m_initconn
-m_initengine
-m_iscommadelimited
-m_maxconntimeout
-m_monitor
-m_numcolumns
-m_numrows
-m_parsecommadelimited
-m_responsekeys
-m_responseparam
-m_returnstatus
-m_setblocking
-m_setdropfile
-m_setip
-m_setssl
-m_setssl_cafile
-m_setssl_files
-m_settimeout
-m_sslcert_gen_hash
-m_transactionssent
-m_transinqueue
-m_transkeyval
-m_transnew
-m_transsend
-m_uwait
-m_validateidentifier
-m_verifyconnection
-m_verifysslcert
-mail
-mailparse_determine_best_xfer_encoding
-mailparse_msg_create
-mailparse_msg_extract_part
-mailparse_msg_extract_part_file
-mailparse_msg_extract_whole_part_file
-mailparse_msg_free
-mailparse_msg_get_part
-mailparse_msg_get_part_data
-mailparse_msg_get_structure
-mailparse_msg_parse
-mailparse_msg_parse_file
-mailparse_rfc822_parse_addresses
-mailparse_stream_encode
-mailparse_uudecode_all
-main
-max
-maxdb_affected_rows
-maxdb_autocommit
-maxdb_bind_param
-maxdb_bind_result
-maxdb_change_user
-maxdb_character_set_name
-maxdb_client_encoding
-maxdb_close
-maxdb_close_long_data
-maxdb_commit
-maxdb_connect
-maxdb_connect_errno
-maxdb_connect_error
-maxdb_data_seek
-maxdb_debug
-maxdb_disable_reads_from_master
-maxdb_disable_rpl_parse
-maxdb_dump_debug_info
-maxdb_embedded_connect
-maxdb_enable_reads_from_master
-maxdb_enable_rpl_parse
-maxdb_errno
-maxdb_error
-maxdb_escape_string
-maxdb_execute
-maxdb_fetch
-maxdb_fetch_array
-maxdb_fetch_assoc
-maxdb_fetch_field
-maxdb_fetch_field_direct
-maxdb_fetch_fields
-maxdb_fetch_lengths
-maxdb_fetch_object
-maxdb_fetch_row
-maxdb_field_count
-maxdb_field_seek
-maxdb_field_tell
-maxdb_free_result
-maxdb_get_client_info
-maxdb_get_client_version
-maxdb_get_host_info
-maxdb_get_metadata
-maxdb_get_proto_info
-maxdb_get_server_info
-maxdb_get_server_version
-maxdb_info
-maxdb_init
-maxdb_insert_id
-maxdb_kill
-maxdb_master_query
-maxdb_more_results
-maxdb_multi_query
-maxdb_next_result
-maxdb_num_fields
-maxdb_num_rows
-maxdb_options
-maxdb_param_count
-maxdb_ping
-maxdb_prepare
-maxdb_query
-maxdb_real_connect
-maxdb_real_escape_string
-maxdb_real_query
-maxdb_report
-maxdb_rollback
-maxdb_rpl_parse_enabled
-maxdb_rpl_probe
-maxdb_rpl_query_type
-maxdb_select_db
-maxdb_send_long_data
-maxdb_send_query
-maxdb_server_end
-maxdb_server_init
-maxdb_set_opt
-maxdb_sqlstate
-maxdb_ssl_set
-maxdb_stat
-maxdb_stmt_affected_rows
-maxdb_stmt_bind_param
-maxdb_stmt_bind_result
-maxdb_stmt_close
-maxdb_stmt_close_long_data
-maxdb_stmt_data_seek
-maxdb_stmt_errno
-maxdb_stmt_error
-maxdb_stmt_execute
-maxdb_stmt_fetch
-maxdb_stmt_free_result
-maxdb_stmt_init
-maxdb_stmt_num_rows
-maxdb_stmt_param_count
-maxdb_stmt_prepare
-maxdb_stmt_reset
-maxdb_stmt_result_metadata
-maxdb_stmt_send_long_data
-maxdb_stmt_sqlstate
-maxdb_stmt_store_result
-maxdb_store_result
-maxdb_thread_id
-maxdb_thread_safe
-maxdb_use_result
-maxdb_warning_count
-mb_check_encoding
-mb_convert_case
-mb_convert_encoding
-mb_convert_kana
-mb_convert_variables
-mb_decode_mimeheader
-mb_decode_numericentity
-mb_detect_encoding
-mb_detect_order
-mb_encode_mimeheader
-mb_encode_numericentity
-mb_ereg
-mb_ereg_match
-mb_ereg_replace
-mb_ereg_search
-mb_ereg_search_getpos
-mb_ereg_search_getregs
-mb_ereg_search_init
-mb_ereg_search_pos
-mb_ereg_search_regs
-mb_ereg_search_setpos
-mb_eregi
-mb_eregi_replace
-mb_get_info
-mb_http_input
-mb_http_output
-mb_internal_encoding
-mb_language
-mb_list_encodings
-mb_output_handler
-mb_parse_str
-mb_preferred_mime_name
-mb_regex_encoding
-mb_regex_set_options
-mb_send_mail
-mb_split
-mb_strcut
-mb_strimwidth
-mb_stripos
-mb_stristr
-mb_strlen
-mb_strpos
-mb_strrchr
-mb_strrichr
-mb_strripos
-mb_strrpos
-mb_strstr
-mb_strtolower
-mb_strtoupper
-mb_strwidth
-mb_substitute_character
-mb_substr
-mb_substr_count
-mcrypt_cbc
-mcrypt_cfb
-mcrypt_create_iv
-mcrypt_decrypt
-mcrypt_ecb
-mcrypt_enc_get_algorithms_name
-mcrypt_enc_get_block_size
-mcrypt_enc_get_iv_size
-mcrypt_enc_get_key_size
-mcrypt_enc_get_modes_name
-mcrypt_enc_get_supported_key_sizes
-mcrypt_enc_is_block_algorithm
-mcrypt_enc_is_block_algorithm_mode
-mcrypt_enc_is_block_mode
-mcrypt_enc_self_test
-mcrypt_encrypt
-mcrypt_generic
-mcrypt_generic_deinit
-mcrypt_generic_end
-mcrypt_generic_init
-mcrypt_get_block_size
-mcrypt_get_cipher_name
-mcrypt_get_iv_size
-mcrypt_get_key_size
-mcrypt_list_algorithms
-mcrypt_list_modes
-mcrypt_module_close
-mcrypt_module_get_algo_block_size
-mcrypt_module_get_algo_key_size
-mcrypt_module_get_supported_key_sizes
-mcrypt_module_is_block_algorithm
-mcrypt_module_is_block_algorithm_mode
-mcrypt_module_is_block_mode
-mcrypt_module_open
-mcrypt_module_self_test
-mcrypt_ofb
-md5
-md5_file
-mdecrypt_generic
-memcache_add
-memcache_addserver
-memcache_close
-memcache_connect
-memcache_debug
-memcache_decrement
-memcache_delete
-memcache_flush
-memcache_get
-memcache_getextendedstats
-memcache_getserverstatus
-memcache_getstats
-memcache_getversion
-memcache_increment
-memcache_pconnect
-memcache_replace
-memcache_set
-memcache_setcompressthreshold
-memcache_setserverparams
-memory_get_peak_usage
-memory_get_usage
-metaphone
-method_exists
-mhash
-mhash_count
-mhash_get_block_size
-mhash_get_hash_name
-mhash_keygen_s2k
-microtime
-mime_content_type
-min
-ming_keypress
-ming_setcubicthreshold
-ming_setscale
-ming_setswfcompression
-ming_useconstants
-ming_useswfversion
-mkdir
-mktime
-money_format
-mongo_close
-mongo_connect
-mongo_find_one
-mongo_gridchunk_data
-mongo_gridchunk_get
-mongo_gridchunk_size
-mongo_gridfile_chunk_num
-mongo_gridfile_chunk_size
-mongo_gridfile_exists
-mongo_gridfile_filename
-mongo_gridfile_size
-mongo_gridfile_write
-mongo_gridfs_find
-mongo_gridfs_init
-mongo_gridfs_list
-mongo_gridfs_store
-mongo_has_next
-mongo_insert
-mongo_next
-mongo_query
-mongo_remove
-mongo_update
-move_uploaded_file
-mqseries_back
-mqseries_begin
-mqseries_close
-mqseries_cmit
-mqseries_conn
-mqseries_connx
-mqseries_disc
-mqseries_get
-mqseries_inq
-mqseries_open
-mqseries_put
-mqseries_put1
-mqseries_set
-mqseries_strerror
-msession_connect
-msession_count
-msession_create
-msession_destroy
-msession_disconnect
-msession_find
-msession_get
-msession_get_array
-msession_get_data
-msession_inc
-msession_list
-msession_listvar
-msession_lock
-msession_plugin
-msession_randstr
-msession_set
-msession_set_array
-msession_set_data
-msession_timeout
-msession_uniq
-msession_unlock
-msg_get_queue
-msg_queue_exists
-msg_receive
-msg_remove_queue
-msg_send
-msg_set_queue
-msg_stat_queue
-msql
-msql_affected_rows
-msql_close
-msql_connect
-msql_create_db
-msql_createdb
-msql_data_seek
-msql_db_query
-msql_dbname
-msql_drop_db
-msql_error
-msql_fetch_array
-msql_fetch_field
-msql_fetch_object
-msql_fetch_row
-msql_field_flags
-msql_field_len
-msql_field_name
-msql_field_seek
-msql_field_table
-msql_field_type
-msql_fieldflags
-msql_fieldlen
-msql_fieldname
-msql_fieldtable
-msql_fieldtype
-msql_free_result
-msql_list_dbs
-msql_list_fields
-msql_list_tables
-msql_num_fields
-msql_num_rows
-msql_numfields
-msql_numrows
-msql_pconnect
-msql_query
-msql_regcase
-msql_result
-msql_select_db
-msql_tablename
-mssql_bind
-mssql_close
-mssql_connect
-mssql_data_seek
-mssql_execute
-mssql_fetch_array
-mssql_fetch_assoc
-mssql_fetch_batch
-mssql_fetch_field
-mssql_fetch_object
-mssql_fetch_row
-mssql_field_length
-mssql_field_name
-mssql_field_seek
-mssql_field_type
-mssql_free_result
-mssql_free_statement
-mssql_get_last_message
-mssql_guid_string
-mssql_init
-mssql_min_error_severity
-mssql_min_message_severity
-mssql_next_result
-mssql_num_fields
-mssql_num_rows
-mssql_pconnect
-mssql_query
-mssql_result
-mssql_rows_affected
-mssql_select_db
-mt_getrandmax
-mt_rand
-mt_srand
-mysql_affected_rows
-mysql_change_user
-mysql_client_encoding
-mysql_close
-mysql_connect
-mysql_create_db
-mysql_data_seek
-mysql_db_name
-mysql_db_query
-mysql_drop_db
-mysql_errno
-mysql_error
-mysql_escape_string
-mysql_fetch_array
-mysql_fetch_assoc
-mysql_fetch_field
-mysql_fetch_lengths
-mysql_fetch_object
-mysql_fetch_row
-mysql_field_flags
-mysql_field_len
-mysql_field_name
-mysql_field_seek
-mysql_field_table
-mysql_field_type
-mysql_free_result
-mysql_get_client_info
-mysql_get_host_info
-mysql_get_proto_info
-mysql_get_server_info
-mysql_info
-mysql_insert_id
-mysql_list_dbs
-mysql_list_fields
-mysql_list_processes
-mysql_list_tables
-mysql_num_fields
-mysql_num_rows
-mysql_pconnect
-mysql_ping
-mysql_query
-mysql_real_escape_string
-mysql_result
-mysql_select_db
-mysql_set_charset
-mysql_stat
-mysql_tablename
-mysql_thread_id
-mysql_unbuffered_query
-mysqli_bind_param
-mysqli_bind_result
-mysqli_client_encoding
-mysqli_disable_reads_from_master
-mysqli_disable_rpl_parse
-mysqli_enable_reads_from_master
-mysqli_enable_rpl_parse
-mysqli_escape_string
-mysqli_execute
-mysqli_fetch
-mysqli_get_metadata
-mysqli_master_query
-mysqli_param_count
-mysqli_report
-mysqli_rpl_parse_enabled
-mysqli_rpl_probe
-mysqli_rpl_query_type
-mysqli_send_long_data
-mysqli_send_query
-mysqli_set_opt
-mysqli_slave_query
-natcasesort
-natsort
-ncurses_addch
-ncurses_addchnstr
-ncurses_addchstr
-ncurses_addnstr
-ncurses_addstr
-ncurses_assume_default_colors
-ncurses_attroff
-ncurses_attron
-ncurses_attrset
-ncurses_baudrate
-ncurses_beep
-ncurses_bkgd
-ncurses_bkgdset
-ncurses_border
-ncurses_bottom_panel
-ncurses_can_change_color
-ncurses_cbreak
-ncurses_clear
-ncurses_clrtobot
-ncurses_clrtoeol
-ncurses_color_content
-ncurses_color_set
-ncurses_curs_set
-ncurses_def_prog_mode
-ncurses_def_shell_mode
-ncurses_define_key
-ncurses_del_panel
-ncurses_delay_output
-ncurses_delch
-ncurses_deleteln
-ncurses_delwin
-ncurses_doupdate
-ncurses_echo
-ncurses_echochar
-ncurses_end
-ncurses_erase
-ncurses_erasechar
-ncurses_filter
-ncurses_flash
-ncurses_flushinp
-ncurses_getch
-ncurses_getmaxyx
-ncurses_getmouse
-ncurses_getyx
-ncurses_halfdelay
-ncurses_has_colors
-ncurses_has_ic
-ncurses_has_il
-ncurses_has_key
-ncurses_hide_panel
-ncurses_hline
-ncurses_inch
-ncurses_init
-ncurses_init_color
-ncurses_init_pair
-ncurses_insch
-ncurses_insdelln
-ncurses_insertln
-ncurses_insstr
-ncurses_instr
-ncurses_isendwin
-ncurses_keyok
-ncurses_keypad
-ncurses_killchar
-ncurses_longname
-ncurses_meta
-ncurses_mouse_trafo
-ncurses_mouseinterval
-ncurses_mousemask
-ncurses_move
-ncurses_move_panel
-ncurses_mvaddch
-ncurses_mvaddchnstr
-ncurses_mvaddchstr
-ncurses_mvaddnstr
-ncurses_mvaddstr
-ncurses_mvcur
-ncurses_mvdelch
-ncurses_mvgetch
-ncurses_mvhline
-ncurses_mvinch
-ncurses_mvvline
-ncurses_mvwaddstr
-ncurses_napms
-ncurses_new_panel
-ncurses_newpad
-ncurses_newwin
-ncurses_nl
-ncurses_nocbreak
-ncurses_noecho
-ncurses_nonl
-ncurses_noqiflush
-ncurses_noraw
-ncurses_pair_content
-ncurses_panel_above
-ncurses_panel_below
-ncurses_panel_window
-ncurses_pnoutrefresh
-ncurses_prefresh
-ncurses_putp
-ncurses_qiflush
-ncurses_raw
-ncurses_refresh
-ncurses_replace_panel
-ncurses_reset_prog_mode
-ncurses_reset_shell_mode
-ncurses_resetty
-ncurses_savetty
-ncurses_scr_dump
-ncurses_scr_init
-ncurses_scr_restore
-ncurses_scr_set
-ncurses_scrl
-ncurses_show_panel
-ncurses_slk_attr
-ncurses_slk_attroff
-ncurses_slk_attron
-ncurses_slk_attrset
-ncurses_slk_clear
-ncurses_slk_color
-ncurses_slk_init
-ncurses_slk_noutrefresh
-ncurses_slk_refresh
-ncurses_slk_restore
-ncurses_slk_set
-ncurses_slk_touch
-ncurses_standend
-ncurses_standout
-ncurses_start_color
-ncurses_termattrs
-ncurses_termname
-ncurses_timeout
-ncurses_top_panel
-ncurses_typeahead
-ncurses_ungetch
-ncurses_ungetmouse
-ncurses_update_panels
-ncurses_use_default_colors
-ncurses_use_env
-ncurses_use_extended_names
-ncurses_vidattr
-ncurses_vline
-ncurses_waddch
-ncurses_waddstr
-ncurses_wattroff
-ncurses_wattron
-ncurses_wattrset
-ncurses_wborder
-ncurses_wclear
-ncurses_wcolor_set
-ncurses_werase
-ncurses_wgetch
-ncurses_whline
-ncurses_wmouse_trafo
-ncurses_wmove
-ncurses_wnoutrefresh
-ncurses_wrefresh
-ncurses_wstandend
-ncurses_wstandout
-ncurses_wvline
-newt_bell
-newt_button
-newt_button_bar
-newt_centered_window
-newt_checkbox
-newt_checkbox_get_value
-newt_checkbox_set_flags
-newt_checkbox_set_value
-newt_checkbox_tree
-newt_checkbox_tree_add_item
-newt_checkbox_tree_find_item
-newt_checkbox_tree_get_current
-newt_checkbox_tree_get_entry_value
-newt_checkbox_tree_get_multi_selection
-newt_checkbox_tree_get_selection
-newt_checkbox_tree_multi
-newt_checkbox_tree_set_current
-newt_checkbox_tree_set_entry
-newt_checkbox_tree_set_entry_value
-newt_checkbox_tree_set_width
-newt_clear_key_buffer
-newt_cls
-newt_compact_button
-newt_component_add_callback
-newt_component_takes_focus
-newt_create_grid
-newt_cursor_off
-newt_cursor_on
-newt_delay
-newt_draw_form
-newt_draw_root_text
-newt_entry
-newt_entry_get_value
-newt_entry_set
-newt_entry_set_filter
-newt_entry_set_flags
-newt_finished
-newt_form
-newt_form_add_component
-newt_form_add_components
-newt_form_add_hot_key
-newt_form_destroy
-newt_form_get_current
-newt_form_run
-newt_form_set_background
-newt_form_set_height
-newt_form_set_size
-newt_form_set_timer
-newt_form_set_width
-newt_form_watch_fd
-newt_get_screen_size
-newt_grid_add_components_to_form
-newt_grid_basic_window
-newt_grid_free
-newt_grid_get_size
-newt_grid_h_close_stacked
-newt_grid_h_stacked
-newt_grid_place
-newt_grid_set_field
-newt_grid_simple_window
-newt_grid_v_close_stacked
-newt_grid_v_stacked
-newt_grid_wrapped_window
-newt_grid_wrapped_window_at
-newt_init
-newt_label
-newt_label_set_text
-newt_listbox
-newt_listbox_append_entry
-newt_listbox_clear
-newt_listbox_clear_selection
-newt_listbox_delete_entry
-newt_listbox_get_current
-newt_listbox_get_selection
-newt_listbox_insert_entry
-newt_listbox_item_count
-newt_listbox_select_item
-newt_listbox_set_current
-newt_listbox_set_current_by_key
-newt_listbox_set_data
-newt_listbox_set_entry
-newt_listbox_set_width
-newt_listitem
-newt_listitem_get_data
-newt_listitem_set
-newt_open_window
-newt_pop_help_line
-newt_pop_window
-newt_push_help_line
-newt_radio_get_current
-newt_radiobutton
-newt_redraw_help_line
-newt_reflow_text
-newt_refresh
-newt_resize_screen
-newt_resume
-newt_run_form
-newt_scale
-newt_scale_set
-newt_scrollbar_set
-newt_set_help_callback
-newt_set_suspend_callback
-newt_suspend
-newt_textbox
-newt_textbox_get_num_lines
-newt_textbox_reflowed
-newt_textbox_set_height
-newt_textbox_set_text
-newt_vertical_scrollbar
-newt_wait_for_key
-newt_win_choice
-newt_win_entries
-newt_win_menu
-newt_win_message
-newt_win_messagev
-newt_win_ternary
-next
-ngettext
-nl_langinfo
-nl2br
-notes_body
-notes_copy_db
-notes_create_db
-notes_create_note
-notes_drop_db
-notes_find_note
-notes_header_info
-notes_list_msgs
-notes_mark_read
-notes_mark_unread
-notes_nav_create
-notes_search
-notes_unread
-notes_version
-nsapi_request_headers
-nsapi_response_headers
-nsapi_virtual
-nthmac
-number_format
-oauth_urlencode
-ob_clean
-ob_deflatehandler
-ob_end_clean
-ob_end_flush
-ob_etaghandler
-ob_flush
-ob_get_clean
-ob_get_contents
-ob_get_flush
-ob_get_length
-ob_get_level
-ob_get_status
-ob_gzhandler
-ob_iconv_handler
-ob_implicit_flush
-ob_inflatehandler
-ob_list_handlers
-ob_start
-ob_tidyhandler
-oci_bind_array_by_name
-oci_bind_by_name
-oci_cancel
-oci_close
-oci_collection_append
-oci_collection_assign
-oci_collection_element_assign
-oci_collection_element_get
-oci_collection_free
-oci_collection_max
-oci_collection_size
-oci_collection_trim
-oci_commit
-oci_connect
-oci_define_by_name
-oci_error
-oci_execute
-oci_fetch
-oci_fetch_all
-oci_fetch_array
-oci_fetch_assoc
-oci_fetch_object
-oci_fetch_row
-oci_field_is_null
-oci_field_name
-oci_field_precision
-oci_field_scale
-oci_field_size
-oci_field_type
-oci_field_type_raw
-oci_free_statement
-oci_internal_debug
-oci_lob_append
-oci_lob_close
-oci_lob_copy
-oci_lob_eof
-oci_lob_erase
-oci_lob_export
-oci_lob_flush
-oci_lob_free
-oci_lob_getbuffering
-oci_lob_import
-oci_lob_is_equal
-oci_lob_load
-oci_lob_read
-oci_lob_rewind
-oci_lob_save
-oci_lob_savefile
-oci_lob_seek
-oci_lob_setbuffering
-oci_lob_size
-oci_lob_tell
-oci_lob_truncate
-oci_lob_write
-oci_lob_writetemporary
-oci_lob_writetofile
-oci_new_collection
-oci_new_connect
-oci_new_cursor
-oci_new_descriptor
-oci_num_fields
-oci_num_rows
-oci_parse
-oci_password_change
-oci_pconnect
-oci_result
-oci_rollback
-oci_server_version
-oci_set_prefetch
-oci_statement_type
-ocibindbyname
-ocicancel
-ocicloselob
-ocicollappend
-ocicollassign
-ocicollassignelem
-ocicollgetelem
-ocicollmax
-ocicollsize
-ocicolltrim
-ocicolumnisnull
-ocicolumnname
-ocicolumnprecision
-ocicolumnscale
-ocicolumnsize
-ocicolumntype
-ocicolumntyperaw
-ocicommit
-ocidefinebyname
-ocierror
-ociexecute
-ocifetch
-ocifetchinto
-ocifetchstatement
-ocifreecollection
-ocifreecursor
-ocifreedesc
-ocifreestatement
-ociinternaldebug
-ociloadlob
-ocilogoff
-ocilogon
-ocinewcollection
-ocinewcursor
-ocinewdescriptor
-ocinlogon
-ocinumcols
-ociparse
-ociplogon
-ociresult
-ocirollback
-ocirowcount
-ocisavelob
-ocisavelobfile
-ociserverversion
-ocisetprefetch
-ocistatementtype
-ociwritelobtofile
-ociwritetemporarylob
-octdec
-odbc_autocommit
-odbc_binmode
-odbc_close
-odbc_close_all
-odbc_columnprivileges
-odbc_columns
-odbc_commit
-odbc_connect
-odbc_cursor
-odbc_data_source
-odbc_do
-odbc_error
-odbc_errormsg
-odbc_exec
-odbc_execute
-odbc_fetch_array
-odbc_fetch_into
-odbc_fetch_object
-odbc_fetch_row
-odbc_field_len
-odbc_field_name
-odbc_field_num
-odbc_field_precision
-odbc_field_scale
-odbc_field_type
-odbc_foreignkeys
-odbc_free_result
-odbc_gettypeinfo
-odbc_longreadlen
-odbc_next_result
-odbc_num_fields
-odbc_num_rows
-odbc_pconnect
-odbc_prepare
-odbc_primarykeys
-odbc_procedurecolumns
-odbc_procedures
-odbc_result
-odbc_result_all
-odbc_rollback
-odbc_setoption
-odbc_specialcolumns
-odbc_statistics
-odbc_tableprivileges
-odbc_tables
-openal_buffer_create
-openal_buffer_data
-openal_buffer_destroy
-openal_buffer_get
-openal_buffer_loadwav
-openal_context_create
-openal_context_current
-openal_context_destroy
-openal_context_process
-openal_context_suspend
-openal_device_close
-openal_device_open
-openal_listener_get
-openal_listener_set
-openal_source_create
-openal_source_destroy
-openal_source_get
-openal_source_pause
-openal_source_play
-openal_source_rewind
-openal_source_set
-openal_source_stop
-openal_stream
-opendir
-openlog
-openssl_csr_export
-openssl_csr_export_to_file
-openssl_csr_get_public_key
-openssl_csr_get_subject
-openssl_csr_new
-openssl_csr_sign
-openssl_error_string
-openssl_free_key
-openssl_get_privatekey
-openssl_get_publickey
-openssl_open
-openssl_pkcs12_export
-openssl_pkcs12_export_to_file
-openssl_pkcs12_read
-openssl_pkcs7_decrypt
-openssl_pkcs7_encrypt
-openssl_pkcs7_sign
-openssl_pkcs7_verify
-openssl_pkey_export
-openssl_pkey_export_to_file
-openssl_pkey_free
-openssl_pkey_get_details
-openssl_pkey_get_private
-openssl_pkey_get_public
-openssl_pkey_new
-openssl_private_decrypt
-openssl_private_encrypt
-openssl_public_decrypt
-openssl_public_encrypt
-openssl_seal
-openssl_sign
-openssl_verify
-openssl_x509_check_private_key
-openssl_x509_checkpurpose
-openssl_x509_export
-openssl_x509_export_to_file
-openssl_x509_free
-openssl_x509_parse
-openssl_x509_read
-ord
-output_add_rewrite_var
-output_reset_rewrite_vars
-overload
-override_function
-ovrimos_close
-ovrimos_commit
-ovrimos_connect
-ovrimos_cursor
-ovrimos_exec
-ovrimos_execute
-ovrimos_fetch_into
-ovrimos_fetch_row
-ovrimos_field_len
-ovrimos_field_name
-ovrimos_field_num
-ovrimos_field_type
-ovrimos_free_result
-ovrimos_longreadlen
-ovrimos_num_fields
-ovrimos_num_rows
-ovrimos_prepare
-ovrimos_result
-ovrimos_result_all
-ovrimos_rollback
-pack
-parse_ini_file
-parse_ini_string
-parse_str
-parse_url
-parsekit_compile_file
-parsekit_compile_string
-parsekit_func_arginfo
-passthru
-pathinfo
-pclose
-pcntl_alarm
-pcntl_exec
-pcntl_fork
-pcntl_getpriority
-pcntl_setpriority
-pcntl_signal
-pcntl_signal_dispatch
-pcntl_sigprocmask
-pcntl_sigtimedwait
-pcntl_sigwaitinfo
-pcntl_wait
-pcntl_waitpid
-pcntl_wexitstatus
-pcntl_wifexited
-pcntl_wifsignaled
-pcntl_wifstopped
-pcntl_wstopsig
-pcntl_wtermsig
-pdf_activate_item
-pdf_add_annotation
-pdf_add_bookmark
-pdf_add_launchlink
-pdf_add_locallink
-pdf_add_nameddest
-pdf_add_note
-pdf_add_outline
-pdf_add_pdflink
-pdf_add_table_cell
-pdf_add_textflow
-pdf_add_thumbnail
-pdf_add_weblink
-pdf_arc
-pdf_arcn
-pdf_attach_file
-pdf_begin_document
-pdf_begin_font
-pdf_begin_glyph
-pdf_begin_item
-pdf_begin_layer
-pdf_begin_page
-pdf_begin_page_ext
-pdf_begin_pattern
-pdf_begin_template
-pdf_begin_template_ext
-pdf_circle
-pdf_clip
-pdf_close
-pdf_close_image
-pdf_close_pdi
-pdf_close_pdi_page
-pdf_closepath
-pdf_closepath_fill_stroke
-pdf_closepath_stroke
-pdf_concat
-pdf_continue_text
-pdf_create_3dview
-pdf_create_action
-pdf_create_annotation
-pdf_create_bookmark
-pdf_create_field
-pdf_create_fieldgroup
-pdf_create_gstate
-pdf_create_pvf
-pdf_create_textflow
-pdf_curveto
-pdf_define_layer
-pdf_delete
-pdf_delete_pvf
-pdf_delete_table
-pdf_delete_textflow
-pdf_encoding_set_char
-pdf_end_document
-pdf_end_font
-pdf_end_glyph
-pdf_end_item
-pdf_end_layer
-pdf_end_page
-pdf_end_page_ext
-pdf_end_pattern
-pdf_end_template
-pdf_endpath
-pdf_fill
-pdf_fill_imageblock
-pdf_fill_pdfblock
-pdf_fill_stroke
-pdf_fill_textblock
-pdf_findfont
-pdf_fit_image
-pdf_fit_pdi_page
-pdf_fit_table
-pdf_fit_textflow
-pdf_fit_textline
-pdf_get_apiname
-pdf_get_buffer
-pdf_get_errmsg
-pdf_get_errnum
-pdf_get_font
-pdf_get_fontname
-pdf_get_fontsize
-pdf_get_image_height
-pdf_get_image_width
-pdf_get_majorversion
-pdf_get_minorversion
-pdf_get_parameter
-pdf_get_pdi_parameter
-pdf_get_pdi_value
-pdf_get_value
-pdf_info_font
-pdf_info_matchbox
-pdf_info_table
-pdf_info_textflow
-pdf_info_textline
-pdf_initgraphics
-pdf_lineto
-pdf_load_3ddata
-pdf_load_font
-pdf_load_iccprofile
-pdf_load_image
-pdf_makespotcolor
-pdf_moveto
-pdf_new
-pdf_open_ccitt
-pdf_open_file
-pdf_open_gif
-pdf_open_image
-pdf_open_image_file
-pdf_open_jpeg
-pdf_open_memory_image
-pdf_open_pdi
-pdf_open_pdi_page
-pdf_open_tiff
-pdf_pcos_get_number
-pdf_pcos_get_stream
-pdf_pcos_get_string
-pdf_place_image
-pdf_place_pdi_page
-pdf_process_pdi
-pdf_rect
-pdf_restore
-pdf_resume_page
-pdf_rotate
-pdf_save
-pdf_scale
-pdf_set_border_color
-pdf_set_border_dash
-pdf_set_border_style
-pdf_set_char_spacing
-pdf_set_duration
-pdf_set_gstate
-pdf_set_horiz_scaling
-pdf_set_info
-pdf_set_info_author
-pdf_set_info_creator
-pdf_set_info_keywords
-pdf_set_info_subject
-pdf_set_info_title
-pdf_set_layer_dependency
-pdf_set_leading
-pdf_set_parameter
-pdf_set_text_matrix
-pdf_set_text_pos
-pdf_set_text_rendering
-pdf_set_text_rise
-pdf_set_value
-pdf_set_word_spacing
-pdf_setcolor
-pdf_setdash
-pdf_setdashpattern
-pdf_setflat
-pdf_setfont
-pdf_setgray
-pdf_setgray_fill
-pdf_setgray_stroke
-pdf_setlinecap
-pdf_setlinejoin
-pdf_setlinewidth
-pdf_setmatrix
-pdf_setmiterlimit
-pdf_setpolydash
-pdf_setrgbcolor
-pdf_setrgbcolor_fill
-pdf_setrgbcolor_stroke
-pdf_shading
-pdf_shading_pattern
-pdf_shfill
-pdf_show
-pdf_show_boxed
-pdf_show_xy
-pdf_skew
-pdf_stringwidth
-pdf_stroke
-pdf_suspend_page
-pdf_translate
-pdf_utf16_to_utf8
-pdf_utf32_to_utf16
-pdf_utf8_to_utf16
-pdo_pgsqllobcreate
-pdo_pgsqllobopen
-pdo_pgsqllobunlink
-pdo_sqlitecreateaggregate
-pdo_sqlitecreatefunction
-pfsockopen
-pg_affected_rows
-pg_cancel_query
-pg_client_encoding
-pg_close
-pg_connect
-pg_connection_busy
-pg_connection_reset
-pg_connection_status
-pg_convert
-pg_copy_from
-pg_copy_to
-pg_dbname
-pg_delete
-pg_end_copy
-pg_escape_bytea
-pg_escape_string
-pg_execute
-pg_fetch_all
-pg_fetch_all_columns
-pg_fetch_array
-pg_fetch_assoc
-pg_fetch_object
-pg_fetch_result
-pg_fetch_row
-pg_field_is_null
-pg_field_name
-pg_field_num
-pg_field_prtlen
-pg_field_size
-pg_field_table
-pg_field_type
-pg_field_type_oid
-pg_free_result
-pg_get_notify
-pg_get_pid
-pg_get_result
-pg_host
-pg_insert
-pg_last_error
-pg_last_notice
-pg_last_oid
-pg_lo_close
-pg_lo_create
-pg_lo_export
-pg_lo_import
-pg_lo_open
-pg_lo_read
-pg_lo_read_all
-pg_lo_seek
-pg_lo_tell
-pg_lo_unlink
-pg_lo_write
-pg_meta_data
-pg_num_fields
-pg_num_rows
-pg_options
-pg_parameter_status
-pg_pconnect
-pg_ping
-pg_port
-pg_prepare
-pg_put_line
-pg_query
-pg_query_params
-pg_result_error
-pg_result_error_field
-pg_result_seek
-pg_result_status
-pg_select
-pg_send_execute
-pg_send_prepare
-pg_send_query
-pg_send_query_params
-pg_set_client_encoding
-pg_set_error_verbosity
-pg_trace
-pg_transaction_status
-pg_tty
-pg_unescape_bytea
-pg_untrace
-pg_update
-pg_version
-php_check_syntax
-php_ini_loaded_file
-php_ini_scanned_files
-php_logo_guid
-php_sapi_name
-php_strip_whitespace
-php_uname
-phpcredits
-phpinfo
-phpversion
-pi
-png2wbmp
-popen
-pos
-posix_access
-posix_ctermid
-posix_get_last_error
-posix_getcwd
-posix_getegid
-posix_geteuid
-posix_getgid
-posix_getgrgid
-posix_getgrnam
-posix_getgroups
-posix_getlogin
-posix_getpgid
-posix_getpgrp
-posix_getpid
-posix_getppid
-posix_getpwnam
-posix_getpwuid
-posix_getrlimit
-posix_getsid
-posix_getuid
-posix_initgroups
-posix_isatty
-posix_kill
-posix_mkfifo
-posix_mknod
-posix_setegid
-posix_seteuid
-posix_setgid
-posix_setpgid
-posix_setsid
-posix_setuid
-posix_strerror
-posix_times
-posix_ttyname
-posix_uname
-pow
-preg_filter
-preg_grep
-preg_last_error
-preg_match
-preg_match_all
-preg_quote
-preg_replace
-preg_replace_callback
-preg_split
-prev
-print
-print_r
-printer_abort
-printer_close
-printer_create_brush
-printer_create_dc
-printer_create_font
-printer_create_pen
-printer_delete_brush
-printer_delete_dc
-printer_delete_font
-printer_delete_pen
-printer_draw_bmp
-printer_draw_chord
-printer_draw_elipse
-printer_draw_line
-printer_draw_pie
-printer_draw_rectangle
-printer_draw_roundrect
-printer_draw_text
-printer_end_doc
-printer_end_page
-printer_get_option
-printer_list
-printer_logical_fontheight
-printer_open
-printer_select_brush
-printer_select_font
-printer_select_pen
-printer_set_option
-printer_start_doc
-printer_start_page
-printer_write
-printf
-proc_close
-proc_get_status
-proc_nice
-proc_open
-proc_terminate
-property_exists
-ps_add_bookmark
-ps_add_launchlink
-ps_add_locallink
-ps_add_note
-ps_add_pdflink
-ps_add_weblink
-ps_arc
-ps_arcn
-ps_begin_page
-ps_begin_pattern
-ps_begin_template
-ps_circle
-ps_clip
-ps_close
-ps_close_image
-ps_closepath
-ps_closepath_stroke
-ps_continue_text
-ps_curveto
-ps_delete
-ps_end_page
-ps_end_pattern
-ps_end_template
-ps_fill
-ps_fill_stroke
-ps_findfont
-ps_get_buffer
-ps_get_parameter
-ps_get_value
-ps_hyphenate
-ps_include_file
-ps_lineto
-ps_makespotcolor
-ps_moveto
-ps_new
-ps_open_file
-ps_open_image
-ps_open_image_file
-ps_open_memory_image
-ps_place_image
-ps_rect
-ps_restore
-ps_rotate
-ps_save
-ps_scale
-ps_set_border_color
-ps_set_border_dash
-ps_set_border_style
-ps_set_info
-ps_set_parameter
-ps_set_text_pos
-ps_set_value
-ps_setcolor
-ps_setdash
-ps_setflat
-ps_setfont
-ps_setgray
-ps_setlinecap
-ps_setlinejoin
-ps_setlinewidth
-ps_setmiterlimit
-ps_setoverprintmode
-ps_setpolydash
-ps_shading
-ps_shading_pattern
-ps_shfill
-ps_show
-ps_show_boxed
-ps_show_xy
-ps_show_xy2
-ps_show2
-ps_string_geometry
-ps_stringwidth
-ps_stroke
-ps_symbol
-ps_symbol_name
-ps_symbol_width
-ps_translate
-pspell_add_to_personal
-pspell_add_to_session
-pspell_check
-pspell_clear_session
-pspell_config_create
-pspell_config_data_dir
-pspell_config_dict_dir
-pspell_config_ignore
-pspell_config_mode
-pspell_config_personal
-pspell_config_repl
-pspell_config_runtogether
-pspell_config_save_repl
-pspell_new
-pspell_new_config
-pspell_new_personal
-pspell_save_wordlist
-pspell_store_replacement
-pspell_suggest
-putenv
-px_close
-px_create_fp
-px_date2string
-px_delete
-px_delete_record
-px_get_field
-px_get_info
-px_get_parameter
-px_get_record
-px_get_schema
-px_get_value
-px_insert_record
-px_new
-px_numfields
-px_numrecords
-px_open_fp
-px_put_record
-px_retrieve_record
-px_set_blob_file
-px_set_parameter
-px_set_tablename
-px_set_targetencoding
-px_set_value
-px_timestamp2string
-px_update_record
-qdom_error
-qdom_tree
-quoted_printable_decode
-quoted_printable_encode
-quotemeta
-rad2deg
-radius_acct_open
-radius_add_server
-radius_auth_open
-radius_close
-radius_config
-radius_create_request
-radius_cvt_addr
-radius_cvt_int
-radius_cvt_string
-radius_demangle
-radius_demangle_mppe_key
-radius_get_attr
-radius_get_vendor_attr
-radius_put_addr
-radius_put_attr
-radius_put_int
-radius_put_string
-radius_put_vendor_addr
-radius_put_vendor_attr
-radius_put_vendor_int
-radius_put_vendor_string
-radius_request_authenticator
-radius_send_request
-radius_server_secret
-radius_strerror
-rand
-range
-rar_close
-rar_entry_get
-rar_extract
-rar_getattr
-rar_getcrc
-rar_getfiletime
-rar_gethostos
-rar_getmethod
-rar_getname
-rar_getpackedsize
-rar_getunpackedsize
-rar_getversion
-rar_list
-rar_open
-rawurldecode
-rawurlencode
-read_exif_data
-readdir
-readfile
-readgzfile
-readline
-readline_add_history
-readline_callback_handler_install
-readline_callback_handler_remove
-readline_callback_read_char
-readline_clear_history
-readline_completion_function
-readline_info
-readline_list_history
-readline_on_new_line
-readline_read_history
-readline_redisplay
-readline_write_history
-readlink
-realpath
-recode
-recode_file
-recode_string
-register_shutdown_function
-register_tick_function
-rename
-rename_function
-require
-require_once
-reset
-restore_error_handler
-restore_exception_handler
-restore_include_path
-return
-rewind
-rewinddir
-rmdir
-round
-rpm_close
-rpm_get_tag
-rpm_is_valid
-rpm_open
-rpm_version
-rsort
-rtrim
-runkit_class_adopt
-runkit_class_emancipate
-runkit_constant_add
-runkit_constant_redefine
-runkit_constant_remove
-runkit_function_add
-runkit_function_copy
-runkit_function_redefine
-runkit_function_remove
-runkit_function_rename
-runkit_import
-runkit_lint
-runkit_lint_file
-runkit_method_add
-runkit_method_copy
-runkit_method_redefine
-runkit_method_remove
-runkit_method_rename
-runkit_return_value_used
-runkit_sandbox_output_handler
-runkit_superglobals
-samconnection_commit
-samconnection_connect
-samconnection_constructor
-samconnection_disconnect
-samconnection_errno
-samconnection_error
-samconnection_isconnected
-samconnection_peek
-samconnection_peekall
-samconnection_receive
-samconnection_remove
-samconnection_rollback
-samconnection_send
-samconnection_setDebug
-samconnection_subscribe
-samconnection_unsubscribe
-sammessage_body
-sammessage_constructor
-sammessage_header
-sca_createdataobject
-sca_getservice
-sca_localproxy_createdataobject
-sca_soapproxy_createdataobject
-scandir
-sdo_das_changesummary_beginlogging
-sdo_das_changesummary_endlogging
-sdo_das_changesummary_getchangeddataobjects
-sdo_das_changesummary_getchangetype
-sdo_das_changesummary_getoldcontainer
-sdo_das_changesummary_getoldvalues
-sdo_das_changesummary_islogging
-sdo_das_datafactory_addpropertytotype
-sdo_das_datafactory_addtype
-sdo_das_datafactory_getdatafactory
-sdo_das_dataobject_getchangesummary
-sdo_das_relational_applychanges
-sdo_das_relational_construct
-sdo_das_relational_createrootdataobject
-sdo_das_relational_executepreparedquery
-sdo_das_relational_executequery
-sdo_das_setting_getlistindex
-sdo_das_setting_getpropertyindex
-sdo_das_setting_getpropertyname
-sdo_das_setting_getvalue
-sdo_das_setting_isset
-sdo_das_xml_addtypes
-sdo_das_xml_create
-sdo_das_xml_createdataobject
-sdo_das_xml_createdocument
-sdo_das_xml_document_getrootdataobject
-sdo_das_xml_document_getrootelementname
-sdo_das_xml_document_getrootelementuri
-sdo_das_xml_document_setencoding
-sdo_das_xml_document_setxmldeclaration
-sdo_das_xml_document_setxmlversion
-sdo_das_xml_loadfile
-sdo_das_xml_loadstring
-sdo_das_xml_savefile
-sdo_das_xml_savestring
-sdo_datafactory_create
-sdo_dataobject_clear
-sdo_dataobject_createdataobject
-sdo_dataobject_getcontainer
-sdo_dataobject_getsequence
-sdo_dataobject_gettypename
-sdo_dataobject_gettypenamespaceuri
-sdo_exception_getcause
-sdo_list_insert
-sdo_model_property_getcontainingtype
-sdo_model_property_getdefault
-sdo_model_property_getname
-sdo_model_property_gettype
-sdo_model_property_iscontainment
-sdo_model_property_ismany
-sdo_model_reflectiondataobject_construct
-sdo_model_reflectiondataobject_export
-sdo_model_reflectiondataobject_getcontainmentproperty
-sdo_model_reflectiondataobject_getinstanceproperties
-sdo_model_reflectiondataobject_gettype
-sdo_model_type_getbasetype
-sdo_model_type_getname
-sdo_model_type_getnamespaceuri
-sdo_model_type_getproperties
-sdo_model_type_getproperty
-sdo_model_type_isabstracttype
-sdo_model_type_isdatatype
-sdo_model_type_isinstance
-sdo_model_type_isopentype
-sdo_model_type_issequencedtype
-sdo_sequence_getproperty
-sdo_sequence_insert
-sdo_sequence_move
-sem_acquire
-sem_get
-sem_release
-sem_remove
-serialize
-session_cache_expire
-session_cache_limiter
-session_commit
-session_decode
-session_destroy
-session_encode
-session_get_cookie_params
-session_id
-session_is_registered
-session_module_name
-session_name
-session_pgsql_add_error
-session_pgsql_get_error
-session_pgsql_get_field
-session_pgsql_reset
-session_pgsql_set_field
-session_pgsql_status
-session_regenerate_id
-session_register
-session_save_path
-session_set_cookie_params
-session_set_save_handler
-session_start
-session_unregister
-session_unset
-session_write_close
-set_error_handler
-set_exception_handler
-set_file_buffer
-set_include_path
-set_magic_quotes_runtime
-set_time_limit
-setcookie
-setlocale
-setrawcookie
-settype
-sha1
-sha1_file
-shell_exec
-shm_attach
-shm_detach
-shm_get_var
-shm_put_var
-shm_remove
-shm_remove_var
-shmop_close
-shmop_delete
-shmop_open
-shmop_read
-shmop_size
-shmop_write
-show_source
-shuffle
-signeurlpaiement
-similar_text
-simplexml_element_addAttribute
-simplexml_element_addChild
-simplexml_element_asXML
-simplexml_element_attributes
-simplexml_element_children
-simplexml_element_construct
-simplexml_element_getDocNamespaces
-simplexml_element_getName
-simplexml_element_getNamespaces
-simplexml_element_registerXPathNamespace
-simplexml_element_xpath
-simplexml_import_dom
-simplexml_load_file
-simplexml_load_string
-sin
-sinh
-sizeof
-sleep
-snmp_get_quick_print
-snmp_get_valueretrieval
-snmp_read_mib
-snmp_set_enum_print
-snmp_set_oid_numeric_print
-snmp_set_oid_output_format
-snmp_set_quick_print
-snmp_set_valueretrieval
-snmpget
-snmpgetnext
-snmprealwalk
-snmpset
-snmpwalk
-snmpwalkoid
-socket_accept
-socket_bind
-socket_clear_error
-socket_close
-socket_connect
-socket_create
-socket_create_listen
-socket_create_pair
-socket_get_option
-socket_get_status
-socket_getpeername
-socket_getsockname
-socket_last_error
-socket_listen
-socket_read
-socket_recv
-socket_recvfrom
-socket_select
-socket_send
-socket_sendto
-socket_set_block
-socket_set_blocking
-socket_set_nonblock
-socket_set_option
-socket_set_timeout
-socket_shutdown
-socket_strerror
-socket_write
-sort
-soundex
-spl_autoload
-spl_autoload_call
-spl_autoload_extensions
-spl_autoload_functions
-spl_autoload_register
-spl_autoload_unregister
-spl_classes
-spl_object_hash
-split
-spliti
-sprintf
-sql_regcase
-sqlite_array_query
-sqlite_busy_timeout
-sqlite_changes
-sqlite_close
-sqlite_column
-sqlite_create_aggregate
-sqlite_create_function
-sqlite_current
-sqlite_error_string
-sqlite_escape_string
-sqlite_exec
-sqlite_factory
-sqlite_fetch_all
-sqlite_fetch_array
-sqlite_fetch_column_types
-sqlite_fetch_object
-sqlite_fetch_single
-sqlite_fetch_string
-sqlite_field_name
-sqlite_has_more
-sqlite_has_prev
-sqlite_key
-sqlite_last_error
-sqlite_last_insert_rowid
-sqlite_libencoding
-sqlite_libversion
-sqlite_next
-sqlite_num_fields
-sqlite_num_rows
-sqlite_open
-sqlite_popen
-sqlite_prev
-sqlite_query
-sqlite_rewind
-sqlite_seek
-sqlite_single_query
-sqlite_udf_decode_binary
-sqlite_udf_encode_binary
-sqlite_unbuffered_query
-sqlite_valid
-sqrt
-srand
-sscanf
-ssh2_auth_hostbased_file
-ssh2_auth_none
-ssh2_auth_password
-ssh2_auth_pubkey_file
-ssh2_connect
-ssh2_exec
-ssh2_fetch_stream
-ssh2_fingerprint
-ssh2_methods_negotiated
-ssh2_publickey_add
-ssh2_publickey_init
-ssh2_publickey_list
-ssh2_publickey_remove
-ssh2_scp_recv
-ssh2_scp_send
-ssh2_sftp
-ssh2_sftp_lstat
-ssh2_sftp_mkdir
-ssh2_sftp_readlink
-ssh2_sftp_realpath
-ssh2_sftp_rename
-ssh2_sftp_rmdir
-ssh2_sftp_stat
-ssh2_sftp_symlink
-ssh2_sftp_unlink
-ssh2_shell
-ssh2_tunnel
-stat
-stats_absolute_deviation
-stats_cdf_beta
-stats_cdf_binomial
-stats_cdf_cauchy
-stats_cdf_chisquare
-stats_cdf_exponential
-stats_cdf_f
-stats_cdf_gamma
-stats_cdf_laplace
-stats_cdf_logistic
-stats_cdf_negative_binomial
-stats_cdf_noncentral_chisquare
-stats_cdf_noncentral_f
-stats_cdf_poisson
-stats_cdf_t
-stats_cdf_uniform
-stats_cdf_weibull
-stats_covariance
-stats_den_uniform
-stats_dens_beta
-stats_dens_cauchy
-stats_dens_chisquare
-stats_dens_exponential
-stats_dens_f
-stats_dens_gamma
-stats_dens_laplace
-stats_dens_logistic
-stats_dens_negative_binomial
-stats_dens_normal
-stats_dens_pmf_binomial
-stats_dens_pmf_hypergeometric
-stats_dens_pmf_poisson
-stats_dens_t
-stats_dens_weibull
-stats_harmonic_mean
-stats_kurtosis
-stats_rand_gen_beta
-stats_rand_gen_chisquare
-stats_rand_gen_exponential
-stats_rand_gen_f
-stats_rand_gen_funiform
-stats_rand_gen_gamma
-stats_rand_gen_ibinomial
-stats_rand_gen_ibinomial_negative
-stats_rand_gen_int
-stats_rand_gen_ipoisson
-stats_rand_gen_iuniform
-stats_rand_gen_noncenral_chisquare
-stats_rand_gen_noncentral_f
-stats_rand_gen_noncentral_t
-stats_rand_gen_normal
-stats_rand_gen_t
-stats_rand_get_seeds
-stats_rand_phrase_to_seeds
-stats_rand_ranf
-stats_rand_setall
-stats_skew
-stats_standard_deviation
-stats_stat_binomial_coef
-stats_stat_correlation
-stats_stat_gennch
-stats_stat_independent_t
-stats_stat_innerproduct
-stats_stat_noncentral_t
-stats_stat_paired_t
-stats_stat_percentile
-stats_stat_powersum
-stats_variance
-str_getcsv
-str_ireplace
-str_pad
-str_repeat
-str_replace
-str_rot13
-str_shuffle
-str_split
-str_word_count
-strcasecmp
-strchr
-strcmp
-strcoll
-strcspn
-stream_bucket_append
-stream_bucket_make_writeable
-stream_bucket_new
-stream_bucket_prepend
-stream_context_create
-stream_context_get_default
-stream_context_get_options
-stream_context_get_params
-stream_context_set_default
-stream_context_set_option
-stream_context_set_params
-stream_copy_to_stream
-stream_encoding
-stream_filter_append
-stream_filter_prepend
-stream_filter_register
-stream_filter_remove
-stream_get_contents
-stream_get_filters
-stream_get_line
-stream_get_meta_data
-stream_get_transports
-stream_get_wrappers
-stream_is_local
-stream_notification_callback
-stream_register_wrapper
-stream_resolve_include_path
-stream_select
-stream_set_blocking
-stream_set_timeout
-stream_set_write_buffer
-stream_socket_accept
-stream_socket_client
-stream_socket_enable_crypto
-stream_socket_get_name
-stream_socket_pair
-stream_socket_recvfrom
-stream_socket_sendto
-stream_socket_server
-stream_socket_shutdown
-stream_supports_lock
-stream_wrapper_register
-stream_wrapper_restore
-stream_wrapper_unregister
-strftime
-strip_tags
-stripcslashes
-stripos
-stripslashes
-stristr
-strlen
-strnatcasecmp
-strnatcmp
-strncasecmp
-strncmp
-strpbrk
-strpos
-strptime
-strrchr
-strrev
-strripos
-strrpos
-strspn
-strstr
-strtok
-strtolower
-strtotime
-strtoupper
-strtr
-strval
-substr
-substr_compare
-substr_count
-substr_replace
-svn_add
-svn_auth_get_parameter
-svn_auth_set_parameter
-svn_blame
-svn_cat
-svn_checkout
-svn_cleanup
-svn_client_version
-svn_commit
-svn_diff
-svn_export
-svn_fs_abort_txn
-svn_fs_apply_text
-svn_fs_begin_txn2
-svn_fs_change_node_prop
-svn_fs_check_path
-svn_fs_contents_changed
-svn_fs_copy
-svn_fs_delete
-svn_fs_dir_entries
-svn_fs_file_contents
-svn_fs_file_length
-svn_fs_is_dir
-svn_fs_is_file
-svn_fs_make_dir
-svn_fs_make_file
-svn_fs_node_created_rev
-svn_fs_node_prop
-svn_fs_props_changed
-svn_fs_revision_prop
-svn_fs_revision_root
-svn_fs_txn_root
-svn_fs_youngest_rev
-svn_import
-svn_log
-svn_ls
-svn_mkdir
-svn_repos_create
-svn_repos_fs
-svn_repos_fs_begin_txn_for_commit
-svn_repos_fs_commit_txn
-svn_repos_hotcopy
-svn_repos_open
-svn_repos_recover
-svn_revert
-svn_status
-svn_update
-swf_actiongeturl
-swf_actiongotoframe
-swf_actiongotolabel
-swf_actionnextframe
-swf_actionplay
-swf_actionprevframe
-swf_actionsettarget
-swf_actionstop
-swf_actiontogglequality
-swf_actionwaitforframe
-swf_addbuttonrecord
-swf_addcolor
-swf_closefile
-swf_definebitmap
-swf_definefont
-swf_defineline
-swf_definepoly
-swf_definerect
-swf_definetext
-swf_endbutton
-swf_enddoaction
-swf_endshape
-swf_endsymbol
-swf_fontsize
-swf_fontslant
-swf_fonttracking
-swf_getbitmapinfo
-swf_getfontinfo
-swf_getframe
-swf_labelframe
-swf_lookat
-swf_modifyobject
-swf_mulcolor
-swf_nextid
-swf_oncondition
-swf_openfile
-swf_ortho
-swf_ortho2
-swf_perspective
-swf_placeobject
-swf_polarview
-swf_popmatrix
-swf_posround
-swf_pushmatrix
-swf_removeobject
-swf_rotate
-swf_scale
-swf_setfont
-swf_setframe
-swf_shapearc
-swf_shapecurveto
-swf_shapecurveto3
-swf_shapefillbitmapclip
-swf_shapefillbitmaptile
-swf_shapefilloff
-swf_shapefillsolid
-swf_shapelinesolid
-swf_shapelineto
-swf_shapemoveto
-swf_showframe
-swf_startbutton
-swf_startdoaction
-swf_startshape
-swf_startsymbol
-swf_textwidth
-swf_translate
-swf_viewport
-swish_construct
-swish_getmetalist
-swish_getpropertylist
-swish_prepare
-swish_query
-swishresult_getmetalist
-swishresult_stem
-swishresults_getparsedwords
-swishresults_getremovedstopwords
-swishresults_nextresult
-swishresults_seekresult
-swishsearch_execute
-swishsearch_resetlimit
-swishsearch_setlimit
-swishsearch_setphrasedelimiter
-swishsearch_setsort
-swishsearch_setstructure
-sybase_affected_rows
-sybase_close
-sybase_connect
-sybase_data_seek
-sybase_deadlock_retry_count
-sybase_fetch_array
-sybase_fetch_assoc
-sybase_fetch_field
-sybase_fetch_object
-sybase_fetch_row
-sybase_field_seek
-sybase_free_result
-sybase_get_last_message
-sybase_min_client_severity
-sybase_min_error_severity
-sybase_min_message_severity
-sybase_min_server_severity
-sybase_num_fields
-sybase_num_rows
-sybase_pconnect
-sybase_query
-sybase_result
-sybase_select_db
-sybase_set_message_handler
-sybase_unbuffered_query
-symlink
-sys_get_temp_dir
-sys_getloadavg
-syslog
-system
-tan
-tanh
-tcpwrap_check
-tempnam
-textdomain
-tidy_access_count
-tidy_clean_repair
-tidy_config_count
-tidy_construct
-tidy_diagnose
-tidy_error_count
-tidy_get_body
-tidy_get_config
-tidy_get_error_buffer
-tidy_get_head
-tidy_get_html
-tidy_get_html_ver
-tidy_get_opt_doc
-tidy_get_output
-tidy_get_release
-tidy_get_root
-tidy_get_status
-tidy_getopt
-tidy_is_xhtml
-tidy_is_xml
-tidy_load_config
-tidy_node_get_attr
-tidy_node_get_nodes
-tidy_node_next
-tidy_node_prev
-tidy_parse_file
-tidy_parse_string
-tidy_repair_file
-tidy_repair_string
-tidy_reset_config
-tidy_save_config
-tidy_set_encoding
-tidy_setopt
-tidy_warning_count
-tidynode_getparent
-tidynode_haschildren
-tidynode_hassiblings
-tidynode_isasp
-tidynode_iscomment
-tidynode_ishtml
-tidynode_isjste
-tidynode_isphp
-tidynode_istext
-time
-time_nanosleep
-time_sleep_until
-timezone_abbreviations_list
-timezone_identifiers_list
-timezone_location_get
-timezone_name_from_abbr
-timezone_name_get
-timezone_offset_get
-timezone_open
-timezone_transitions_get
-tmpfile
-token_get_all
-token_name
-touch
-trigger_error
-trim
-uasort
-ucfirst
-ucwords
-udm_add_search_limit
-udm_alloc_agent
-udm_alloc_agent_array
-udm_api_version
-udm_cat_list
-udm_cat_path
-udm_check_charset
-udm_check_stored
-udm_clear_search_limits
-udm_close_stored
-udm_crc32
-udm_errno
-udm_error
-udm_find
-udm_free_agent
-udm_free_ispell_data
-udm_free_res
-udm_get_doc_count
-udm_get_res_field
-udm_get_res_param
-udm_hash32
-udm_load_ispell_data
-udm_open_stored
-udm_set_agent_param
-uksort
-umask
-unicode_decode
-unicode_encode
-unicode_get_error_mode
-unicode_get_subst_char
-unicode_set_error_mode
-unicode_set_subst_char
-uniqid
-unixtojd
-unlink
-unpack
-unregister_tick_function
-unserialize
-unset
-urldecode
-urlencode
-use_soap_error_handler
-user_error
-usleep
-usort
-utf8_decode
-utf8_encode
-var_dump
-var_export
-variant_abs
-variant_add
-variant_and
-variant_cast
-variant_cat
-variant_cmp
-variant_date_from_timestamp
-variant_date_to_timestamp
-variant_div
-variant_eqv
-variant_fix
-variant_get_type
-variant_idiv
-variant_imp
-variant_int
-variant_mod
-variant_mul
-variant_neg
-variant_not
-variant_or
-variant_pow
-variant_round
-variant_set
-variant_set_type
-variant_sub
-variant_xor
-version_compare
-vfprintf
-virtual
-vpopmail_add_alias_domain
-vpopmail_add_alias_domain_ex
-vpopmail_add_domain
-vpopmail_add_domain_ex
-vpopmail_add_user
-vpopmail_alias_add
-vpopmail_alias_del
-vpopmail_alias_del_domain
-vpopmail_alias_get
-vpopmail_alias_get_all
-vpopmail_auth_user
-vpopmail_del_domain
-vpopmail_del_domain_ex
-vpopmail_del_user
-vpopmail_error
-vpopmail_passwd
-vpopmail_set_user_quota
-vprintf
-vsprintf
-w32api_deftype
-w32api_init_dtype
-w32api_invoke_function
-w32api_register_function
-w32api_set_call_method
-wddx_add_vars
-wddx_deserialize
-wddx_packet_end
-wddx_packet_start
-wddx_serialize_value
-wddx_serialize_vars
-wddx_unserialize
-win32_create_service
-win32_delete_service
-win32_get_last_control_message
-win32_ps_list_procs
-win32_ps_stat_mem
-win32_ps_stat_proc
-win32_query_service_status
-win32_set_service_status
-win32_start_service
-win32_start_service_ctrl_dispatcher
-win32_stop_service
-wordwrap
-xattr_get
-xattr_list
-xattr_remove
-xattr_set
-xattr_supported
-xdiff_file_bdiff
-xdiff_file_bdiff_size
-xdiff_file_bpatch
-xdiff_file_diff
-xdiff_file_diff_binary
-xdiff_file_merge3
-xdiff_file_patch
-xdiff_file_patch_binary
-xdiff_file_rabdiff
-xdiff_string_bdiff
-xdiff_string_bdiff_size
-xdiff_string_bpatch
-xdiff_string_diff
-xdiff_string_diff_binary
-xdiff_string_merge3
-xdiff_string_patch
-xdiff_string_patch_binary
-xdiff_string_rabdiff
-xml_error_string
-xml_get_current_byte_index
-xml_get_current_column_number
-xml_get_current_line_number
-xml_get_error_code
-xml_parse
-xml_parse_into_struct
-xml_parser_create
-xml_parser_create_ns
-xml_parser_free
-xml_parser_get_option
-xml_parser_set_option
-xml_set_character_data_handler
-xml_set_default_handler
-xml_set_element_handler
-xml_set_end_namespace_decl_handler
-xml_set_external_entity_ref_handler
-xml_set_notation_decl_handler
-xml_set_object
-xml_set_processing_instruction_handler
-xml_set_start_namespace_decl_handler
-xml_set_unparsed_entity_decl_handler
-xmlrpc_decode
-xmlrpc_decode_request
-xmlrpc_encode
-xmlrpc_encode_request
-xmlrpc_get_type
-xmlrpc_is_fault
-xmlrpc_parse_method_descriptions
-xmlrpc_server_add_introspection_data
-xmlrpc_server_call_method
-xmlrpc_server_create
-xmlrpc_server_destroy
-xmlrpc_server_register_introspection_callback
-xmlrpc_server_register_method
-xmlrpc_set_type
-xmlwriter_end_attribute
-xmlwriter_end_cdata
-xmlwriter_end_comment
-xmlwriter_end_document
-xmlwriter_end_dtd
-xmlwriter_end_dtd_attlist
-xmlwriter_end_dtd_element
-xmlwriter_end_dtd_entity
-xmlwriter_end_element
-xmlwriter_end_pi
-xmlwriter_flush
-xmlwriter_full_end_element
-xmlwriter_open_memory
-xmlwriter_open_uri
-xmlwriter_output_memory
-xmlwriter_set_indent
-xmlwriter_set_indent_string
-xmlwriter_start_attribute
-xmlwriter_start_attribute_ns
-xmlwriter_start_cdata
-xmlwriter_start_comment
-xmlwriter_start_document
-xmlwriter_start_dtd
-xmlwriter_start_dtd_attlist
-xmlwriter_start_dtd_element
-xmlwriter_start_dtd_entity
-xmlwriter_start_element
-xmlwriter_start_element_ns
-xmlwriter_start_pi
-xmlwriter_text
-xmlwriter_write_attribute
-xmlwriter_write_attribute_ns
-xmlwriter_write_cdata
-xmlwriter_write_comment
-xmlwriter_write_dtd
-xmlwriter_write_dtd_attlist
-xmlwriter_write_dtd_element
-xmlwriter_write_dtd_entity
-xmlwriter_write_element
-xmlwriter_write_element_ns
-xmlwriter_write_pi
-xmlwriter_write_raw
-xpath_eval
-xpath_eval_expression
-xpath_new_context
-xpath_register_ns
-xpath_register_ns_auto
-xptr_eval
-xptr_new_context
-xslt_backend_info
-xslt_backend_name
-xslt_backend_version
-xslt_create
-xslt_errno
-xslt_error
-xslt_free
-xslt_getopt
-xslt_process
-xslt_set_base
-xslt_set_encoding
-xslt_set_error_handler
-xslt_set_log
-xslt_set_object
-xslt_set_sax_handler
-xslt_set_sax_handlers
-xslt_set_scheme_handler
-xslt_set_scheme_handlers
-xslt_setopt
-yaz_addinfo
-yaz_ccl_conf
-yaz_ccl_parse
-yaz_close
-yaz_connect
-yaz_database
-yaz_element
-yaz_errno
-yaz_error
-yaz_es
-yaz_es_result
-yaz_get_option
-yaz_hits
-yaz_itemorder
-yaz_present
-yaz_range
-yaz_record
-yaz_scan
-yaz_scan_result
-yaz_schema
-yaz_search
-yaz_set_option
-yaz_sort
-yaz_syntax
-yaz_wait
-yp_all
-yp_cat
-yp_err_string
-yp_errno
-yp_first
-yp_get_default_domain
-yp_master
-yp_match
-yp_next
-yp_order
-zend_logo_guid
-zend_thread_id
-zend_version
-zip_close
-zip_entry_close
-zip_entry_compressedsize
-zip_entry_compressionmethod
-zip_entry_filesize
-zip_entry_name
-zip_entry_open
-zip_entry_read
-zip_open
-zip_read
-ziparchive_addemptydir
-ziparchive_addfile
-ziparchive_addfromstring
-ziparchive_close
-ziparchive_deleteindex
-ziparchive_deletename
-ziparchive_extractto
-ziparchive_getarchivecomment
-ziparchive_getcommentindex
-ziparchive_getcommentname
-ziparchive_getfromindex
-ziparchive_getfromname
-ziparchive_getnameindex
-ziparchive_getstream
-ziparchive_locatename
-ziparchive_open
-ziparchive_renameindex
-ziparchive_renamename
-ziparchive_setCommentName
-ziparchive_setarchivecomment
-ziparchive_setcommentindex
-ziparchive_statindex
-ziparchive_statname
-ziparchive_unchangeall
-ziparchive_unchangearchive
-ziparchive_unchangeindex
-ziparchive_unchangename
-zlib_get_coding_type
diff --git a/etc/todo/scanners/php_builtin_functions_core.txt b/etc/todo/scanners/php_builtin_functions_core.txt
deleted file mode 100644
index a90f3d2..0000000
--- a/etc/todo/scanners/php_builtin_functions_core.txt
+++ /dev/null
@@ -1,526 +0,0 @@
-abs
-acos
-acosh
-addcslashes
-addslashes
-aggregate
-array
-arsort
-ascii2ebcdic
-asin
-asinh
-asort
-assert
-atan
-atan2
-atanh
-basename
-bcadd
-bccomp
-bcdiv
-bcmod
-bcmul
-bcpow
-bcpowmod
-bcscale
-bcsqrt
-bcsub
-bin2hex
-bindec
-bindtextdomain
-bzclose
-bzcompress
-bzdecompress
-bzerrno
-bzerror
-bzerrstr
-bzflush
-bzopen
-bzread
-bzwrite
-calculhmac
-ceil
-chdir
-checkdate
-checkdnsrr
-chgrp
-chmod
-chop
-chown
-chr
-chroot
-clearstatcache
-closedir
-closelog
-compact
-constant
-copy
-cos
-cosh
-count
-crc32
-crypt
-current
-date
-dcgettext
-dcngettext
-deaggregate
-decbin
-dechex
-decoct
-define
-defined
-deg2rad
-delete
-dgettext
-die
-dirname
-diskfreespace
-dl
-dngettext
-doubleval
-each
-ebcdic2ascii
-echo
-empty
-end
-ereg
-eregi
-escapeshellarg
-escapeshellcmd
-eval
-exec
-exit
-exp
-explode
-expm1
-extract
-fclose
-feof
-fflush
-fgetc
-fgetcsv
-fgets
-fgetss
-file
-fileatime
-filectime
-filegroup
-fileinode
-filemtime
-fileowner
-fileperms
-filepro
-filesize
-filetype
-floatval
-flock
-floor
-flush
-fmod
-fnmatch
-fopen
-fpassthru
-fprintf
-fputcsv
-fputs
-fread
-frenchtojd
-fscanf
-fseek
-fsockopen
-fstat
-ftell
-ftok
-ftruncate
-fwrite
-getallheaders
-getcwd
-getdate
-getenv
-gethostbyaddr
-gethostbyname
-gethostbynamel
-getimagesize
-getlastmod
-getmxrr
-getmygid
-getmyinode
-getmypid
-getmyuid
-getopt
-getprotobyname
-getprotobynumber
-getrandmax
-getrusage
-getservbyname
-getservbyport
-gettext
-gettimeofday
-gettype
-glob
-gmdate
-gmmktime
-gmstrftime
-gregoriantojd
-gzclose
-gzcompress
-gzdecode
-gzdeflate
-gzencode
-gzeof
-gzfile
-gzgetc
-gzgets
-gzgetss
-gzinflate
-gzopen
-gzpassthru
-gzputs
-gzread
-gzrewind
-gzseek
-gztell
-gzuncompress
-gzwrite
-hash
-header
-hebrev
-hebrevc
-hexdec
-htmlentities
-htmlspecialchars
-hypot
-iconv
-idate
-image2wbmp
-imagealphablending
-imageantialias
-imagearc
-imagechar
-imagecharup
-imagecolorallocate
-imagecolorallocatealpha
-imagecolorat
-imagecolorclosest
-imagecolorclosestalpha
-imagecolorclosesthwb
-imagecolordeallocate
-imagecolorexact
-imagecolorexactalpha
-imagecolormatch
-imagecolorresolve
-imagecolorresolvealpha
-imagecolorset
-imagecolorsforindex
-imagecolorstotal
-imagecolortransparent
-imageconvolution
-imagecopy
-imagecopymerge
-imagecopymergegray
-imagecopyresampled
-imagecopyresized
-imagecreate
-imagecreatefromgd
-imagecreatefromgd2
-imagecreatefromgd2part
-imagecreatefromgif
-imagecreatefromjpeg
-imagecreatefrompng
-imagecreatefromstring
-imagecreatefromwbmp
-imagecreatefromxbm
-imagecreatefromxpm
-imagecreatetruecolor
-imagedashedline
-imagedestroy
-imageellipse
-imagefill
-imagefilledarc
-imagefilledellipse
-imagefilledpolygon
-imagefilledrectangle
-imagefilltoborder
-imagefilter
-imagefontheight
-imagefontwidth
-imageftbbox
-imagefttext
-imagegammacorrect
-imagegd
-imagegd2
-imagegif
-imagegrabscreen
-imagegrabwindow
-imageinterlace
-imageistruecolor
-imagejpeg
-imagelayereffect
-imageline
-imageloadfont
-imagepalettecopy
-imagepng
-imagepolygon
-imagepsbbox
-imagepsencodefont
-imagepsextendfont
-imagepsfreefont
-imagepsloadfont
-imagepsslantfont
-imagepstext
-imagerectangle
-imagerotate
-imagesavealpha
-imagesetbrush
-imagesetpixel
-imagesetstyle
-imagesetthickness
-imagesettile
-imagestring
-imagestringup
-imagesx
-imagesy
-imagetruecolortopalette
-imagettfbbox
-imagettftext
-imagetypes
-imagewbmp
-imagexbm
-implode
-include
-intval
-ip2long
-iptcembed
-iptcparse
-isset
-jddayofweek
-jdmonthname
-jdtofrench
-jdtogregorian
-jdtojewish
-jdtojulian
-jdtounix
-jewishtojd
-join
-jpeg2wbmp
-juliantojd
-key
-krsort
-ksort
-lcfirst
-lchgrp
-lchown
-levenshtein
-link
-linkinfo
-list
-localeconv
-localtime
-log
-log10
-log1p
-long2ip
-lstat
-ltrim
-mail
-main
-max
-md5
-metaphone
-mhash
-microtime
-min
-mkdir
-mktime
-msql
-natcasesort
-natsort
-next
-ngettext
-nl2br
-nthmac
-ocibindbyname
-ocicancel
-ocicloselob
-ocicollappend
-ocicollassign
-ocicollassignelem
-ocicollgetelem
-ocicollmax
-ocicollsize
-ocicolltrim
-ocicolumnisnull
-ocicolumnname
-ocicolumnprecision
-ocicolumnscale
-ocicolumnsize
-ocicolumntype
-ocicolumntyperaw
-ocicommit
-ocidefinebyname
-ocierror
-ociexecute
-ocifetch
-ocifetchinto
-ocifetchstatement
-ocifreecollection
-ocifreecursor
-ocifreedesc
-ocifreestatement
-ociinternaldebug
-ociloadlob
-ocilogoff
-ocilogon
-ocinewcollection
-ocinewcursor
-ocinewdescriptor
-ocinlogon
-ocinumcols
-ociparse
-ociplogon
-ociresult
-ocirollback
-ocirowcount
-ocisavelob
-ocisavelobfile
-ociserverversion
-ocisetprefetch
-ocistatementtype
-ociwritelobtofile
-ociwritetemporarylob
-octdec
-opendir
-openlog
-ord
-overload
-pack
-passthru
-pathinfo
-pclose
-pfsockopen
-phpcredits
-phpinfo
-phpversion
-pi
-png2wbmp
-popen
-pos
-pow
-prev
-print
-printf
-putenv
-quotemeta
-rad2deg
-rand
-range
-rawurldecode
-rawurlencode
-readdir
-readfile
-readgzfile
-readline
-readlink
-realpath
-recode
-rename
-require
-reset
-return
-rewind
-rewinddir
-rmdir
-round
-rsort
-rtrim
-scandir
-serialize
-setcookie
-setlocale
-setrawcookie
-settype
-sha1
-shuffle
-signeurlpaiement
-sin
-sinh
-sizeof
-sleep
-snmpget
-snmpgetnext
-snmprealwalk
-snmpset
-snmpwalk
-snmpwalkoid
-sort
-soundex
-split
-spliti
-sprintf
-sqrt
-srand
-sscanf
-stat
-strcasecmp
-strchr
-strcmp
-strcoll
-strcspn
-strftime
-stripcslashes
-stripos
-stripslashes
-stristr
-strlen
-strnatcasecmp
-strnatcmp
-strncasecmp
-strncmp
-strpbrk
-strpos
-strptime
-strrchr
-strrev
-strripos
-strrpos
-strspn
-strstr
-strtok
-strtolower
-strtotime
-strtoupper
-strtr
-strval
-substr
-symlink
-syslog
-system
-tan
-tanh
-tempnam
-textdomain
-time
-tmpfile
-touch
-trim
-uasort
-ucfirst
-ucwords
-uksort
-umask
-uniqid
-unixtojd
-unlink
-unpack
-unserialize
-unset
-urldecode
-urlencode
-usleep
-usort
-vfprintf
-virtual
-vprintf
-vsprintf
-wordwrap
diff --git a/etc/todo/scanners/ruby-inside-regexp-detection.rb b/etc/todo/scanners/ruby-inside-regexp-detection.rb
deleted file mode 100644
index c68611a..0000000
--- a/etc/todo/scanners/ruby-inside-regexp-detection.rb
+++ /dev/null
@@ -1,455 +0,0 @@
-module CodeRay
-module Scanners
-
- # This scanner is really complex, since Ruby _is_ a complex language!
- #
- # It tries to highlight 100% of all common code,
- # and 90% of strange codes.
- #
- # It is optimized for HTML highlighting, and is not very useful for
- # parsing or pretty printing.
- #
- # For now, I think it's better than the scanners in VIM or Syntax, or
- # any highlighter I was able to find, except Caleb's RubyLexer.
- #
- # I hope it's also better than the rdoc/irb lexer.
- #
- # Alias: +irb+
- class Ruby < Scanner
-
- register_for :ruby
- file_extension 'rb'
-
- helper :patterns
-
- unless defined? EncodingError
- EncodingError = Class.new Exception # :nodoc:
- end
-
- protected
-
- def setup
- @state = :initial
- end
-
- def scan_tokens encoder, options
-
- patterns = Patterns # avoid constant lookup
-
- state = @state
- if state.instance_of? patterns::StringState
- encoder.begin_group state.type
- end
-
- last_state = nil
-
- method_call_expected = false
- value_expected = true
-
- heredocs = nil
- inline_block_stack = nil
- inline_block_curly_depth = 0
-
- # def_object_stack = nil
- # def_object_paren_depth = 0
-
- unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8'
-
- until eos?
-
- if state.instance_of? patterns::StringState
-
- match = scan_until(state.pattern) || scan_until(/\z/)
- encoder.text_token match, :content unless match.empty?
- break if eos?
-
- if state.heredoc and self[1] # end of heredoc
- match = getch.to_s
- match << scan_until(/$/) unless eos?
- encoder.text_token match, :delimiter
- encoder.end_group state.type
- state = state.next_state
- next
- end
-
- case match = getch
-
- when state.delim
- if state.paren_depth
- state.paren_depth -= 1
- if state.paren_depth > 0
- encoder.text_token match, :nesting_delimiter
- next
- end
- end
- encoder.text_token match, :delimiter
- if state.type == :regexp and not eos?
- modifiers = scan(/#{patterns::REGEXP_MODIFIERS}/ox)
- encoder.text_token modifiers, :modifier unless modifiers.empty?
- end
- encoder.end_group state.type
- value_expected = false
- state = state.next_state
-
- when '\\'
- if state.interpreted
- if esc = scan(/ #{patterns::ESCAPE} /ox)
- encoder.text_token match + esc, :char
- else
- encoder.text_token match, :error
- end
- else
- case m = getch
- when state.delim, '\\'
- encoder.text_token match + m, :char
- when nil
- encoder.text_token match, :content
- else
- encoder.text_token match + m, :content
- end
- end
-
- when '#'
- case peek(1)
- when '{'
- inline_block_stack ||= []
- inline_block_stack << [state, inline_block_curly_depth, heredocs]
- value_expected = true
- state = :initial
- inline_block_curly_depth = 1
- encoder.begin_group :inline
- encoder.text_token match + getch, :inline_delimiter
- when '$', '@'
- encoder.text_token match, :escape
- last_state = state
- state = :initial
- else
- raise_inspect 'else-case # reached; #%p not handled' %
- [peek(1)], encoder
- end
-
- when state.opening_paren
- state.paren_depth += 1
- encoder.text_token match, :nesting_delimiter
-
- when /#{patterns::REGEXP_SYMBOLS}/ox
- encoder.text_token match, :function
-
- else
- raise_inspect 'else-case " reached; %p not handled, state = %p' %
- [match, state], encoder
-
- end
-
- else
-
- if match = scan(/[ \t\f]+/)
- match << scan(/\s*/) unless eos? || heredocs
- value_expected = true if match.index(?\n)
- encoder.text_token match, :space
-
- elsif match = scan(/\\?\n/)
- if match == "\n"
- value_expected = true
- state = :initial if state == :undef_comma_expected
- end
- if heredocs
- unscan # heredoc scanning needs \n at start
- state = heredocs.shift
- encoder.begin_group state.type
- heredocs = nil if heredocs.empty?
- next
- else
- match << scan(/\s*/) unless eos?
- end
- encoder.text_token match, :space
-
- elsif bol? && match = scan(/\#!.*/)
- encoder.text_token match, :doctype
-
- elsif match = scan(/\#.*/) or
- (bol? and match = scan(/#{patterns::RUBYDOC_OR_DATA}/o))
- encoder.text_token match, :comment
-
- elsif state == :initial
-
- # IDENTS #
- if !method_call_expected and
- match = scan(unicode ? /#{patterns::METHOD_NAME}/uo :
- /#{patterns::METHOD_NAME}/o)
- value_expected = false
- kind = patterns::IDENT_KIND[match]
- if kind == :ident
- if match[/^[A-Z]/] && !match[/[!?]$/] && !match?(/\(/)
- kind = :constant
- end
- elsif kind == :reserved
- state = patterns::KEYWORD_NEW_STATE[match]
- value_expected = true if patterns::KEYWORDS_EXPECTING_VALUE[match]
- end
- value_expected = true if !value_expected && check(/#{patterns::VALUE_FOLLOWS}/o)
- encoder.text_token match, kind
-
- elsif method_call_expected and
- match = scan(unicode ? /#{patterns::METHOD_AFTER_DOT}/uo :
- /#{patterns::METHOD_AFTER_DOT}/o)
- if method_call_expected == '::' && match[/^[A-Z]/] && !match?(/\(/)
- encoder.text_token match, :constant
- else
- encoder.text_token match, :ident
- end
- method_call_expected = false
- value_expected = check(/#{patterns::VALUE_FOLLOWS}/o)
-
- # OPERATORS #
- elsif not method_call_expected and match = scan(/ \.\.\.? | (\.|::) | [,\(\)\[\]\{\}] | ==?=? /x)
- value_expected = match !~ / [.\)\]\}] /x || match =~ /\A\.\./
- method_call_expected = self[1]
- if inline_block_stack
- case match
- when '{'
- inline_block_curly_depth += 1
- when '}'
- inline_block_curly_depth -= 1
- if inline_block_curly_depth == 0 # closing brace of inline block reached
- state, inline_block_curly_depth, heredocs = inline_block_stack.pop
- inline_block_stack = nil if inline_block_stack.empty?
- heredocs = nil if heredocs && heredocs.empty?
- encoder.text_token match, :inline_delimiter
- encoder.end_group :inline
- next
- end
- end
- end
- encoder.text_token match, :operator
-
- elsif match = scan(/ ['"] /mx)
- encoder.begin_group :string
- encoder.text_token match, :delimiter
- state = patterns::StringState.new :string, match == '"', match # important for streaming
-
- elsif match = scan(unicode ? /#{patterns::INSTANCE_VARIABLE}/uo :
- /#{patterns::INSTANCE_VARIABLE}/o)
- value_expected = false
- encoder.text_token match, :instance_variable
-
- elsif value_expected and match?(/\//)
- encoder.begin_group :regexp
- if match?(/\/#{patterns::REGEXP_MODIFIERS}x#{patterns::REGEXP_MODIFIERS}[ \t]*(?:\n|#|\z|[,\)\]])/o)
- # most likely a false positive, the end of an extended regexp
- # so ignore this one and pretend we're inside the regexp
- else
- encoder.text_token getch, :delimiter
- end
- interpreted = true
- state = patterns::StringState.new :regexp, interpreted, '/'
-
- elsif match = scan(value_expected ? /[-+]?#{patterns::NUMERIC}/o : /#{patterns::NUMERIC}/o)
- if method_call_expected
- encoder.text_token match, :error
- method_call_expected = false
- else
- encoder.text_token match, self[1] ? :float : :integer
- end
- value_expected = false
-
- elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo :
- /#{patterns::SYMBOL}/o)
- case delim = match[1]
- when ?', ?"
- encoder.begin_group :symbol
- encoder.text_token ':', :symbol
- match = delim.chr
- encoder.text_token match, :delimiter
- state = patterns::StringState.new :symbol, delim == ?", match
- else
- encoder.text_token match, :symbol
- value_expected = false
- end
-
- elsif match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)
- value_expected = true
- encoder.text_token match, :operator
-
- elsif value_expected and match = scan(/#{patterns::HEREDOC_OPEN}/o)
- indented = self[1] == '-'
- quote = self[3]
- delim = self[quote ? 4 : 2]
- kind = patterns::QUOTE_TO_TYPE[quote]
- encoder.begin_group kind
- encoder.text_token match, :delimiter
- encoder.end_group kind
- heredoc = patterns::StringState.new kind, quote != '\'',
- delim, (indented ? :indented : :linestart )
- heredocs ||= [] # create heredocs if empty
- heredocs << heredoc
- value_expected = false
-
- elsif value_expected and match = scan(/#{patterns::FANCY_START}/o)
- kind, interpreted = *patterns::FancyStringType.fetch(self[1]) do
- raise_inspect 'Unknown fancy string: %%%p' % k, encoder
- end
- encoder.begin_group kind
- state = patterns::StringState.new kind, interpreted, self[2]
- encoder.text_token match, :delimiter
-
- elsif value_expected and match = scan(/#{patterns::CHARACTER}/o)
- value_expected = false
- encoder.text_token match, :integer
-
- elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
- value_expected = true
- encoder.text_token match, :operator
-
- elsif match = scan(/`/)
- if method_call_expected
- encoder.text_token match, :operator
- value_expected = true
- else
- encoder.begin_group :shell
- encoder.text_token match, :delimiter
- state = patterns::StringState.new :shell, true, match
- end
-
- elsif match = scan(unicode ? /#{patterns::GLOBAL_VARIABLE}/uo :
- /#{patterns::GLOBAL_VARIABLE}/o)
- encoder.text_token match, :global_variable
- value_expected = false
-
- elsif match = scan(unicode ? /#{patterns::CLASS_VARIABLE}/uo :
- /#{patterns::CLASS_VARIABLE}/o)
- encoder.text_token match, :class_variable
- value_expected = false
-
- elsif match = scan(/\\\z/)
- encoder.text_token match, :space
-
- else
- if method_call_expected
- method_call_expected = false
- next
- end
- if !unicode
- # check for unicode
- debug, $DEBUG = $DEBUG, false
- begin
- if check(/./mu).size > 1
- # seems like we should try again with unicode
- unicode = true
- end
- rescue
- # bad unicode char; use getch
- ensure
- $DEBUG = debug
- end
- next if unicode
- end
-
- encoder.text_token getch, :error
-
- end
-
- if last_state
- state = last_state
- last_state = nil
- end
-
- elsif state == :def_expected
- if match = scan(unicode ? /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/uo :
- /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/o)
- encoder.text_token match, :method
- state = :initial
- else
- last_state = :dot_expected
- state = :initial
- end
-
- elsif state == :dot_expected
- if match = scan(/\.|::/)
- # invalid definition
- state = :def_expected
- encoder.text_token match, :operator
- else
- state = :initial
- end
-
- elsif state == :module_expected
- if match = scan(/<</)
- encoder.text_token match, :operator
- else
- state = :initial
- if match = scan(unicode ? / (?:#{patterns::IDENT}::)* #{patterns::IDENT} /oux :
- / (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox)
- encoder.text_token match, :class
- end
- end
-
- elsif state == :undef_expected
- state = :undef_comma_expected
- if match = scan(unicode ? /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/uo :
- /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/o)
- encoder.text_token match, :method
- elsif match = scan(/#{patterns::SYMBOL}/o)
- case delim = match[1]
- when ?', ?"
- encoder.begin_group :symbol
- encoder.text_token ':', :symbol
- match = delim.chr
- encoder.text_token match, :delimiter
- state = patterns::StringState.new :symbol, delim == ?", match
- state.next_state = :undef_comma_expected
- else
- encoder.text_token match, :symbol
- end
- else
- state = :initial
- end
-
- elsif state == :undef_comma_expected
- if match = scan(/,/)
- encoder.text_token match, :operator
- state = :undef_expected
- else
- state = :initial
- end
-
- elsif state == :alias_expected
- match = scan(unicode ? /(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/uo :
- /(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/o)
-
- if match
- encoder.text_token self[1], (self[1][0] == ?: ? :symbol : :method)
- encoder.text_token self[2], :space
- encoder.text_token self[3], (self[3][0] == ?: ? :symbol : :method)
- end
- state = :initial
-
- else
- raise_inspect 'Unknown state: %p' % [state], encoder
- end
-
- end
- end
-
- # cleaning up
- if options[:keep_state]
- @state = state
- end
- if state.is_a? patterns::StringState
- encoder.end_group state.type
- end
- if inline_block_stack
- until inline_block_stack.empty?
- state, *more = inline_block_stack.pop
- encoder.end_group :inline if more
- encoder.end_group state.type
- end
- end
-
- encoder
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/scheme.rb b/etc/todo/scanners/scheme.rb
deleted file mode 100644
index 59595cd..0000000
--- a/etc/todo/scanners/scheme.rb
+++ /dev/null
@@ -1,136 +0,0 @@
-module CodeRay
- module Scanners
-
- # Scheme scanner for CodeRay (by closure).
- #
- # Thanks to murphy for putting CodeRay into public.
- class Scheme < Scanner
-
- # TODO: function defs
- # TODO: built-in functions
-
- register_for :scheme
- file_extension 'scm'
-
- CORE_FORMS = %w[
- lambda let let* letrec syntax-case define-syntax let-syntax
- letrec-syntax begin define quote if or and cond case do delay
- quasiquote set! cons force call-with-current-continuation call/cc
- ] # :nodoc:
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(CORE_FORMS, :keyword) # :nodoc:
-
- #IDENTIFIER_INITIAL = /[a-z!@\$%&\*\/\:<=>\?~_\^]/i
- #IDENTIFIER_SUBSEQUENT = /#{IDENTIFIER_INITIAL}|\d|\.|\+|-/
- #IDENTIFIER = /#{IDENTIFIER_INITIAL}#{IDENTIFIER_SUBSEQUENT}*|\+|-|\.{3}/
- IDENTIFIER = /[a-zA-Z!@$%&*\/:<=>?~_^][\w!@$%&*\/:<=>?~^.+\-]*|[+-]|\.\.\./ # :nodoc:
- DIGIT = /\d/ # :nodoc:
- DIGIT10 = /\d/ # :nodoc:
- DIGIT16 = /[0-9a-f]/i # :nodoc:
- DIGIT8 = /[0-7]/ # :nodoc:
- DIGIT2 = /[01]/ # :nodoc:
- RADIX16 = /\#x/i # :nodoc:
- RADIX8 = /\#o/i # :nodoc:
- RADIX2 = /\#b/i # :nodoc:
- RADIX10 = /\#d/i # :nodoc:
- EXACTNESS = /#i|#e/i # :nodoc:
- SIGN = /[\+-]?/ # :nodoc:
- EXP_MARK = /[esfdl]/i # :nodoc:
- EXP = /#{EXP_MARK}#{SIGN}#{DIGIT}+/ # :nodoc:
- SUFFIX = /#{EXP}?/ # :nodoc:
- PREFIX10 = /#{RADIX10}?#{EXACTNESS}?|#{EXACTNESS}?#{RADIX10}?/ # :nodoc:
- PREFIX16 = /#{RADIX16}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX16}/ # :nodoc:
- PREFIX8 = /#{RADIX8}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX8}/ # :nodoc:
- PREFIX2 = /#{RADIX2}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX2}/ # :nodoc:
- UINT10 = /#{DIGIT10}+#*/ # :nodoc:
- UINT16 = /#{DIGIT16}+#*/ # :nodoc:
- UINT8 = /#{DIGIT8}+#*/ # :nodoc:
- UINT2 = /#{DIGIT2}+#*/ # :nodoc:
- DECIMAL = /#{DIGIT10}+#+\.#*#{SUFFIX}|#{DIGIT10}+\.#{DIGIT10}*#*#{SUFFIX}|\.#{DIGIT10}+#*#{SUFFIX}|#{UINT10}#{EXP}/ # :nodoc:
- UREAL10 = /#{UINT10}\/#{UINT10}|#{DECIMAL}|#{UINT10}/ # :nodoc:
- UREAL16 = /#{UINT16}\/#{UINT16}|#{UINT16}/ # :nodoc:
- UREAL8 = /#{UINT8}\/#{UINT8}|#{UINT8}/ # :nodoc:
- UREAL2 = /#{UINT2}\/#{UINT2}|#{UINT2}/ # :nodoc:
- REAL10 = /#{SIGN}#{UREAL10}/ # :nodoc:
- REAL16 = /#{SIGN}#{UREAL16}/ # :nodoc:
- REAL8 = /#{SIGN}#{UREAL8}/ # :nodoc:
- REAL2 = /#{SIGN}#{UREAL2}/ # :nodoc:
- IMAG10 = /i|#{UREAL10}i/ # :nodoc:
- IMAG16 = /i|#{UREAL16}i/ # :nodoc:
- IMAG8 = /i|#{UREAL8}i/ # :nodoc:
- IMAG2 = /i|#{UREAL2}i/ # :nodoc:
- COMPLEX10 = /#{REAL10}@#{REAL10}|#{REAL10}\+#{IMAG10}|#{REAL10}-#{IMAG10}|\+#{IMAG10}|-#{IMAG10}|#{REAL10}/ # :nodoc:
- COMPLEX16 = /#{REAL16}@#{REAL16}|#{REAL16}\+#{IMAG16}|#{REAL16}-#{IMAG16}|\+#{IMAG16}|-#{IMAG16}|#{REAL16}/ # :nodoc:
- COMPLEX8 = /#{REAL8}@#{REAL8}|#{REAL8}\+#{IMAG8}|#{REAL8}-#{IMAG8}|\+#{IMAG8}|-#{IMAG8}|#{REAL8}/ # :nodoc:
- COMPLEX2 = /#{REAL2}@#{REAL2}|#{REAL2}\+#{IMAG2}|#{REAL2}-#{IMAG2}|\+#{IMAG2}|-#{IMAG2}|#{REAL2}/ # :nodoc:
- NUM10 = /#{PREFIX10}?#{COMPLEX10}/ # :nodoc:
- NUM16 = /#{PREFIX16}#{COMPLEX16}/ # :nodoc:
- NUM8 = /#{PREFIX8}#{COMPLEX8}/ # :nodoc:
- NUM2 = /#{PREFIX2}#{COMPLEX2}/ # :nodoc:
- NUM = /#{NUM10}|#{NUM16}|#{NUM8}|#{NUM2}/ # :nodoc:
-
- protected
-
- def scan_tokens encoder, options
-
- state = :initial
- ident_kind = IDENT_KIND
-
- until eos?
-
- case state
- when :initial
- if match = scan(/ \s+ | \\\n /x)
- encoder.text_token match, :space
- elsif match = scan(/['\(\[\)\]]|#\(/)
- encoder.text_token match, :operator
- elsif match = scan(/;.*/)
- encoder.text_token match, :comment
- elsif match = scan(/#\\(?:newline|space|.?)/)
- encoder.text_token match, :char
- elsif match = scan(/#[ft]/)
- encoder.text_token match, :predefined_constant
- elsif match = scan(/#{IDENTIFIER}/o)
- encoder.text_token match, ident_kind[matched]
- elsif match = scan(/\./)
- encoder.text_token match, :operator
- elsif match = scan(/"/)
- encoder.begin_group :string
- encoder.text_token match, :delimiter
- state = :string
- elsif match = scan(/#{NUM}/o) and not matched.empty?
- encoder.text_token match, :integer
- else
- encoder.text_token getch, :error
- end
-
- when :string
- if match = scan(/[^"\\]+|\\.?/)
- encoder.text_token match, :content
- elsif match = scan(/"/)
- encoder.text_token match, :delimiter
- encoder.end_group :string
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1),
- encoder, state
- end
-
- else
- raise 'else case reached'
-
- end
-
- end
-
- if state == :string
- encoder.end_group state
- end
-
- encoder
-
- end
- end
- end
-end \ No newline at end of file
diff --git a/etc/todo/scanners/sql.Josh Goebel.rb b/etc/todo/scanners/sql.Josh Goebel.rb
deleted file mode 100644
index efa6990..0000000
--- a/etc/todo/scanners/sql.Josh Goebel.rb
+++ /dev/null
@@ -1,138 +0,0 @@
-# by Josh Goebel
-module CodeRay module Scanners
-
- class SQL < Scanner
-
- register_for :sql
-
- RESERVED_WORDS = [
- 'create','table','index','trigger','drop',
- 'primary','key',
- 'select','insert','update','vacuum','delete','merge','replace','truncate',
- 'into','on','from','values',
- 'after','before',
- 'and','or',
- 'count','min','max','group','order','by','avg',
- 'where','join','inner','outer','unique','union',
- 'transaction',
- 'begin','end',
- ]
-
- PREDEFINED_TYPES = [
- 'char','varchar','enum','set','binary',
- 'text','tinytext','mediumtext','longtext',
- 'blob','tinyblob','mediumblob','longblob',
- 'timestamp','date','time','datetime','year',
- 'double','decimal','float',
- 'int','integer','tinyint','mediumint','bigint',
- 'bit','bool','boolean'
- ]
-
- PREDEFINED_CONSTANTS = [
- 'null', 'true', 'false', 'not'
- ]
-
- SQL_KIND= CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- IDENT_KIND = WordList.new(:ident)
-
- ESCAPE = / [rbfnrtv\n\\\/'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
-
- state = :initial
- string_type = nil
-
- until eos?
-
- kind = :error
- match = nil
-
- if state == :initial
-
- if scan(/ ^ -- .* $ /x)
- kind = :comment
- elsif scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
- kind = :comment
-
- elsif match = scan(/ \# \s* if \s* 0 /x)
- match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos?
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%] | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = SQL_KIND[match.downcase]
- kind = IDENT_KIND[match] if kind.nil?
-
- elsif match = scan(/[`"']/)
- tokens << [:open, :string]
- string_type = matched
- state = :string
- kind = :delimiter
-
- elsif scan(/0[xX][0-9A-Fa-f]+/)
- kind = :hex
-
- elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :octal
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- end
-
- elsif state == :string
- if scan(/[^\\"'`]+/)
- kind = :content
- elsif scan(/["'`]/)
- if string_type==matched
- tokens << [matched, :delimiter]
- tokens << [:close, :string]
- state = :initial
- string_type=nil
- next
- else
- kind = :content
- end
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :content
- elsif scan(/ \\ | $ /x)
- kind = :error
- state = :initial
- else
- raise "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise 'else-case reached', tokens
-
- end
-
- match ||= matched
-# raise [match, kind], tokens if kind == :error
-
- tokens << [match, kind]
-
- end
-# RAILS_DEFAULT_LOGGER.info tokens.inspect
- tokens
-
- end
-
- end
-
-end end \ No newline at end of file
diff --git a/etc/todo/scanners/sql.Keith Pitt.rb b/etc/todo/scanners/sql.Keith Pitt.rb
deleted file mode 100644
index 8b0f90c..0000000
--- a/etc/todo/scanners/sql.Keith Pitt.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-module CodeRay
-module Scanners
-
- class SQL < Scanner
-
- register_for :sql
-
- include Streamable
-
- RESERVED_WORDS = %W(
- all alter and any as asc at authid avg begin between
- body bulk by case char check close cluster coalesce
- collect comment commit compress connect constant create
- current currval cursor day declare default delete
- desc distinct do drop else elsif end exception exclusive
- execute exists exit extends extract fetch for forall
- from function goto group having heap hour if immediate in
- index indicator insert interface intersect
- interval into is isolation java level like limited lock
- loop max min minus minute mlslabel mod mode month natural
- naturaln new nextval nocopy not nowait null nullif
- number_base ocirowid of on opaque open operator option or
- order organization others out package partition pctfree
- pls_integer positive positiven pragma prior private procedure
- public raise range raw real record ref release return reverse
- rollback row rowid rownum rowtype savepoint second select
- separate set share space sql sqlcode sqlerrm start
- stddev subtype successful sum synonym sysdate table then
- timezone_region timezone_abbr timezone_minute
- to trigger true type uid union unique update
- use user validate values variance view when
- whenever where while with work write year zone
- )
-
- PREDEFINED_TYPES = %W(
- array bigint bit binary blob boolean binary_integer char
- character clob date decimal double float char_base
- int integer nchar nclob smallint timestamp long number
- timestamp_hour timestamp_minute varchar varying smallint
- varchar2 nvarchar money time
- )
-
- PREDEFINED_CONSTANTS = %W(
- NULL true false'
- )
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = nil
- match = nil
-
- case state
-
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(%r! -- [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- if kind == :ident and check(/:(?!:)/)
- match << scan(/:/)
- kind = :label
- end
-
- elsif match = scan(/'/)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n']+/)
- kind = :content
- elsif scan(/'/)
- tokens << ["'", :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/sql.Keith.rb b/etc/todo/scanners/sql.Keith.rb
deleted file mode 100644
index a889902..0000000
--- a/etc/todo/scanners/sql.Keith.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-module CodeRay
-module Scanners
-
- # by Keith Pitt
- class SQL < Scanner
-
- register_for :sql
-
- include Streamable
-
- RESERVED_WORDS = %w(
- all alter and any as asc at authid avg begin between
- body bulk by case char check close cluster coalesce
- collect comment commit compress connect constant create
- current currval cursor day declare default delete
- desc distinct do drop else elsif end exception exclusive
- execute exists exit extends extract fetch for forall
- from function goto group having heap hour if immediate in
- index indicator insert interface intersect
- interval into is isolation java level like limited lock
- loop max min minus minute mlslabel mod mode month natural
- naturaln new nextval nocopy not nowait null nullif
- number_base ocirowid of on opaque open operator option or
- order organization others out package partition pctfree
- pls_integer positive positiven pragma prior private procedure
- public raise range raw real record ref release return reverse
- rollback row rowid rownum rowtype savepoint second select
- separate set share space sql sqlcode sqlerrm start
- stddev subtype successful sum synonym sysdate table then
- timezone_region timezone_abbr timezone_minute
- to trigger true type uid union unique update
- use user validate values variance view when
- whenever where while with work write year zone
- )
-
- PREDEFINED_TYPES = %w(
- array bigint bit binary blob boolean binary_integer char
- character clob date decimal double float char_base
- int integer nchar nclob smallint timestamp long number
- timestamp_hour timestamp_minute varchar varying smallint
- varchar2 nvarchar money time
- )
-
- PREDEFINED_CONSTANTS = %w(
- NULL true false
- )
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = nil
- match = nil
-
- case state
-
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(%r! -- [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match]
- if kind == :ident and check(/:(?!:)/)
- match << scan(/:/)
- kind = :label
- end
-
- elsif match = scan(/'/)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n']+/)
- kind = :content
- elsif scan(/'/)
- tokens << ["'", :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/vhdl.rb b/etc/todo/scanners/vhdl.rb
deleted file mode 100644
index 0086001..0000000
--- a/etc/todo/scanners/vhdl.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-module CodeRay
-module Scanners
-
- class VHDL < Scanner
-
- register_for :vhdl
-
- RESERVED_WORDS = [
- 'access','after','alias','all','assert','architecture','begin',
- 'block','body','buffer','bus','case','component','configuration','constant',
- 'disconnect','downto','else','elsif','end','entity','exit','file','for',
- 'function','generate','generic','group','guarded','if','impure','in',
- 'inertial','inout','is','label','library','linkage','literal','loop',
- 'map','new','next','null','of','on','open','others','out','package',
- 'port','postponed','procedure','process','pure','range','record','register',
- 'reject','report','return','select','severity','signal','shared','subtype',
- 'then','to','transport','type','unaffected','units','until','use','variable',
- 'wait','when','while','with','note','warning','error','failure','and',
- 'or','xor','not','nor',
- 'array'
- ]
-
- PREDEFINED_TYPES = [
- 'bit','bit_vector','character','boolean','integer','real','time','string',
- 'severity_level','positive','natural','signed','unsigned','line','text',
- 'std_logic','std_logic_vector','std_ulogic','std_ulogic_vector','qsim_state',
- 'qsim_state_vector','qsim_12state','qsim_12state_vector','qsim_strength',
- 'mux_bit','mux_vector','reg_bit','reg_vector','wor_bit','wor_vector'
- ]
-
- PREDEFINED_CONSTANTS = [
-
- ]
-
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- ESCAPE = / [rbfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = nil
- match = nil
-
- case state
-
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(/-- .*/x)
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match.downcase]
-
- elsif match = scan(/[a-z]?"/i)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
- kind = :char
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n"]+/)
- kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
-
- end
-
-end
-end
diff --git a/etc/todo/scanners/yaml.rb b/etc/todo/scanners/yaml.rb
deleted file mode 100644
index 53b052d..0000000
--- a/etc/todo/scanners/yaml.rb
+++ /dev/null
@@ -1,105 +0,0 @@
-require 'syntax'
-
-module Syntax
-
- # A simple implementation of an YAML lexer. It handles most cases. It is
- # not a validating lexer.
- class YAML < Tokenizer
-
- # Step through a single iteration of the tokenization process. This will
- # yield (potentially) many tokens, and possibly zero tokens.
- def step
- if bol?
- case
- when scan(/---(\s*.+)?$/)
- start_group :document, matched
- when scan(/(\s*)([a-zA-Z][-\w]*)(\s*):/)
- start_group :normal, subgroup(1)
- start_group :key, subgroup(2)
- start_group :normal, subgroup(3)
- start_group :punct, ":"
- when scan(/(\s*)-/)
- start_group :normal, subgroup(1)
- start_group :punct, "-"
- when scan(/\s*$/)
- start_group :normal, matched
- when scan(/#.*$/)
- start_group :comment, matched
- else
- append getch
- end
- else
- case
- when scan(/[\n\r]+/)
- start_group :normal, matched
- when scan(/[ \t]+/)
- start_group :normal, matched
- when scan(/!+(.*?^)?\S+/)
- start_group :type, matched
- when scan(/&\S+/)
- start_group :anchor, matched
- when scan(/\*\S+/)
- start_group :ref, matched
- when scan(/\d\d:\d\d:\d\d/)
- start_group :time, matched
- when scan(/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/)
- start_group :date, matched
- when scan(/['"]/)
- start_group :punct, matched
- scan_string matched
- when scan(/:\w+/)
- start_group :symbol, matched
- when scan(/[:]/)
- start_group :punct, matched
- when scan(/#.*$/)
- start_group :comment, matched
- when scan(/>-?/)
- start_group :punct, matched
- start_group :normal, scan(/.*$/)
- append getch until eos? || bol?
- return if eos?
- indent = check(/ */)
- start_group :string
- loop do
- line = check_until(/[\n\r]|\Z/)
- break if line.nil?
- if line.chomp.length > 0
- this_indent = line.chomp.match( /^\s*/ )[0]
- break if this_indent.length < indent.length
- end
- append scan_until(/[\n\r]|\Z/)
- end
- else
- start_group :normal, scan_until(/(?=$|#)/)
- end
- end
- end
-
- private
-
- def scan_string( delim )
- regex = /(?=[#{delim=="'" ? "" : "\\\\"}#{delim}])/
- loop do
- text = scan_until( regex )
- if text.nil?
- start_group :string, scan_until( /\Z/ )
- break
- else
- start_group :string, text unless text.empty?
- end
-
- case peek(1)
- when "\\"
- start_group :expr, scan(/../)
- else
- start_group :punct, getch
- break
- end
- end
- end
-
- end
-
- SYNTAX["yaml"] = YAML
-
-end
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/checkpoints/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/checkpoints/index.html
deleted file mode 100755
index a0a36d5..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/checkpoints/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs/checkpoints</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs/checkpoints</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/_darcs/">Parent Directory</a> -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html
deleted file mode 100755
index f6a7303..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="checkpoints/">checkpoints/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="inventories/">inventories/</a> 23-Sep-2006 21:34 -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="inventory">inventory</a> 28-Sep-2006 00:48 825
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="patches/">patches/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="prefs/">prefs/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="pristine/">pristine/</a> 23-Sep-2006 21:34 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=D;O=A
deleted file mode 100755
index df9ef0b..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=D;O=A
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="checkpoints/">checkpoints/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="inventories/">inventories/</a> 23-Sep-2006 21:34 -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="inventory">inventory</a> 28-Sep-2006 00:48 825
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="patches/">patches/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="prefs/">prefs/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="pristine/">pristine/</a> 23-Sep-2006 21:34 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=M;O=A
deleted file mode 100755
index 533958d..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=M;O=A
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="checkpoints/">checkpoints/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="inventories/">inventories/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="prefs/">prefs/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="pristine/">pristine/</a> 23-Sep-2006 21:34 -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="inventory">inventory</a> 28-Sep-2006 00:48 825
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="patches/">patches/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=N;O=D
deleted file mode 100755
index a175ae6..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=N;O=D
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="pristine/">pristine/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="prefs/">prefs/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="patches/">patches/</a> 28-Sep-2006 00:48 -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="inventory">inventory</a> 28-Sep-2006 00:48 825
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="inventories/">inventories/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="checkpoints/">checkpoints/</a> 23-Sep-2006 21:34 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=S;O=A
deleted file mode 100755
index 0ac3f12..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/index.html@C=S;O=A
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="checkpoints/">checkpoints/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="inventories/">inventories/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="patches/">patches/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="prefs/">prefs/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="pristine/">pristine/</a> 23-Sep-2006 21:34 -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="inventory">inventory</a> 28-Sep-2006 00:48 825
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventories/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventories/index.html
deleted file mode 100755
index f6d1d38..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventories/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs/inventories</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs/inventories</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/_darcs/">Parent Directory</a> -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventory b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventory
deleted file mode 100755
index a7a8470..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/inventory
+++ /dev/null
@@ -1,17 +0,0 @@
-[First version
-zoso@foton.es**20060923203447] [Add :wrap option to the LaTeX encoder
-zoso@foton.es**20060924125211]
-[Remove all non-alphanumeric characters from LaTeX commands
-zoso@foton.es**20060924143810]
-[Use \synbs instead of $\backslash$, seems to work better in verbatim
-zoso@foton.es**20060924143837]
-[Add a very basic Javascript scanner (adapted Ruby scanner)
-zoso@foton.es**20060924154208]
-[Improve LaTeX special character escaping
-zoso@foton.es**20060927233750
- * Rewrite Latex#escape_latex method, so it uses only one pass (avoids some
- escape-the-already-escaped-characters problems and it's probably faster)
- * Now backslashes are substituted by "\synbs{}", to avoid problems with letters
- that could be just after the \synbs, turning it into another, undefined
- command like "\synbsn" or something
-]
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/patches/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/patches/index.html
deleted file mode 100755
index 85ec1c7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/patches/index.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs/patches</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs/patches</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/_darcs/">Parent Directory</a> -
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060923203447-5140e-df04368a13906528ef99e9ab5718624532f05b31.gz">20060923203447-5140e-df04368a13906528ef99e9ab5718624532f05b31.gz</a> 23-Sep-2006 21:34 1.4K
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060924125211-5140e-ea83d35d45314665af86e1bd2eeda952f953dd43.gz">20060924125211-5140e-ea83d35d45314665af86e1bd2eeda952f953dd43.gz</a> 24-Sep-2006 13:52 702
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060924143810-5140e-a52edb9676be4736a6042e1607be7939e5ec3f28.gz">20060924143810-5140e-a52edb9676be4736a6042e1607be7939e5ec3f28.gz</a> 24-Sep-2006 15:39 250
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060924143837-5140e-880669c10c7a8b9e8e601724eccce9fff3917f44.gz">20060924143837-5140e-880669c10c7a8b9e8e601724eccce9fff3917f44.gz</a> 24-Sep-2006 15:39 432
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060924154208-5140e-8cc8c6fbe46d11ab2493b4206c8cc259c01bb883.gz">20060924154208-5140e-8cc8c6fbe46d11ab2493b4206c8cc259c01bb883.gz</a> 24-Sep-2006 16:58 3.3K
-<img src="/icons/compressed.gif" alt="[CMP]" /> <a href="20060927233750-5140e-589da45a369c268f1acb9fad63e9e3f3c8dd01b8.gz">20060927233750-5140e-589da45a369c268f1acb9fad63e9e3f3c8dd01b8.gz</a> 28-Sep-2006 00:48 795
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="pending">pending</a> 28-Sep-2006 00:48 4
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/prefs/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/prefs/index.html
deleted file mode 100755
index 5288084..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/prefs/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs/prefs</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs/prefs</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/_darcs/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="binaries">binaries</a> 23-Sep-2006 21:34 395
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="boring">boring</a> 23-Sep-2006 21:34 534
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="defaultrepo">defaultrepo</a> 23-Sep-2006 21:34 28
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="motd">motd</a> 23-Sep-2006 21:34 0
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="repos">repos</a> 23-Sep-2006 21:34 28
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/pristine/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/pristine/index.html
deleted file mode 100755
index 14bd055..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/_darcs/pristine/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/_darcs/pristine</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/_darcs/pristine</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/_darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/index.html
deleted file mode 100755
index d1b3aec..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=A
deleted file mode 100755
index 3cc4074..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=A
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=D
deleted file mode 100755
index 8f9e380..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=D;O=D
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=A
deleted file mode 100755
index 9606f9a..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=A
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=D
deleted file mode 100755
index 00a778c..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=M;O=D
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=A
deleted file mode 100755
index d1b3aec..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=A
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=D
deleted file mode 100755
index 8f9e380..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=N;O=D
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=A
deleted file mode 100755
index a191676..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=A
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=D
deleted file mode 100755
index 8f9e380..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/index.html@C=S;O=D
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="test/">test/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="lib/">lib/</a> 23-Sep-2006 21:34 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="_darcs/">_darcs/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html
deleted file mode 100755
index 7ebac3a..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/encoders</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/encoders</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="latex.rb">latex.rb</a> 28-Sep-2006 00:48 1.4K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=D;O=A
deleted file mode 100755
index 7c7a8c4..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=D;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/encoders</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/encoders</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="latex.rb">latex.rb</a> 28-Sep-2006 00:48 1.4K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=M;O=A
deleted file mode 100755
index 9d9cd59..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=M;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/encoders</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/encoders</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="latex.rb">latex.rb</a> 28-Sep-2006 00:48 1.4K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=N;O=D
deleted file mode 100755
index 339f519..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=N;O=D
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/encoders</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/encoders</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="latex.rb">latex.rb</a> 28-Sep-2006 00:48 1.4K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=S;O=A
deleted file mode 100755
index 0d5687f..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/index.html@C=S;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/encoders</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/encoders</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="latex.rb">latex.rb</a> 28-Sep-2006 00:48 1.4K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/latex.rb b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/latex.rb
deleted file mode 100755
index 0a54872..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/encoders/latex.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-module CodeRay
-module Encoders
-
- # = LaTeX Encoder
- #
- # Encoder producing LaTeX.
- class Latex < Encoder
-
- include Streamable
- register_for :latex
-
- FILE_EXTENSION = 'tex'
-
- DEFAULT_OPTIONS = {
- :wrap => true,
- }
-
- protected
- def text_token text, kind
- @out <<
- if kind == :space
- text
- else
- text = escape_latex(text)
- "\\syn#{kind_to_command(kind)}{#{text}}"
- end
- end
-
- def block_token action, kind
- @out << super
- end
-
- def open_token kind
- "\\syn#{kind_to_command(kind)}{"
- end
-
- def close_token kind
- "}"
- end
-
- def kind_to_command kind
- kind.to_s.gsub(/[^a-z0-9]/i, '').to_sym
- end
-
- def finish options
- case options[:wrap]
- when true, 1, :semiverbatim
- @out = "\\begin{semiverbatim}\n#{@out}\n\\end{semiverbatim}\n"
- when false, 0
- # Nothing to do
- else
- raise ArgumentError, "Unknown :wrap option: '#{options[:wrap]}'"
- end
-
- super
- end
-
- # Escape text so it's interpreted literally by LaTeX compilers
- def escape_latex string
- string.to_s.gsub(/[$\\{}_%#&~^"]/) do |s|
- case s
- when '$'
- '\$'
- when '\\'
- '\synbs{}'
- when /[{}_%#&]/
- "\\#{s}"
- when /[~^]/
- "\\#{s}{}"
- when '"'
- '"{}'
- end
- end
- end
-
- end
-
-end
-end
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html
deleted file mode 100755
index a23f094..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=A
deleted file mode 100755
index 9c255dc..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=D
deleted file mode 100755
index 79e6552..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=D;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=A
deleted file mode 100755
index 36ef38c..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=D
deleted file mode 100755
index 55e3bee..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=M;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=A
deleted file mode 100755
index a23f094..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=D
deleted file mode 100755
index 79e6552..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=N;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=A
deleted file mode 100755
index 00c2252..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=D
deleted file mode 100755
index 79e6552..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/index.html@C=S;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="scanners/">scanners/</a> 24-Sep-2006 16:58 -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="encoders/">encoders/</a> 28-Sep-2006 00:48 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html
deleted file mode 100755
index a35fdd7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="javascript.rb">javascript.rb</a> 24-Sep-2006 16:58 5.5K
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="javascript/">javascript/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=D;O=A
deleted file mode 100755
index 9b896d4..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=D;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="javascript.rb">javascript.rb</a> 24-Sep-2006 16:58 5.5K
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="javascript/">javascript/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=M;O=A
deleted file mode 100755
index 6860db0..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=M;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="javascript.rb">javascript.rb</a> 24-Sep-2006 16:58 5.5K
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="javascript/">javascript/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=N;O=D
deleted file mode 100755
index e34a9bd..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=N;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="javascript/">javascript/</a> 24-Sep-2006 16:58 -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="javascript.rb">javascript.rb</a> 24-Sep-2006 16:58 5.5K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=S;O=A
deleted file mode 100755
index a92141d..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/index.html@C=S;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="javascript/">javascript/</a> 24-Sep-2006 16:58 -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="javascript.rb">javascript.rb</a> 24-Sep-2006 16:58 5.5K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript.rb b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript.rb
deleted file mode 100755
index da67084..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript.rb
+++ /dev/null
@@ -1,199 +0,0 @@
-module CodeRay
-module Scanners
-
- # Basic Javascript scanner
- class Javascript < Scanner
-
- include Streamable
-
- register_for :javascript
-
- helper :patterns
-
- DEFAULT_OPTIONS = {
- }
-
- private
- def scan_tokens tokens, options
- first_bake = saved_tokens = nil
- last_token_dot = false
- last_state = nil
- state = :initial
- depth = nil
- inline_block_stack = []
-
- patterns = Patterns # avoid constant lookup
-
- until eos?
- match = nil
- kind = nil
-
- if state.instance_of? patterns::StringState
-# {{{
- match = scan_until(state.pattern) || scan_until(/\z/)
- tokens << [match, :content] unless match.empty?
- break if eos?
-
- case match = getch
-
- when state.delim
- if state.paren
- state.paren_depth -= 1
- if state.paren_depth > 0
- tokens << [match, :nesting_delimiter]
- next
- end
- end
- tokens << [match, :delimiter]
- tokens << [:close, state.type]
- state = state.next_state
-
- when '\\'
- if state.interpreted
- if esc = scan(/ #{patterns::ESCAPE} /ox)
- tokens << [match + esc, :char]
- else
- tokens << [match, :error]
- end
- else
- case m = getch
- when state.delim, '\\'
- tokens << [match + m, :char]
- when nil
- tokens << [match, :error]
- else
- tokens << [match + m, :content]
- end
- end
-
- when '#'
- case peek(1)[0]
- when ?{
- inline_block_stack << [state, depth]
- state = :initial
- depth = 1
- tokens << [:open, :inline]
- tokens << [match + getch, :delimiter]
- when ?$, ?@
- tokens << [match, :escape]
- last_state = state # scan one token as normal code, then return here
- state = :initial
- else
- raise_inspect 'else-case # reached; #%p not handled' % peek(1), tokens
- end
-
- when state.paren
- state.paren_depth += 1
- tokens << [match, :nesting_delimiter]
-
- else
- raise_inspect 'else-case " reached; %p not handled, state = %p' % [match, state], tokens
-
- end
- next
-# }}}
- else
-# {{{
- if match = scan(/ [ \t\f]+ | \\? \n | \# .* /x)
- case m = match[0]
- when ?\s, ?\t, ?\f
- match << scan(/\s*/) unless eos?
- kind = :space
- when ?\n, ?\\
- kind = :space
- match << scan(/\s*/) unless eos?
- when ?#, ?=, ?_
- kind = :comment
- else
- raise_inspect 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens
- end
- tokens << [match, kind]
- next
-
- elsif state == :initial
-
- # IDENTS #
- if match = scan(/#{patterns::METHOD_NAME}/o)
- kind = last_token_dot ? :ident :
- patterns::IDENT_KIND[match]
-
- # OPERATORS #
- elsif (not last_token_dot and match = scan(/ ==?=? | \.\.?\.? | [\(\)\[\]\{\}] | :: | , /x)) or
- (last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}/o))
- last_token_dot = :set if match == '.' or match == '::'
- kind = :operator
- unless inline_block_stack.empty?
- case match
- when '{'
- depth += 1
- when '}'
- depth -= 1
- if depth == 0 # closing brace of inline block reached
- state, depth = inline_block_stack.pop
- tokens << [match, :delimiter]
- kind = :inline
- match = :close
- end
- end
- end
-
- elsif match = scan(/ ['"] /mx)
- tokens << [:open, :string]
- kind = :delimiter
- state = patterns::StringState.new :string, match == '"', match # important for streaming
-
- elsif match = scan(/#{patterns::NUMERIC}/o)
- kind = if self[1] then :float else :integer end
-
- elsif match = scan(/ \+\+ | -- | << | >> /x)
- kind = :operator
-
- elsif match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)
- kind = :operator
-
- elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
- kind = :operator
-
- else
- kind = :error
- match = getch
-
- end
-
- end
-# }}}
-
- last_token_dot = last_token_dot == :set
-
- if $DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens, state
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- if last_state
- state = last_state
- last_state = nil
- end
- end
- end
-
- inline_block_stack << [state] if state.is_a? patterns::StringState
- until inline_block_stack.empty?
- this_block = inline_block_stack.pop
- tokens << [:close, :inline] if this_block.size > 1
- state = this_block.first
- tokens << [:close, state.type]
- end
-
- tokens
- end
-
- end
-
-end
-end
-
-# vim:fdm=marker
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript/index.html
deleted file mode 100755
index 9a3769c..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/coderay/scanners/javascript/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib/coderay/scanners/javascript</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib/coderay/scanners/javascript</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/lib/coderay/scanners/">Parent Directory</a> -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="patterns.rb">patterns.rb</a> 24-Sep-2006 16:58 2.5K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html
deleted file mode 100755
index af2e071..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=A
deleted file mode 100755
index 6c8f2f8..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=D
deleted file mode 100755
index 80551b7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=D;O=D
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=A
deleted file mode 100755
index 27bdbd0..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=D
deleted file mode 100755
index 80551b7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=M;O=D
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=A
deleted file mode 100755
index af2e071..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=D
deleted file mode 100755
index 80551b7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=N;O=D
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=A
deleted file mode 100755
index 224354b..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=A
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=D
deleted file mode 100755
index 80551b7..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/lib/index.html@C=S;O=D
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/lib</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/lib</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/folder.gif" alt="[DIR]" /> <a href="coderay/">coderay/</a> 24-Sep-2006 16:58 -
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html b/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html
deleted file mode 100755
index 8d79e63..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/test</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/test</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="test_javascript_scanner.rb">test_javascript_scanner.rb</a> 24-Sep-2006 16:58 3.9K
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="test_latex_encoder.rb">test_latex_encoder.rb</a> 28-Sep-2006 00:48 4.0K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=D;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=D;O=A
deleted file mode 100755
index d3e4481..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=D;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/test</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/test</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=D">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="test_javascript_scanner.rb">test_javascript_scanner.rb</a> 24-Sep-2006 16:58 3.9K
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="test_latex_encoder.rb">test_latex_encoder.rb</a> 28-Sep-2006 00:48 4.0K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=M;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=M;O=A
deleted file mode 100755
index 0fa49ac..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=M;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/test</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/test</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=D">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="test_javascript_scanner.rb">test_javascript_scanner.rb</a> 24-Sep-2006 16:58 3.9K
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="test_latex_encoder.rb">test_latex_encoder.rb</a> 28-Sep-2006 00:48 4.0K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=N;O=D b/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=N;O=D
deleted file mode 100755
index 81f5381..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=N;O=D
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/test</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/test</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="test_latex_encoder.rb">test_latex_encoder.rb</a> 28-Sep-2006 00:48 4.0K
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="test_javascript_scanner.rb">test_javascript_scanner.rb</a> 24-Sep-2006 16:58 3.9K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=S;O=A b/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=S;O=A
deleted file mode 100755
index fd7e1e9..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/index.html@C=S;O=A
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
- <head>
- <title>Index of /darcs/coderay/test</title>
- </head>
- <body>
-<h1>Index of /darcs/coderay/test</h1>
-<pre><img src="/icons/blank.gif" alt="Icon " /> <a href="?C=N;O=A">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=D">Size</a> <a href="?C=D;O=A">Description</a><hr /><img src="/icons/back.gif" alt="[DIR]" /> <a href="/darcs/coderay/">Parent Directory</a> -
-<img src="/icons/unknown.gif" alt="[ ]" /> <a href="test_javascript_scanner.rb">test_javascript_scanner.rb</a> 24-Sep-2006 16:58 3.9K
-<img src="/icons/text.gif" alt="[TXT]" /> <a href="test_latex_encoder.rb">test_latex_encoder.rb</a> 28-Sep-2006 00:48 4.0K
-<hr /></pre>
-<address>Apache/2.0.46 (CentOS) Server at www.demiurgo.org Port 80</address>
-</body></html>
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/test_javascript_scanner.rb b/etc/todo/www.demiurgo.org/darcs/coderay/test/test_javascript_scanner.rb
deleted file mode 100755
index e1bfe70..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/test_javascript_scanner.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-require 'test/unit'
-require 'coderay'
-
-class TC_Latex_Encoder < Test::Unit::TestCase
- def setup
- CodeRay::Encoders.plugin_path 'lib/coderay/encoders'
- @enc = CodeRay::Encoders[:latex].new
- end
-
-
- def test_simple
- source_text = <<EOD
-function update_stars(num)
-{
- for (var i = 0; i < 10; ++i) {
- var star = $("star"+(i+1));
- if (i < num) {
- if (! star.visible()) {
- Effect.Appear(star);
- }
- } else {
- if (star.visible()) {
- Effect.Fade(star);
- }
- }
- }
-}
-EOD
- expected = [["function", :reserved],[" ", :space],["update_stars", :ident],
- ["(", :operator], ["num", :ident], [")", :operator],
- ["\n", :space],
- ["{", :operator],
- ["\n ", :space],
- ["for", :reserved], [" ", :space],
- ["(", :operator], ["var", :reserved], [" ", :space],
- ["i", :ident],[" ", :space], ["=", :operator], [" ", :space],
- ["0", :integer],
- [";", :operator],
- [" ", :space], ["i", :ident], [" ", :space],
- ["<", :operator], [" ", :space], ["10", :integer],
- [";", :operator],
- [" ", :space], ["++", :operator], ["i", :ident],
- [")", :operator], [" ", :space], ["{", :operator],
- ["\n ", :space],
- ["var", :reserved], [" ", :space], ["star", :ident],
- [" ", :space], ["=", :operator], [" ", :space],
- ["$", :ident], ["(", :operator],
- [:open, :string], ["\"", :delimiter], ["star", :content],
- ["\"", :delimiter], [:close, :string],
- ["+", :operator],
- ["(", :operator], ["i", :ident], ["+", :operator],
- ["1", :integer], [")", :operator],
- [")", :operator],
- [";", :operator],
- ["\n ", :space],
- ["if", :reserved], [" ", :space],
- ["(", :operator], ["i", :ident], [" ", :space],
- ["<", :operator], [" ", :space], ["num", :ident],
- [")", :operator], [" ", :space], ["{", :operator],
- ["\n ", :space],
- ["if", :reserved], [" ", :space],
- ["(", :operator], ["!", :operator], [" ", :space],
- ["star", :ident], [".", :operator], ["visible", :ident],
- ["(", :operator], [")", :operator], [")", :operator],
- [" ", :space],
- ["{", :operator],
- ["\n ", :space],
- ["Effect", :ident], [".", :operator], ["Appear", :ident],
- ["(", :operator], ["star", :ident], [")", :operator],
- [";", :operator], ["\n ", :space],
- ["}", :operator],
- ["\n ", :space],
- ["}", :operator],
- [" ", :space], ["else", :reserved], [" ", :space],
- ["{", :operator],
- ["\n ", :space],
- ["if", :reserved], [" ", :space],
- ["(", :operator], ["star", :ident], [".", :operator],
- ["visible", :ident], ["(", :operator], [")", :operator],
- [")", :operator],
- [" ", :space],
- ["{", :operator],
- ["\n ", :space],
- ["Effect", :ident], [".", :operator], ["Fade", :ident],
- ["(", :operator], ["star", :ident], [")", :operator],
- [";", :operator],
- ["\n ", :space],
- ["}", :operator],
- ["\n ", :space],
- ["}", :operator],
- ["\n ", :space],
- ["}", :operator],
- ["\n", :space],
- ["}", :operator],
- ["\n", :space]]
- symbol_list = CodeRay.scan(source_text, :javascript)
- assert_equal(expected, symbol_list)
- end
-
-
- def teardown
- @enc = nil
- end
-end
diff --git a/etc/todo/www.demiurgo.org/darcs/coderay/test/test_latex_encoder.rb b/etc/todo/www.demiurgo.org/darcs/coderay/test/test_latex_encoder.rb
deleted file mode 100755
index 686aa38..0000000
--- a/etc/todo/www.demiurgo.org/darcs/coderay/test/test_latex_encoder.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-require 'test/unit'
-require 'coderay'
-
-class TC_Latex_Encoder < Test::Unit::TestCase
- def setup
- CodeRay::Encoders.plugin_path 'lib/coderay/encoders'
- @enc = CodeRay::Encoders[:latex].new
- end
-
-
- def test_escape_latex
- tests = {"I have $30, and new\\\nline" => "I have \\$30, and new\\synbs{}\nline",
- 'I like "clean & simple" things just best than {obscure,complicated}' => 'I like "{}clean \& simple"{} things just best than \{obscure,complicated\}',
- "The string '\\'' is valid... in C" => "The string '\\synbs{}'' is valid... in C",
- "Escape dollars as \\$, and continue line, backslash at the end, like so: \\\n" => "Escape dollars as \\synbs{}\\$, and continue line, backslash at the end, like so: \\synbs{}\n",
- "Perl: $foo{some_key} =~ /^#.*$/" => "Perl: \\$foo\\{some\\_key\\} =\\~{} /\\^{}\\#.*\\$/",
- "Double backslash escaping: \\\\" => "Double backslash escaping: \\synbs{}\\synbs{}",
- "\"Some\nmultiline\nstring\"" => "\"{}Some\nmultiline\nstring\"{}",
- "printf(\"Hello, World\\n\");" => "printf(\"{}Hello, World\\synbs{}n\"{});"}
- tests.each_pair do |k,v|
- assert_equal(v, @enc.send(:escape_latex, k))
- end
- end
-
-
- def test_simple
- source_text = <<EOD
-require 'coderay'
-
-# scan some code
-tokens = CodeRay.scan('some_file.rb', :ruby)
-
-# dump using LaTeX
-puts tokens.latex
-EOD
- expected = [["require", :ident], [" ", :space], [:open, :string],
- ["'", :delimiter], ["coderay", :content], ["'", :delimiter],
- [:close, :string], ["\n\n", :space],
- ["# scan some code", :comment], ["\n", :space],
- ["tokens", :ident], [" ", :space], ["=", :operator],
- [" ", :space], ["CodeRay", :constant], [".", :operator],
- ["scan", :ident], ["(", :operator], [:open, :string],
- ["'", :delimiter], ["some_file.rb", :content],
- ["'", :delimiter], [:close, :string], [",", :operator],
- [" ", :space], [":ruby", :symbol], [")", :operator],
- ["\n\n", :space], ["# dump using LaTeX", :comment],
- ["\n", :space], ["puts", :ident], [" ", :space],
- ["tokens", :ident], [".", :operator], ["latex", :ident],
- ["\n", :space]]
- symbol_list = CodeRay.scan(source_text, :ruby)
- assert_equal(expected, symbol_list)
-
- expected_latex = <<'EOD'
-\begin{semiverbatim}
-\synident{require} \synstring{\syndelimiter{'}\syncontent{coderay}\syndelimiter{'}}
-
-\syncomment{\# scan some code}
-\synident{tokens} \synoperator{=} \synconstant{CodeRay}\synoperator{.}\synident{scan}\synoperator{(}\synstring{\syndelimiter{'}\syncontent{some\_file.rb}\syndelimiter{'}}\synoperator{,} \synsymbol{:ruby}\synoperator{)}
-
-\syncomment{\# dump using LaTeX}
-\synident{puts} \synident{tokens}\synoperator{.}\synident{latex}
-
-\end{semiverbatim}
-EOD
- assert_equal(expected_latex, symbol_list.latex)
- end
-
- def test_wrap
- source_text = <<EOD
-require 'coderay'
-
-# scan some code
-tokens = CodeRay.scan('some_file.rb', :ruby)
-
-# dump using LaTeX
-puts tokens.latex
-EOD
-
- expected_latex = <<'EOD'
-\synident{require} \synstring{\syndelimiter{'}\syncontent{coderay}\syndelimiter{'}}
-
-\syncomment{\# scan some code}
-\synident{tokens} \synoperator{=} \synconstant{CodeRay}\synoperator{.}\synident{scan}\synoperator{(}\synstring{\syndelimiter{'}\syncontent{some\_file.rb}\syndelimiter{'}}\synoperator{,} \synsymbol{:ruby}\synoperator{)}
-
-\syncomment{\# dump using LaTeX}
-\synident{puts} \synident{tokens}\synoperator{.}\synident{latex}
-EOD
- expected_latex2 = <<EOD
-\\begin{semiverbatim}
-#{expected_latex}
-\\end{semiverbatim}
-EOD
- symbols = CodeRay.scan(source_text, :ruby)
- assert_equal(expected_latex, symbols.latex(:wrap => false))
- assert_equal(expected_latex2, symbols.latex)
- assert_equal(expected_latex2, symbols.latex(:wrap => true))
- assert_equal(expected_latex2, symbols.latex(:wrap => :semiverbatim))
- end
-
- def teardown
- @enc = nil
- end
-end
diff --git a/etc/token_class_hierarchy.rb b/etc/token_class_hierarchy.rb
deleted file mode 100644
index 4dc3f1f..0000000
--- a/etc/token_class_hierarchy.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class TokenClass
- def self.const_missing name
- const_set name, Class.new(self)
- end
- def self.method_missing name, &block
- clas = const_missing name
- if block
- clas.instance_eval(&block)
- end
- end
-end
-
-class Comment < TokenClass
- Multiline
- class Shebang < self
- Foo
- end
-end
-
-p Comment::Blubb::Bla <= Comment::Blubb
-
-ObjectSpace.each_object(Class) { |o| p o if o < TokenClass } \ No newline at end of file