summaryrefslogtreecommitdiff
path: root/etc/todo/scanners
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 /etc/todo/scanners
parenta4b8b094da5525354cb8a927761385825236c5a1 (diff)
downloadcoderay-a1582d7856bc385b7bad492d8fc3f02e2b9f4d94.tar.gz
remove etc folder
Diffstat (limited to 'etc/todo/scanners')
-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
23 files changed, 0 insertions, 15871 deletions
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